Skip to content

Commit 5176586

Browse files
committed
Load options early
1 parent eb50a06 commit 5176586

File tree

1 file changed

+8
-5
lines changed

1 file changed

+8
-5
lines changed

build.zig

Lines changed: 8 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -7,6 +7,11 @@ pub fn build(b: *std.Build) !void {
77

88
const no_fail = b.option(bool, "no_fail", "Ignore build panic") orelse false;
99

10+
// TinyCC options
11+
const CONFIG_TCC_BCHECK = b.option(bool, "CONFIG_TCC_BCHECK", "compile with built-in memory and bounds checker (implies -g)") orelse true;
12+
const CONFIG_TCC_BACKTRACE = b.option(bool, "CONFIG_TCC_BACKTRACE", "link with backtrace (stack dump) support [show max N callers]") orelse true;
13+
const CONFIG_MEM_DEBUG = b.option(bool, "CONFIG_MEM_DEBUG", "compile with MEM_DEBUG flag defined for tcc") orelse false;
14+
1015
switch (target.result.os.tag) {
1116
.windows, .macos, .linux => {},
1217
else => if (no_fail) return else @panic("Unsupported OS"),
@@ -73,13 +78,11 @@ pub fn build(b: *std.Build) !void {
7378
try FLAGS.append("-DONE_SOURCE=0");
7479
try FLAGS.append("-DTCC_LIBTCC1=\"\\0\"");
7580

76-
if (!(b.option(bool, "CONFIG_TCC_BCHECK", "compile with built-in memory and bounds checker (implies -g)") orelse true))
81+
if (!CONFIG_TCC_BCHECK)
7782
try FLAGS.append("-DCONFIG_TCC_BCHECK=0");
78-
79-
if (!(b.option(bool, "CONFIG_TCC_BACKTRACE", "link with backtrace (stack dump) support [show max N callers]") orelse true))
83+
if (!CONFIG_TCC_BACKTRACE)
8084
try FLAGS.append("-DCONFIG_TCC_BACKTRACE=0");
81-
82-
if (b.option(bool, "CONFIG_MEM_DEBUG", "compile with MEM_DEBUG flag defined for tcc") orelse false)
85+
if (CONFIG_MEM_DEBUG)
8386
try FLAGS.append("-DMEM_DEBUG=2");
8487

8588
for (SOURCES) |file|

0 commit comments

Comments
 (0)