authorgravatar for andrew@ziglang.orgAndrew Kelley <andrew@ziglang.org> 2023-04-18 20:36:56-07:00
committergravatar for noreply@github.comGitHub <noreply@github.com> 2023-04-18 20:36:56-07:00
log0e394cf922fc84e45e70c0b4a183c9c8b8f079fb
treeb3329d1a925ec1fb4d8ef0fa719f7e9f0700ee87
parent07b7c3b31babc0763199fe39db875298d2cc12a6
parente17c872ddaf527707fa91e16276ffc89d7a3be90
signaturebadge-question-mark Signed by PGP key 4AEE18F83AFDEB23

Merge pull request #15192 from motiejus/build-release

zig build: change "-Drelease" to "-Doptimize"

5 files changed, 7 insertions(+), 10 deletions(-)

CMakeLists.txt+2-2
......@@ -813,9 +813,9 @@ endif()
813813if("${CMAKE_BUILD_TYPE}" STREQUAL "Debug")
814814 set(ZIG_RELEASE_ARG "")
815815elseif("${CMAKE_BUILD_TYPE}" STREQUAL "RelWithDebInfo")
816 set(ZIG_RELEASE_ARG -Drelease)
816 set(ZIG_RELEASE_ARG -Doptimize=ReleaseFast)
817817else()
818 set(ZIG_RELEASE_ARG -Drelease -Dstrip)
818 set(ZIG_RELEASE_ARG -Doptimize=ReleaseFast -Dstrip)
819819endif()
820820if(ZIG_NO_LIB)
821821 set(ZIG_NO_LIB_ARG "-Dno-lib")
build.zig+2-5
......@@ -13,7 +13,6 @@ const zig_version = std.builtin.Version{ .major = 0, .minor = 11, .patch = 0 };
1313const stack_size = 32 * 1024 * 1024;
1414
1515pub fn build(b: *std.Build) !void {
16 const release = b.option(bool, "release", "Build in release mode") orelse false;
1716 const only_c = b.option(bool, "only-c", "Translate the Zig compiler to C code, with only the C backend enabled") orelse false;
1817 const target = t: {
1918 var default_target: std.zig.CrossTarget = .{};
......@@ -22,10 +21,8 @@ pub fn build(b: *std.Build) !void {
2221 }
2322 break :t b.standardTargetOptions(.{ .default_target = default_target });
2423 };
25 const optimize: std.builtin.OptimizeMode = if (release) switch (target.getCpuArch()) {
26 .wasm32 => .ReleaseSmall,
27 else => .ReleaseFast,
28 } else .Debug;
24
25 const optimize = b.standardOptimizeOption(.{});
2926
3027 const single_threaded = b.option(bool, "single-threaded", "Build artifacts that run in single threaded mode");
3128 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 \
5858 --prefix stage4-release \
5959 -Denable-llvm \
6060 -Dno-lib \
61 -Drelease \
61 -Doptimize=ReleaseFast \
6262 -Dstrip \
6363 -Dtarget=$TARGET \
6464 -Duse-zig-libcxx \
ci/x86_64-linux-release.sh+1-1
......@@ -78,7 +78,7 @@ stage3-release/bin/zig build \
7878 --prefix stage4-release \
7979 -Denable-llvm \
8080 -Dno-lib \
81 -Drelease \
81 -Doptimize=ReleaseFast \
8282 -Dstrip \
8383 -Dtarget=$TARGET \
8484 -Duse-zig-libcxx \
ci/x86_64-macos-release.sh+1-1
......@@ -62,7 +62,7 @@ stage3/bin/zig build \
6262 --prefix stage4 \
6363 -Denable-llvm \
6464 -Dno-lib \
65 -Drelease \
65 -Doptimize=ReleaseFast \
6666 -Dstrip \
6767 -Dtarget=$TARGET \
6868 -Duse-zig-libcxx \