From 05dab502323d9b699204d82494457dc7918a65ec Mon Sep 17 00:00:00 2001 From: Ultra-Code Date: Mon, 30 Sep 2024 09:49:36 +0000 Subject: [PATCH] fix(lto): on windows and macos --- build.zig | 11 +++++++---- 1 file changed, 7 insertions(+), 4 deletions(-) diff --git a/build.zig b/build.zig index 19f0db0..f69d87b 100644 --- a/build.zig +++ b/build.zig @@ -17,9 +17,12 @@ pub fn build(b: *std.Build) void { // writing WritingLibFiles isn't implemented on windows // and zld the only linker suppored on macos - const use_lld = if (builtin.os.tag == .macos or - builtin.os.tag == .windows or optimize == .Debug) false else true; - + const is_macos = builtin.os.tag == .macos; + const is_windows = builtin.os.tag == .windows; + const use_lld = if (is_macos) false else if (is_windows) true else switch (optimize) { + .Debug => false, + else => true, + }; const liblmdb = b.addStaticLibrary(.{ .name = "lmdb", .target = target, @@ -32,7 +35,7 @@ pub fn build(b: *std.Build) void { }, .use_lld = use_lld, }); - liblmdb.want_lto = lto; + liblmdb.want_lto = if (is_macos) false else lto; liblmdb.root_module.sanitize_c = false; const liblmdb_src = .{