Use llvm on MacOS

Experimental feature currently only tested with Linux, builds failing
for Mac.
This commit is contained in:
Bob Farrell 2025-03-02 13:49:54 +00:00
parent 06674db51f
commit 9c4b6198cd
2 changed files with 7 additions and 4 deletions

View File

@ -5,6 +5,9 @@ pub const GenerateMimeTypes = @import("src/GenerateMimeTypes.zig");
const zmpl_build = @import("zmpl"); const zmpl_build = @import("zmpl");
const Environment = enum { development, testing, production }; const Environment = enum { development, testing, production };
const builtin = @import("builtin");
const use_llvm_default = builtin.os.tag == .macos;
pub fn build(b: *std.Build) !void { pub fn build(b: *std.Build) !void {
const target = b.standardTargetOptions(.{}); const target = b.standardTargetOptions(.{});
@ -36,7 +39,7 @@ pub fn build(b: *std.Build) !void {
.{ .{
.target = target, .target = target,
.optimize = optimize, .optimize = optimize,
.use_llvm = b.option(bool, "use_llvm", "Use LLVM") orelse false, .use_llvm = b.option(bool, "use_llvm", "Use LLVM") orelse use_llvm_default,
.zmpl_templates_paths = templates_paths, .zmpl_templates_paths = templates_paths,
.zmpl_auto_build = false, .zmpl_auto_build = false,
.zmpl_markdown_fragments = try generateMarkdownFragments(b), .zmpl_markdown_fragments = try generateMarkdownFragments(b),
@ -135,7 +138,7 @@ pub fn jetzigInit(b: *std.Build, exe: *std.Build.Step.Compile, options: JetzigIn
const target = exe.root_module.resolved_target orelse @panic("Unable to detect compile target."); const target = exe.root_module.resolved_target orelse @panic("Unable to detect compile target.");
const optimize = exe.root_module.optimize orelse .Debug; const optimize = exe.root_module.optimize orelse .Debug;
exe.use_llvm = exe.use_llvm orelse (optimize != .Debug); exe.use_llvm = exe.use_llvm orelse use_llvm_default;
if (optimize != .Debug) exe.linkLibC(); if (optimize != .Debug) exe.linkLibC();

View File

@ -6,8 +6,8 @@
.dependencies = .{ .dependencies = .{
.args = .{ .args = .{
.url = "https://github.com/ikskuh/zig-args/archive/968258dc1b1230493d8f1677097c832a3d7e0bd8.tar.gz", .url = "https://github.com/bobf/zig-args/archive/88cbade9a517a4014824f8f53f3c48c8a0b2ffe1.tar.gz",
.hash = "1220bdedf1a993d852d8aebcd63922a8fb163fac37b9c6ff72d187b2847a4a3a4248", .hash = "zig_args-0.0.0-jqtN6P_NAAC97fGpk9hS2K681jkiqPsWP6w3ucb_ctGH",
}, },
.jetquery = .{ .jetquery = .{
.url = "https://github.com/jetzig-framework/jetquery/archive/795136c43f6d5bd216c136748bafd22892277725.tar.gz", .url = "https://github.com/jetzig-framework/jetquery/archive/795136c43f6d5bd216c136748bafd22892277725.tar.gz",