39 lines
1.2 KiB
Plaintext
39 lines
1.2 KiB
Plaintext
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 { "" }
|
|
|
|
[macos]
|
|
build: transpile_shaders_metal
|
|
mkdir -p bin
|
|
cc -Ivendor/ -O0 -g -Wall -Wextra {{ c_flags }} src/*.c -o bin/chat_client
|
|
|
|
[linux]
|
|
build: generate_wayland_protocols
|
|
mkdir -p bin
|
|
cc -Ivendor/ -O0 -g -Wall -Wextra {{ c_flags }} src/*.c src/wayland-crap/*.c -o bin/chat_client
|
|
|
|
[linux]
|
|
run: build
|
|
nixGLIntel ./bin/chat_client
|
|
|
|
[macos]
|
|
run: build
|
|
./bin/chat_client
|
|
|
|
[linux]
|
|
generate_wayland_protocols:
|
|
wayland-scanner client-header src/wayland-crap/xdg-shell.xml src/wayland-crap/xdg-shell.h
|
|
wayland-scanner code src/wayland-crap/xdg-shell.xml src/wayland-crap/xdg-shell.c
|
|
|
|
[macos]
|
|
transpile_shaders_metal:
|
|
mkdir -p bin/transpiled_shaders
|
|
|
|
xcrun -sdk macosx metal -o bin/transpiled_shaders/text_atlas.ir -c shaders/text_atlas.metal
|
|
xcrun -sdk macosx metallib -o bin/shaders.metallib bin/transpiled_shaders/text_atlas.ir
|