diff --git a/CMakeLists.txt b/CMakeLists.txt index a6f2fa986ae7937188e8a2d3a7997a4b4026625d..7c63bff6e0b2d3189fbf5f95212e89ff76cdada9 100644 --- a/CMakeLists.txt +++ b/CMakeLists.txt @@ -813,9 +813,9 @@ endif() if("${CMAKE_BUILD_TYPE}" STREQUAL "Debug") set(ZIG_RELEASE_ARG "") elseif("${CMAKE_BUILD_TYPE}" STREQUAL "RelWithDebInfo") - set(ZIG_RELEASE_ARG -Drelease) + set(ZIG_RELEASE_ARG -Doptimize=ReleaseFast) else() - set(ZIG_RELEASE_ARG -Drelease -Dstrip) + set(ZIG_RELEASE_ARG -Doptimize=ReleaseFast -Dstrip) endif() if(ZIG_NO_LIB) set(ZIG_NO_LIB_ARG "-Dno-lib") diff --git a/build.zig b/build.zig index 1385409ec303b0f330251d1e875c84a573725d80..6cb3e35488cb57891cbc00f4312da2adccf057e4 100644 --- a/build.zig +++ b/build.zig @@ -13,7 +13,6 @@ const zig_version = std.builtin.Version{ .major = 0, .minor = 11, .patch = 0 }; const stack_size = 32 * 1024 * 1024; pub fn build(b: *std.Build) !void { - const release = b.option(bool, "release", "Build in release mode") orelse false; const only_c = b.option(bool, "only-c", "Translate the Zig compiler to C code, with only the C backend enabled") orelse false; const target = t: { var default_target: std.zig.CrossTarget = .{}; @@ -22,10 +21,8 @@ pub fn build(b: *std.Build) !void { } break :t b.standardTargetOptions(.{ .default_target = default_target }); }; - const optimize: std.builtin.OptimizeMode = if (release) switch (target.getCpuArch()) { - .wasm32 => .ReleaseSmall, - else => .ReleaseFast, - } else .Debug; + + const optimize = b.standardOptimizeOption(.{}); const single_threaded = b.option(bool, "single-threaded", "Build artifacts that run in single threaded mode"); 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; diff --git a/ci/aarch64-macos.sh b/ci/aarch64-macos.sh index a4c2b9a748c2312e5567919f8857e54fc46d204f..c5ce361722aa18b607c44c5689e38e824298b194 100755 --- a/ci/aarch64-macos.sh +++ b/ci/aarch64-macos.sh @@ -58,7 +58,7 @@ stage3-release/bin/zig build \ --prefix stage4-release \ -Denable-llvm \ -Dno-lib \ - -Drelease \ + -Doptimize=ReleaseFast \ -Dstrip \ -Dtarget=$TARGET \ -Duse-zig-libcxx \ diff --git a/ci/x86_64-linux-release.sh b/ci/x86_64-linux-release.sh index 4351707864080ea932605c5c16b2a159d7e0c0ea..e35daa21247c99193af651faecf8b3597ae24857 100755 --- a/ci/x86_64-linux-release.sh +++ b/ci/x86_64-linux-release.sh @@ -78,7 +78,7 @@ stage3-release/bin/zig build \ --prefix stage4-release \ -Denable-llvm \ -Dno-lib \ - -Drelease \ + -Doptimize=ReleaseFast \ -Dstrip \ -Dtarget=$TARGET \ -Duse-zig-libcxx \ diff --git a/ci/x86_64-macos-release.sh b/ci/x86_64-macos-release.sh index 1dd17943c3af0b3799b972efbe1217cdc054e169..a5bf7031f9c236c094b1f2867fa29305d70a722e 100755 --- a/ci/x86_64-macos-release.sh +++ b/ci/x86_64-macos-release.sh @@ -62,7 +62,7 @@ stage3/bin/zig build \ --prefix stage4 \ -Denable-llvm \ -Dno-lib \ - -Drelease \ + -Doptimize=ReleaseFast \ -Dstrip \ -Dtarget=$TARGET \ -Duse-zig-libcxx \