Skip to content

Commit

Permalink
build: Hopefully get everything building on macos13, but with segfaul…
Browse files Browse the repository at this point in the history
…t on run
  • Loading branch information
foxnne committed Jan 31, 2025
1 parent 882c27d commit 4ab766a
Show file tree
Hide file tree
Showing 6 changed files with 57 additions and 28 deletions.
28 changes: 25 additions & 3 deletions .github/workflows/build.yml
Original file line number Diff line number Diff line change
Expand Up @@ -61,8 +61,30 @@ jobs:
with:
name: x86_64-windows
path: zig-out/bin
arm64-macos:
runs-on: macos-14
# arm64-macos:
# runs-on: macos-14
# # We want to run on external PRs, but not on our own internal PRs as they'll be run by the push
# # to the branch.
# if: github.event_name == 'push' || github.event.pull_request.head.repo.full_name != github.repository
# steps:
# - name: Checkout
# uses: actions/checkout@v4
# - name: Setup Zig
# uses: mlugg/setup-zig@v1
# with:
# version: 2024.11.0-mach
# mirror: 'https://pkg.machengine.org/zig'
# - name: build
# run: zig build
# - name: Upload Artifacts
# uses: actions/upload-artifact@v4
# with:
# name: arm64-macos
# path: zig-out/bin
# arm64-macos:

# If it runs on 13 it should run on 14 as well
runs-on: macos-13
# We want to run on external PRs, but not on our own internal PRs as they'll be run by the push
# to the branch.
if: github.event_name == 'push' || github.event.pull_request.head.repo.full_name != github.repository
Expand All @@ -79,5 +101,5 @@ jobs:
- name: Upload Artifacts
uses: actions/upload-artifact@v4
with:
name: arm64-macos
name: x86_64-macos
path: zig-out/bin
1 change: 1 addition & 0 deletions .gitignore
Original file line number Diff line number Diff line change
Expand Up @@ -5,5 +5,6 @@ buildrunner.zig
.DS_Store
imgui.ini
recents.json
.temp/

.zig-cache/
5 changes: 4 additions & 1 deletion build.zig
Original file line number Diff line number Diff line change
Expand Up @@ -65,13 +65,16 @@ pub fn build(b: *std.Build) !void {

const nfd_lib = nfd.makeLib(b, target, optimize);
exe.root_module.addImport("nfd", nfd_lib);

if (target.result.isDarwin()) {
// // MacOS: this must be defined for macOS 13.3 and older.
// // Critically, this MUST NOT be included as a -D__kernel_ptr_semantics flag. If it is,
// // then this macro will not be defined even if `defineCMacro` was also called!
nfd_lib.addCMacro("__kernel_ptr_semantics", "");
//mach.addPaths(nfd_lib);

if (mach_dep.builder.lazyDependency("xcode_frameworks", .{})) |dep| {
nfd_lib.addSystemIncludePath(dep.path("include"));
}
}

exe.linkLibCpp();
Expand Down
15 changes: 9 additions & 6 deletions build.zig.zon
Original file line number Diff line number Diff line change
Expand Up @@ -9,22 +9,25 @@
.version = "0.0.2",
.dependencies = .{
.mach = .{
//.path = "../mach-dev/",
.url = "https://pkg.machengine.org/mach/c56d596ea90be5502db7a83940f5cca4cce1494f.tar.gz",
.hash = "1220301155ab5b19acce86e70c1e844249a6c617e6e36818cfeb5b5a993acee01ab4",
.path = "src/.temp/mach-dev/",
// .url = "https://pkg.machengine.org/mach/f9e1a9087f8ffa9a3f7cd3ba122b088bbf610e91.tar.gz",
// .hash = "122092af23a9e9346b15032fc6ff896630a3729209f36efa1e7881363c3342303eca",
},

.mach_objc = .{
.path = "src/.temp/mach-objc-dev/",
// .url = "https://pkg.machengine.org/mach/f9e1a9087f8ffa9a3f7cd3ba122b088bbf610e91.tar.gz",
// .hash = "122092af23a9e9346b15032fc6ff896630a3729209f36efa1e7881363c3342303eca",
},
.zig_imgui = .{
//.path = "../zig-imgui/",
.url = "https://github.com/foxnne/zig-imgui/archive/e9e49f12d76ce8ca32fdc81f93084ccd4f1f7c40.tar.gz",
.hash = "122040e7b6ca5890c8b64d961ff64c5b14f3867a83bd987a916f0316528195c6706f",
},
.zstbi = .{
//.path = "../zstbi/",
.url = "https://github.com/foxnne/zstbi/archive/d9a0947365b1ee8131fcf518feac8dfe896cfcfa.tar.gz",
.hash = "1220ce381d38f9ce6db428405b7884d139cab8173d3bf7d950582991d941c868423a",
},
.zmath = .{
//.path = "../zmath/",
.url = "https://github.com/foxnne/zmath/archive/9620a611a8c039711dc780bf296d8dc100d16d3a.tar.gz",
.hash = "12201b9f28adb918c2ffaf75b57a4b714a864038f8ba3e2d9f730187d0a852b952e1",
},
Expand Down
34 changes: 17 additions & 17 deletions src/deps/nfd-zig/build.zig
Original file line number Diff line number Diff line change
Expand Up @@ -58,24 +58,24 @@ pub fn getModule(b: *std.Build) *std.Build.Module {
return b.createModule(.{ .root_source_file = .{ .cwd_relative = sdkPath("/src/lib.zig") } });
}

pub fn build(_: *std.Build) void {
// const target = b.standardTargetOptions(.{});
// const optimize = b.standardOptimizeOption(.{});
// const lib = makeLib(b, target, optimize);
pub fn build(b: *std.Build) void {
const target = b.standardTargetOptions(.{});
const optimize = b.standardOptimizeOption(.{});
const lib = makeLib(b, target, optimize);

// var demo = b.addExecutable(.{
// .name = "demo",
// .root_source_file = .{ .cwd_relative = "/src/demo.zig" },
// .target = target,
// .optimize = optimize,
// });
// demo.addModule("nfd", getModule(b));
// demo.linkLibrary(lib);
// demo.install();
var demo = b.addExecutable(.{
.name = "demo",
.root_source_file = .{ .cwd_relative = "/src/demo.zig" },
.target = target,
.optimize = optimize,
});
demo.addModule("nfd", getModule(b));
demo.linkLibrary(lib);
demo.install();

// const run_demo_cmd = demo.run();
// run_demo_cmd.step.dependOn(b.getInstallStep());
const run_demo_cmd = demo.run();
run_demo_cmd.step.dependOn(b.getInstallStep());

// const run_demo_step = b.step("run", "Run the demo");
// run_demo_step.dependOn(&run_demo_cmd.step);
const run_demo_step = b.step("run", "Run the demo");
run_demo_step.dependOn(&run_demo_cmd.step);
}
2 changes: 1 addition & 1 deletion src/pixi.zig
Original file line number Diff line number Diff line change
Expand Up @@ -7,8 +7,8 @@ pub const version: std.SemanticVersion = .{ .major = 0, .minor = 2, .patch = 0 }
// Generated files, these contain helpers for autocomplete
// So you can get a named index into atlas.sprites
pub const animations = @import("animations.zig");
pub const atlas = paths.pixi_atlas;
pub const paths = @import("assets.zig");
pub const atlas = paths.pixi_atlas;
pub const shaders = @import("shaders.zig");

// Other helpers and namespaces
Expand Down

0 comments on commit 4ab766a

Please sign in to comment.