Skip to content

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

New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Merged
merged 2 commits into from
Apr 19, 2023
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
4 changes: 2 additions & 2 deletions CMakeLists.txt
Original file line number Diff line number Diff line change
Expand Up @@ -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")
Expand Down
7 changes: 2 additions & 5 deletions build.zig
Original file line number Diff line number Diff line change
Expand Up @@ -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 = .{};
Expand All @@ -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;
Expand Down
2 changes: 1 addition & 1 deletion ci/aarch64-macos.sh
Original file line number Diff line number Diff line change
Expand Up @@ -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 \
Expand Down
2 changes: 1 addition & 1 deletion ci/x86_64-linux-release.sh
Original file line number Diff line number Diff line change
Expand Up @@ -77,7 +77,7 @@ stage3-release/bin/zig build \
--prefix stage4-release \
-Denable-llvm \
-Dno-lib \
-Drelease \
-Doptimize=ReleaseFast \
-Dstrip \
-Dtarget=$TARGET \
-Duse-zig-libcxx \
Expand Down
2 changes: 1 addition & 1 deletion ci/x86_64-macos-release.sh
Original file line number Diff line number Diff line change
Expand Up @@ -61,7 +61,7 @@ stage3/bin/zig build \
--prefix stage4 \
-Denable-llvm \
-Dno-lib \
-Drelease \
-Doptimize=ReleaseFast \
-Dstrip \
-Dtarget=$TARGET \
-Duse-zig-libcxx \
Expand Down