From 49edf89b5e3ab3596d540618de708cebeae2ae3e Mon Sep 17 00:00:00 2001 From: Baitinq Date: Fri, 21 Mar 2025 20:00:15 +0100 Subject: Misc: Support building on MacOS --- build.zig | 17 ++++++++++++++++- 1 file changed, 16 insertions(+), 1 deletion(-) (limited to 'build.zig') diff --git a/build.zig b/build.zig index 8b4ec95..a76d763 100644 --- a/build.zig +++ b/build.zig @@ -26,7 +26,22 @@ pub fn build(b: *std.Build) !void { .optimize = optimize, }); - exe_mod.linkSystemLibrary("LLVM-20-rc3", .{}); + switch (target.result.os.tag) { + .linux => exe_mod.linkSystemLibrary("LLVM-19", .{}), + .macos => { + exe_mod.addLibraryPath(.{ + .cwd_relative = "/opt/homebrew/opt/llvm/lib", + }); + exe_mod.addIncludePath(.{ .cwd_relative = "/opt/homebrew/opt/llvm/include" }); + exe_mod.linkSystemLibrary("LLVM", .{ + .use_pkg_config = .no, + }); + }, + else => exe_mod.linkSystemLibrary("LLVM", .{ + .use_pkg_config = .no, + }), + } + exe_mod.link_libc = true; // This creates another `std.Build.Step.Compile`, but this one builds an executable -- cgit 1.4.1