| author | |
| committer | |
| log | 7abc3738a2f0e024bee12e2046054a62fb8aa3e0 |
| tree | 9a8af11e11e1ba2d31b56239faa23111c07fe171 |
| parent | 7fad555e5e16e6cb71554981394387a0622093b0 |
I find myself quite often creating ReleaseSafe builds and putting them
to production for certain experiments:
- Debug info are for stack traces. An ongoing example where those would
help is #14815.
- Safety checks would have saved a couple of mine and @kubkon's hours in
#15098.
This is a breaking change for scripts that make Zig releases -- I will
submit another PR to zig-bootstrap and release-cutter after this is
merged.5 files changed, 9 insertions(+), 10 deletions(-)
CMakeLists.txt+2-2| ... | ... | @@ -813,9 +813,9 @@ endif() |
| 813 | 813 | if("${CMAKE_BUILD_TYPE}" STREQUAL "Debug") |
| 814 | 814 | set(ZIG_RELEASE_ARG "") |
| 815 | 815 | elseif("${CMAKE_BUILD_TYPE}" STREQUAL "RelWithDebInfo") |
| 816 | set(ZIG_RELEASE_ARG -Drelease) | |
| 816 | set(ZIG_RELEASE_ARG -Doptimize=ReleaseFast) | |
| 817 | 817 | else() |
| 818 | set(ZIG_RELEASE_ARG -Drelease -Dstrip) | |
| 818 | set(ZIG_RELEASE_ARG -Doptimize=ReleaseFast -Dstrip) | |
| 819 | 819 | endif() |
| 820 | 820 | if(ZIG_NO_LIB) |
| 821 | 821 | set(ZIG_NO_LIB_ARG "-Dno-lib") |
build.zig+4-5| ... | ... | @@ -13,7 +13,6 @@ const zig_version = std.builtin.Version{ .major = 0, .minor = 11, .patch = 0 }; |
| 13 | 13 | const stack_size = 32 * 1024 * 1024; |
| 14 | 14 | |
| 15 | 15 | pub fn build(b: *std.Build) !void { |
| 16 | const release = b.option(bool, "release", "Build in release mode") orelse false; | |
| 17 | 16 | const only_c = b.option(bool, "only-c", "Translate the Zig compiler to C code, with only the C backend enabled") orelse false; |
| 18 | 17 | const target = t: { |
| 19 | 18 | var default_target: std.zig.CrossTarget = .{}; |
| ... | ... | @@ -22,10 +21,10 @@ pub fn build(b: *std.Build) !void { |
| 22 | 21 | } |
| 23 | 22 | break :t b.standardTargetOptions(.{ .default_target = default_target }); |
| 24 | 23 | }; |
| 25 | const optimize: std.builtin.OptimizeMode = if (release) switch (target.getCpuArch()) { | |
| 26 | .wasm32 => .ReleaseSmall, | |
| 27 | else => .ReleaseFast, | |
| 28 | } else .Debug; | |
| 24 | ||
| 25 | // TODO remove type annotation with ziglang/zig#13749 | |
| 26 | const optimize: std.builtin.Mode = b.option(std.builtin.Mode, "optimize", "Prioritize performance, safety, or binary size (-O flag)") orelse | |
| 27 | if (target.getCpuArch() == .wasm32) .ReleaseSmall else .Debug; | |
| 29 | 28 | |
| 30 | 29 | const single_threaded = b.option(bool, "single-threaded", "Build artifacts that run in single threaded mode"); |
| 31 | 30 | const use_zig_libcxx = b.option(bool, "use-zig-libcxx", "If libc++ is needed, use zig's bundled version, don't try to integrate with the system") orelse false; |
ci/aarch64-macos.sh+1-1| ... | ... | @@ -58,7 +58,7 @@ stage3-release/bin/zig build \ |
| 58 | 58 | --prefix stage4-release \ |
| 59 | 59 | -Denable-llvm \ |
| 60 | 60 | -Dno-lib \ |
| 61 | -Drelease \ | |
| 61 | -Doptimize=ReleaseFast \ | |
| 62 | 62 | -Dstrip \ |
| 63 | 63 | -Dtarget=$TARGET \ |
| 64 | 64 | -Duse-zig-libcxx \ |
ci/x86_64-linux-release.sh+1-1| ... | ... | @@ -77,7 +77,7 @@ stage3-release/bin/zig build \ |
| 77 | 77 | --prefix stage4-release \ |
| 78 | 78 | -Denable-llvm \ |
| 79 | 79 | -Dno-lib \ |
| 80 | -Drelease \ | |
| 80 | -Doptimize=ReleaseFast \ | |
| 81 | 81 | -Dstrip \ |
| 82 | 82 | -Dtarget=$TARGET \ |
| 83 | 83 | -Duse-zig-libcxx \ |
ci/x86_64-macos-release.sh+1-1| ... | ... | @@ -61,7 +61,7 @@ stage3/bin/zig build \ |
| 61 | 61 | --prefix stage4 \ |
| 62 | 62 | -Denable-llvm \ |
| 63 | 63 | -Dno-lib \ |
| 64 | -Drelease \ | |
| 64 | -Doptimize=ReleaseFast \ | |
| 65 | 65 | -Dstrip \ |
| 66 | 66 | -Dtarget=$TARGET \ |
| 67 | 67 | -Duse-zig-libcxx \ |