diff options
| author | Mitchell Hashimoto <m@mitchellh.com> | 2025-01-02 13:41:47 -0800 |
|---|---|---|
| committer | GitHub <noreply@github.com> | 2025-01-02 13:41:47 -0800 |
| commit | f60068eabd94e6784f3b557c7287c49dd36bb24c (patch) | |
| tree | 7c7239e468801681c1f967535ed8833c3884167c /build.zig | |
| parent | 7eb6b29d4c7b74dee40fdb2a135fd050daa3daec (diff) | |
| parent | 6a8b31571bd3a56a0406250bd4e746b0fa5602e5 (diff) | |
add option to strip build regardless of optimization (#3945)
adds the option "strip" which can be used to override the default strip
setting, which is based on the optimization mode.
Useful for a distro setting where you want a release build but still
keep symbols.
Also reuses the option for the shared and static library
Diffstat (limited to 'build.zig')
| -rw-r--r-- | build.zig | 18 |
1 files changed, 13 insertions, 5 deletions
@@ -158,6 +158,16 @@ pub fn build(b: *std.Build) !void { "Build a Position Independent Executable. Default true for system packages.", ) orelse system_package; + const strip = b.option( + bool, + "strip", + "Strip the final executable. Default true for fast and small releases", + ) orelse switch (optimize) { + .Debug => false, + .ReleaseSafe => false, + .ReleaseFast, .ReleaseSmall => true, + }; + const conformance = b.option( []const u8, "conformance", @@ -342,11 +352,7 @@ pub fn build(b: *std.Build) !void { .root_source_file = b.path("src/main.zig"), .target = target, .optimize = optimize, - .strip = switch (optimize) { - .Debug => false, - .ReleaseSafe => false, - .ReleaseFast, .ReleaseSmall => true, - }, + .strip = strip, }) else null; // Exe @@ -690,6 +696,7 @@ pub fn build(b: *std.Build) !void { .root_source_file = b.path("src/main_c.zig"), .optimize = optimize, .target = target, + .strip = strip, }); _ = try addDeps(b, lib, config); @@ -707,6 +714,7 @@ pub fn build(b: *std.Build) !void { .root_source_file = b.path("src/main_c.zig"), .optimize = optimize, .target = target, + .strip = strip, }); _ = try addDeps(b, lib, config); |
