Skip to content

Commit 634ffd6

Browse files
committed
Fix optimize build option
Undo commit 59175cf
1 parent 58930cf commit 634ffd6

File tree

1 file changed

+7
-5
lines changed

1 file changed

+7
-5
lines changed

build.zig

Lines changed: 7 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -2,11 +2,13 @@ const std = @import("std");
22

33
pub fn build(b: *std.Build) void {
44
const target = b.standardTargetOptions(.{});
5-
const optimize = b.standardOptimizeOption(.{
6-
.preferred_optimize_mode = .ReleaseFast,
7-
});
85

96
const options = .{
7+
.optimize = b.option(
8+
std.builtin.OptimizeMode,
9+
"optimize",
10+
"The optimization level to use for the build",
11+
) orelse .ReleaseFast,
1012
.enable_cross_platform_determinism = b.option(
1113
bool,
1214
"enable_cross_platform_determinism",
@@ -34,7 +36,7 @@ pub fn build(b: *std.Build) void {
3436
.name = "zmath-tests",
3537
.root_source_file = b.path("src/root.zig"),
3638
.target = target,
37-
.optimize = optimize,
39+
.optimize = options.optimize,
3840
});
3941
b.installArtifact(tests);
4042

@@ -48,7 +50,7 @@ pub fn build(b: *std.Build) void {
4850
.name = "zmath-benchmarks",
4951
.root_source_file = b.path("src/benchmark.zig"),
5052
.target = target,
51-
.optimize = optimize,
53+
.optimize = options.optimize,
5254
});
5355
b.installArtifact(benchmarks);
5456

0 commit comments

Comments
 (0)