Skip to content

Commit

Permalink
update to Zig 2024.1.0-mach
Browse files Browse the repository at this point in the history
Signed-off-by: Stephen Gutekanst <[email protected]>
  • Loading branch information
emidoots committed Jan 13, 2024
1 parent 07de046 commit e71979e
Show file tree
Hide file tree
Showing 2 changed files with 9 additions and 25 deletions.
30 changes: 7 additions & 23 deletions build.zig
Original file line number Diff line number Diff line change
Expand Up @@ -5,38 +5,22 @@ pub fn build(b: *std.Build) void {
const target = b.standardTargetOptions(.{});

_ = b.addModule("mach-objc", .{
.source_file = .{ .path = "src/main.zig" },
.root_source_file = .{ .path = "src/main.zig" },
});

const test_step = b.step("test", "Run library tests");
test_step.dependOn(&testStep(b, optimize, target).step);
}

pub fn testStep(b: *std.Build, optimize: std.builtin.OptimizeMode, target: std.zig.CrossTarget) *std.build.RunStep {
const main_tests = b.addTest(.{
.name = "mach-objc-tests",
.root_source_file = .{ .path = "src/main.zig" },
.target = target,
.optimize = optimize,
});
link(main_tests);

// Transitive dependencies, explicit linkage of these works around
// ziglang/zig#17130
main_tests.linkFramework("CoreFoundation");

// Direct dependencies
addPaths(main_tests);
main_tests.linkFramework("Foundation");
b.installArtifact(main_tests);
return b.addRunArtifact(main_tests);
}

pub fn link(step: *std.build.CompileStep) void {
if (step.target.toTarget().isDarwin()) {
@import("xcode_frameworks").addPaths(step);
const test_step = b.step("test", "Run library tests");
test_step.dependOn(&b.addRunArtifact(main_tests).step);
}

// Transitive dependencies, explicit linkage of these works around
// ziglang/zig#17130
step.linkSystemLibrary("objc");
}
pub fn addPaths(step: *std.Build.Step.Compile) void {
@import("xcode_frameworks").addPaths(step);
}
4 changes: 2 additions & 2 deletions build.zig.zon
Original file line number Diff line number Diff line change
Expand Up @@ -14,8 +14,8 @@
},
.dependencies = .{
.xcode_frameworks = .{
.url = "https://pkg.machengine.org/xcode-frameworks/e77a5c6809a0d3f62ec549ee56e9d2dc6807cd5b.tar.gz",
.hash = "12202044ed9fd69af156b0afde619ffd1d111554c557f57ab670ca9960e76d60d0b8",
.url = "https://pkg.machengine.org/xcode-frameworks/ff1f5c15120b65504d8feccca8015a7e96ed580c.tar.gz",
.hash = "12207bc2707695102c636c26b60343e634127ee4d6e23210b1ae1664b2b2fea6076f",
},
},
}

0 comments on commit e71979e

Please sign in to comment.