about summary refs log tree commit diff
path: root/build.zig
diff options
context:
space:
mode:
authorBaitinq <[email protected]>2025-03-21 20:00:15 +0100
committerBaitinq <[email protected]>2025-03-21 20:00:15 +0100
commit49edf89b5e3ab3596d540618de708cebeae2ae3e (patch)
tree89fdb6181de8e23858de65302bf890160e231341 /build.zig
parentCodegen: Support functions as return values (diff)
downloadpry-lang-49edf89b5e3ab3596d540618de708cebeae2ae3e.tar.gz
pry-lang-49edf89b5e3ab3596d540618de708cebeae2ae3e.tar.bz2
pry-lang-49edf89b5e3ab3596d540618de708cebeae2ae3e.zip
Misc: Support building on MacOS
Diffstat (limited to 'build.zig')
-rw-r--r--build.zig17
1 files changed, 16 insertions, 1 deletions
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