initial macOS backend (#1249)
Signed-off-by: Stephen Gutekanst <stephen@hexops.com> Co-authored-by: Michael Bradshaw <github@mjb.io>
This commit is contained in:
parent
af7ac96a0e
commit
66e56f037b
6 changed files with 308 additions and 25 deletions
35
build.zig
35
build.zig
|
|
@ -136,6 +136,12 @@ pub fn build(b: *std.Build) !void {
|
|||
module.linkLibrary(dep.artifact("wayland-headers"));
|
||||
lib.linkLibrary(dep.artifact("wayland-headers"));
|
||||
}
|
||||
if (target.result.isDarwin()) {
|
||||
if (b.lazyDependency("mach_objc", .{
|
||||
.target = target,
|
||||
.optimize = optimize,
|
||||
})) |dep| module.addImport("objc", dep.module("mach-objc"));
|
||||
}
|
||||
}
|
||||
}
|
||||
if (want_sysaudio) {
|
||||
|
|
@ -167,10 +173,12 @@ pub fn build(b: *std.Build) !void {
|
|||
example_run_step.dependOn(&example_run_cmd.step);
|
||||
}
|
||||
}
|
||||
if (b.lazyDependency("mach_objc", .{
|
||||
.target = target,
|
||||
.optimize = optimize,
|
||||
})) |dep| module.addImport("objc", dep.module("mach-objc"));
|
||||
if (target.result.isDarwin()) {
|
||||
if (b.lazyDependency("mach_objc", .{
|
||||
.target = target,
|
||||
.optimize = optimize,
|
||||
})) |dep| module.addImport("objc", dep.module("mach-objc"));
|
||||
}
|
||||
}
|
||||
|
||||
if (target.result.isDarwin()) {
|
||||
|
|
@ -222,10 +230,13 @@ pub fn build(b: *std.Build) !void {
|
|||
}
|
||||
if (want_sysgpu) {
|
||||
if (b.lazyDependency("vulkan_zig_generated", .{})) |dep| module.addImport("vulkan", dep.module("vulkan-zig-generated"));
|
||||
if (b.lazyDependency("mach_objc", .{
|
||||
.target = target,
|
||||
.optimize = optimize,
|
||||
})) |dep| module.addImport("objc", dep.module("mach-objc"));
|
||||
if (target.result.isDarwin()) {
|
||||
if (b.lazyDependency("mach_objc", .{
|
||||
.target = target,
|
||||
.optimize = optimize,
|
||||
})) |dep| module.addImport("objc", dep.module("mach-objc"));
|
||||
}
|
||||
|
||||
linkSysgpu(b, module);
|
||||
|
||||
if (want_libs) {
|
||||
|
|
@ -277,10 +288,12 @@ pub const Platform = enum {
|
|||
wayland,
|
||||
web,
|
||||
win32,
|
||||
darwin,
|
||||
null,
|
||||
|
||||
pub fn fromTarget(target: std.Target) Platform {
|
||||
if (target.cpu.arch == .wasm32) return .web;
|
||||
if (target.os.tag.isDarwin()) return .darwin;
|
||||
if (target.os.tag == .windows) return .win32;
|
||||
return .x11;
|
||||
}
|
||||
|
|
@ -292,7 +305,11 @@ fn linkSysgpu(b: *std.Build, module: *std.Build.Module) void {
|
|||
if (target.cpu.arch != .wasm32) module.link_libc = true;
|
||||
if (target.isDarwin()) {
|
||||
module.linkSystemLibrary("objc", .{});
|
||||
module.linkFramework("AppKit", .{});
|
||||
if (target.os.tag == .macos) {
|
||||
module.linkFramework("AppKit", .{});
|
||||
} else {
|
||||
module.linkFramework("UIKit", .{});
|
||||
}
|
||||
module.linkFramework("CoreGraphics", .{});
|
||||
module.linkFramework("Foundation", .{});
|
||||
module.linkFramework("Metal", .{});
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue