This commit is contained in:
Judah Caruso 2026-02-18 18:48:22 -07:00
parent 72ea210de8
commit c7320dd2bc

View file

@ -27,14 +27,14 @@ blocks_include := if os() == "macos" { "" } else { "-I" + blocks_dir / "BlocksRu
blocks_src := if os() == "macos" { "" } else { blocks_dir / "BlocksRuntime" / "runtime.c" + " " + blocks_dir / "BlocksRuntime" / "data.c" }
# cflags
winflags := if os() == "windows" { "" } else { "" }
winflags := if os() == "windows" { "-ld3d11 -lgdi32" } else { "" }
macflags := if os() == "macos" { "-x objective-c -lobjc -framework Foundation -framework Cocoa -framework CoreFoundation -framework CoreGraphics -framework QuartzCore -framework Metal -framework MetalKit" } else { "" }
lnxflags := if os() == "linux" { "" } else { "" }
allflags := macflags + winflags + lnxflags
csrc := "src/main.c" + " " + blocks_src
cinc := "-Isrc -Ithirdparty " + blocks_include
cflags := "-std=c23 -fblocks -g " + allflags + " " + cinc
cflags := "-std=c23 -fblocks -g " + cinc
@ -101,19 +101,19 @@ _mkout:
[doc("Compile natively (debug)")]
[default]
build: vendor _mkout
{{zig}} cc {{cflags}} {{csrc}} {{blocks_include}} -o {{out_dir}}/{{project}}{{exe}}
{{zig}} cc {{cflags}} {{allflags}} {{csrc}} {{blocks_include}} -o {{out_dir}}/{{project}}{{exe}}
[doc("Compile natively with optimizations")]
build-release: vendor _mkout
{{zig}} cc {{cflags}} -Ofast -Wno-everything -ffast-math -DNDEBUG {{csrc}} {{blocks_include}} -o {{out_dir}}/{{project}}{{exe}}
{{zig}} cc {{cflags}} {{allflags}} -Ofast -Wno-everything -ffast-math -DNDEBUG {{csrc}} {{blocks_include}} -o {{out_dir}}/{{project}}{{exe}}
[doc("Compile for wasm32-wasi")]
build-wasm: vendor _mkout
{{zig}} cc {{cflags}} -target wasm32-wasi {{csrc}} {{blocks_include}} -o {{out_dir}}/{{project}}.wasm
{{zig}} cc {{cflags}} {{allflags}} -target wasm32-wasi {{csrc}} {{blocks_include}} -o {{out_dir}}/{{project}}.wasm
[doc("Cross-compile for a Zig target triple (e.g. aarch64-linux-gnu)")]
build-cross target: vendor _mkout
{{zig}} cc {{cflags}} -target {{target}} {{csrc}} {{blocks_include}} -o {{out_dir}}/{{project}}-{{target}}
build-cross target *args: vendor _mkout
{{zig}} cc {{cflags}} -target {{target}} {{csrc}} {{blocks_include}} -o {{out_dir}}/{{project}}-{{target}} {{args}}
[doc("Build and run natively")]
run *args: build