odin_chat_client/justfile

50 lines
1.6 KiB
Plaintext

set shell := ["cmd.exe", "/c"]
alias b := build
alias r := run
c_flags := if os() == "macos" {
"$(curl-config --libs) -framework Cocoa -framework QuartzCore -framework CoreImage -framework Metal -framework MetalKit -ObjC"
} else if os_family() == "unix" {
"$(curl-config --libs) -lEGL -lGLESv2 -lGL -lm -lwayland-client -lwayland-egl -lX11 -lXi -lXcursor -Wno-implicit-function-declaration"
} else if os_family() == "windows" {
""
} else { "" }
[macos]
build: build_gfx
odin build src/ -out:bin/chat_client -debug -lld -extra-linker-flags:"-framework Cocoa -framework QuartzCore -framework CoreImage -framework Metal -framework MetalKit"
[macos]
build_gfx: compile_shaders_metal
mkdir -p bin
cc -O0 -g -c -ObjC -Wall -Wextra -D_FONT_WIDTH=12 -D_FONT_HEIGHT=24 -DED_GFX_IMPLEMENTATION vendor/pcleavelin/gfx.h -o bin/libgfx.a
[macos]
run: build
./bin/chat_client
[macos]
compile_shaders_metal:
mkdir -p bin/compiled_shaders
xcrun -sdk macosx metal -o bin/compiled_shaders/text_atlas.ir -c shaders/text_atlas.metal
xcrun -sdk macosx metallib -o bin/shaders.metallib bin/compiled_shaders/text_atlas.ir
[windows]
build: build_gfx
odin build src\ -out:bin\chat_client.exe -debug -lld
[windows]
run: build
bin\chat_client.exe
[windows]
build_gfx: compile_shaders_directx
if not exist bin\ mkdir bin
cl /nologo -Zi /c /Fdbin\ /Fobin\ /Ivendor\ /DWIN32_LEAN_AND_MEAN /D_FONT_WIDTH=16 /D_FONT_HEIGHT=32 /DED_GFX_IMPLEMENTATION /std:c11 /TC vendor\pcleavelin\gfx.h
[windows]
compile_shaders_directx:
if not exist bin\compiled_shaders\ mkdir bin\compiled_shaders