From e17c872ddaf527707fa91e16276ffc89d7a3be90 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Motiejus=20Jak=C5=A1tys?= Date: Fri, 7 Apr 2023 22:17:23 +0300 Subject: [PATCH] build.zig: default to Debug for wasm32 too Following @Luukdegram's comment[1]: > The default should remain Debug when unspecified. In ReleaseSmall the > user would lose all DWARF support when testing their WebAssembly code. > Building a release version should be opt-in, not the default. [1]: https://github.com/ziglang/zig/pull/15192#discussion_r1160824726 --- build.zig | 4 +--- 1 file changed, 1 insertion(+), 3 deletions(-) diff --git a/build.zig b/build.zig index 537b5a6284..6cb3e35488 100644 --- a/build.zig +++ b/build.zig @@ -22,9 +22,7 @@ pub fn build(b: *std.Build) !void { break :t b.standardTargetOptions(.{ .default_target = default_target }); }; - // TODO remove type annotation with ziglang/zig#13749 - const optimize: std.builtin.Mode = b.option(std.builtin.Mode, "optimize", "Prioritize performance, safety, or binary size (-O flag)") orelse - if (target.getCpuArch() == .wasm32) .ReleaseSmall 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;