Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Mac Dev PR 1 #336

Merged
merged 7 commits into from
Apr 28, 2024
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
24 changes: 22 additions & 2 deletions build.zig
Original file line number Diff line number Diff line change
Expand Up @@ -21,10 +21,17 @@ pub fn build(b: *std.Build) !void {
exe.linkLibC();
exe.linkLibCpp();

const deps = b.dependency("deps", .{
// For the time being, MacOS cubyz_deps will not have released binaries.
const depsName = if (t.os.tag == .macos) "deps_local" else "deps";
const deps = b.lazyDependency(depsName, .{
.target = target,
.optimize = optimize,
});
}) orelse {
// Lazy dependencies with a `url` field will fail here the first time.
// build.zig will restart and try again.
std.log.info("Downloading dependency {s}.", .{depsName});
return;
};

exe.addLibraryPath(deps.path("lib"));
exe.addIncludePath(deps.path("include"));
Expand All @@ -42,6 +49,19 @@ pub fn build(b: *std.Build) !void {
exe.linkSystemLibrary("asound");
exe.linkSystemLibrary("x11");
exe.linkSystemLibrary("GL");
} else if(t.os.tag == .macos) {
exe.linkFramework("AudioUnit");
exe.linkFramework("AudioToolbox");
exe.linkFramework("CoreAudio");
exe.linkFramework("CoreServices");
exe.linkFramework("Foundation");
exe.linkFramework("IOKit");
exe.linkFramework("Cocoa");
exe.linkFramework("QuartzCore");
exe.linkSystemLibrary("GL");
exe.linkSystemLibrary("X11");
exe.addLibraryPath(.{.path="/usr/local/GL/lib"});
exe.addLibraryPath(.{.path="/opt/X11/lib"});
} else {
std.log.err("Unsupported target: {}\n", .{t.os.tag});
}
Expand Down
8 changes: 6 additions & 2 deletions build.zig.zon
Original file line number Diff line number Diff line change
Expand Up @@ -3,10 +3,14 @@
.version = "0.0.0",
.paths = .{""},
.dependencies = .{
.deps_local = .{
.path = "../Cubyz-libs/zig-out", // macos has no official deps release
.lazy = true,
},
.deps = .{
//.url = "file:///home/mint/Cubyz-libs/zig-out.tar.gz", // fetching the lib from the local folder
//.url = "file:../Cubyz-libs/zig-out.tar.gz", // fetching the lib from the local folder
.url = "https://github.com/PixelGuys/Cubyz-libs/releases/download/2/zig-out.tar.gz",
.hash = "12201446153e8822c020a10199880fae5fac7eb3f1e3f7c7a9b653e58914fa3e2223",
},
},
}
}
2 changes: 1 addition & 1 deletion src/main.zig
Original file line number Diff line number Diff line change
Expand Up @@ -451,4 +451,4 @@ pub fn main() void {

test "abc" {
_ = @import("json.zig");
}
}
Loading