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()...@@ -813,9 +813,9 @@ endif()
813if("${CMAKE_BUILD_TYPE}" STREQUAL "Debug")813if("${CMAKE_BUILD_TYPE}" STREQUAL "Debug")
814 set(ZIG_RELEASE_ARG "")814 set(ZIG_RELEASE_ARG "")
815elseif("${CMAKE_BUILD_TYPE}" STREQUAL "RelWithDebInfo")815elseif("${CMAKE_BUILD_TYPE}" STREQUAL "RelWithDebInfo")
816 set(ZIG_RELEASE_ARG -Drelease)816 set(ZIG_RELEASE_ARG -Doptimize=ReleaseFast)
817else()817else()
818 set(ZIG_RELEASE_ARG -Drelease -Dstrip)818 set(ZIG_RELEASE_ARG -Doptimize=ReleaseFast -Dstrip)
819endif()819endif()
820if(ZIG_NO_LIB)820if(ZIG_NO_LIB)
821 set(ZIG_NO_LIB_ARG "-Dno-lib")821 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 };...@@ -13,7 +13,6 @@ const zig_version = std.builtin.Version{ .major = 0, .minor = 11, .patch = 0 };
13const stack_size = 32 * 1024 * 1024;13const stack_size = 32 * 1024 * 1024;
1414
15pub fn build(b: *std.Build) !void {15pub fn build(b: *std.Build) !void {
16 const release = b.option(bool, "release", "Build in release mode") orelse false;
17 const only_c = b.option(bool, "only-c", "Translate the Zig compiler to C code, with only the C backend enabled") orelse false;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 const target = t: {17 const target = t: {
19 var default_target: std.zig.CrossTarget = .{};18 var default_target: std.zig.CrossTarget = .{};
...@@ -22,10 +21,8 @@ pub fn build(b: *std.Build) !void {...@@ -22,10 +21,8 @@ pub fn build(b: *std.Build) !void {
22 }21 }
23 break :t b.standardTargetOptions(.{ .default_target = default_target });22 break :t b.standardTargetOptions(.{ .default_target = default_target });
24 };23 };
25 const optimize: std.builtin.OptimizeMode = if (release) switch (target.getCpuArch()) {24
26 .wasm32 => .ReleaseSmall,25 const optimize = b.standardOptimizeOption(.{});
27 else => .ReleaseFast,
28 } else .Debug;
2926
30 const single_threaded = b.option(bool, "single-threaded", "Build artifacts that run in single threaded mode");27 const single_threaded = b.option(bool, "single-threaded", "Build artifacts that run in single threaded mode");
31 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;28 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,7 +58,7 @@ stage3-release/bin/zig build \
58 --prefix stage4-release \58 --prefix stage4-release \
59 -Denable-llvm \59 -Denable-llvm \
60 -Dno-lib \60 -Dno-lib \
61 -Drelease \61 -Doptimize=ReleaseFast \
62 -Dstrip \62 -Dstrip \
63 -Dtarget=$TARGET \63 -Dtarget=$TARGET \
64 -Duse-zig-libcxx \64 -Duse-zig-libcxx \
ci/x86_64-linux-release.sh+1-1
...@@ -78,7 +78,7 @@ stage3-release/bin/zig build \...@@ -78,7 +78,7 @@ stage3-release/bin/zig build \
78 --prefix stage4-release \78 --prefix stage4-release \
79 -Denable-llvm \79 -Denable-llvm \
80 -Dno-lib \80 -Dno-lib \
81 -Drelease \81 -Doptimize=ReleaseFast \
82 -Dstrip \82 -Dstrip \
83 -Dtarget=$TARGET \83 -Dtarget=$TARGET \
84 -Duse-zig-libcxx \84 -Duse-zig-libcxx \
ci/x86_64-macos-release.sh+1-1
...@@ -62,7 +62,7 @@ stage3/bin/zig build \...@@ -62,7 +62,7 @@ stage3/bin/zig build \
62 --prefix stage4 \62 --prefix stage4 \
63 -Denable-llvm \63 -Denable-llvm \
64 -Dno-lib \64 -Dno-lib \
65 -Drelease \65 -Doptimize=ReleaseFast \
66 -Dstrip \66 -Dstrip \
67 -Dtarget=$TARGET \67 -Dtarget=$TARGET \
68 -Duse-zig-libcxx \68 -Duse-zig-libcxx \