diff options
| author | Gabriel Schneider <[email protected]> | 2026-07-01 22:45:09 -0300 |
|---|---|---|
| committer | Gabriel Schneider <[email protected]> | 2026-08-01 15:02:07 -0300 |
| commit | 96ee55b304b0f0a8d340c6a6d0f3c931b08788dd (patch) | |
| tree | d66d5a76b3fb79c50f691f1621612a3c01871d1b /build.zig | |
| parent | 3bde721b4013136df8076cbb1f5612445cd9808e (diff) | |
| download | pardes-96ee55b304b0f0a8d340c6a6d0f3c931b08788dd.tar.gz pardes-96ee55b304b0f0a8d340c6a6d0f3c931b08788dd.zip | |
added static linking
Diffstat (limited to 'build.zig')
| -rw-r--r-- | build.zig | 10 |
1 files changed, 10 insertions, 0 deletions
@@ -13,17 +13,23 @@ pub fn build(b: *std.Build) void { // pump/waitFor and on every assertion) so failures can be inspected live. // Usage: `zig build test -Dtrace`. const trace = b.option(bool, "trace", "print captured tty/screen state during e2e tests") orelse false; + const static_link = b.option(bool, "static", "link all build executables and test binaries statically") orelse false; + const exe_linkage: ?std.builtin.LinkMode = if (static_link) .static else null; + const strip = b.option(bool, "strip", "strip debug info from the compiled pardes binary") orelse false; const exe = b.addExecutable(.{ .name = "pardes", + .linkage = exe_linkage, .root_module = b.createModule(.{ .target = target, .optimize = optimize, .root_source_file = b.path("main.zig"), + .strip = strip, }), }); const tests = b.addExecutable(.{ .name = "pardes-e2e", + .linkage = exe_linkage, .root_module = b.createModule(.{ .target = target, .optimize = optimize, @@ -170,6 +176,7 @@ pub fn build(b: *std.Build) void { // `zig build tutor-gen` runs it; the unit-test step depends on the output. const tutor_gen = b.addExecutable(.{ .name = "tutor-gen", + .linkage = exe_linkage, .root_module = b.createModule(.{ .target = target, .optimize = optimize, @@ -203,6 +210,7 @@ pub fn build(b: *std.Build) void { .root_source_file = b.path("modal.zig"), }), }); + unit_tests.linkage = exe_linkage; const run_unit = b.addRunArtifact(unit_tests); const unit_step = b.step("unit-test", "run modal.zig unit tests"); unit_step.dependOn(&run_unit.step); @@ -217,6 +225,7 @@ pub fn build(b: *std.Build) void { .root_source_file = b.path("petscii.zig"), }), }); + petscii_tests.linkage = exe_linkage; const run_petscii = b.addRunArtifact(petscii_tests); unit_step.dependOn(&run_petscii.step); test_step.dependOn(&run_petscii.step); @@ -231,6 +240,7 @@ pub fn build(b: *std.Build) void { .root_source_file = tutor_cases_lazy, }), }); + tutor_tests.linkage = exe_linkage; // The generated cases `@import("modal")` (a module name, not a relative // path, since the generated file lives in the cache dir, not next to modal.zig). const modal_for_tutor = b.createModule(.{ |
