Skip to content

Commit

Permalink
fix(lto): on windows and macos
Browse files Browse the repository at this point in the history
  • Loading branch information
Ultra-Code committed Sep 30, 2024
1 parent af8242b commit 05dab50
Showing 1 changed file with 7 additions and 4 deletions.
11 changes: 7 additions & 4 deletions build.zig
Original file line number Diff line number Diff line change
Expand Up @@ -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,
Expand All @@ -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 = .{
Expand Down

0 comments on commit 05dab50

Please sign in to comment.