mirror of
https://github.com/ghostty-org/ghostty.git
synced 2025-10-06 01:46:33 +00:00
build: use Xcode for the macOS SDK
This commit is contained in:
@@ -7,12 +7,34 @@ pub fn build(b: *std.Build) !void {
|
|||||||
_ = optimize;
|
_ = optimize;
|
||||||
}
|
}
|
||||||
|
|
||||||
pub fn addPaths(b: *std.Build, step: *std.Build.Step.Compile) !void {
|
pub fn addPaths(b: *std.Build, step: anytype) !void {
|
||||||
_ = b;
|
// The active SDK we want to use
|
||||||
@import("macos_sdk").addPaths(step);
|
const sdk = "MacOSX14.sdk";
|
||||||
}
|
|
||||||
|
|
||||||
pub fn addPathsModule(b: *std.Build, m: *std.Build.Module) !void {
|
// Get the path to our active Xcode installation. If this fails then
|
||||||
_ = b;
|
// the zig build will fail.
|
||||||
@import("macos_sdk").addPathsModule(m);
|
const path = std.mem.trim(
|
||||||
|
u8,
|
||||||
|
b.run(&.{ "xcode-select", "--print-path" }),
|
||||||
|
" \r\n",
|
||||||
|
);
|
||||||
|
|
||||||
|
step.addSystemFrameworkPath(.{
|
||||||
|
.cwd_relative = b.pathJoin(&.{
|
||||||
|
path,
|
||||||
|
"Platforms/MacOSX.platform/Developer/SDKs/" ++ sdk ++ "/System/Library/Frameworks",
|
||||||
|
}),
|
||||||
|
});
|
||||||
|
step.addSystemIncludePath(.{
|
||||||
|
.cwd_relative = b.pathJoin(&.{
|
||||||
|
path,
|
||||||
|
"Platforms/MacOSX.platform/Developer/SDKs/" ++ sdk ++ "/usr/include",
|
||||||
|
}),
|
||||||
|
});
|
||||||
|
step.addLibraryPath(.{
|
||||||
|
.cwd_relative = b.pathJoin(&.{
|
||||||
|
path,
|
||||||
|
"Platforms/MacOSX.platform/Developer/SDKs/" ++ sdk ++ "/usr/lib",
|
||||||
|
}),
|
||||||
|
});
|
||||||
}
|
}
|
||||||
|
@@ -1,10 +1,5 @@
|
|||||||
.{
|
.{
|
||||||
.name = "apple-sdk",
|
.name = "apple-sdk",
|
||||||
.version = "0.1.0",
|
.version = "0.1.0",
|
||||||
.dependencies = .{
|
.dependencies = .{},
|
||||||
.macos_sdk = .{
|
|
||||||
.url = "https://github.com/mitchellh/zig-build-macos-sdk/archive/ee70f27c08680307fa35ada92e6b2c36e0ff84c6.tar.gz",
|
|
||||||
.hash = "1220b415f529f1c04ed876c2b481e9f8119d353d4e3d4d7c8607ee302d2142e13eca",
|
|
||||||
},
|
|
||||||
},
|
|
||||||
}
|
}
|
||||||
|
@@ -61,7 +61,7 @@ pub fn build(b: *std.Build) !void {
|
|||||||
if (target.result.isDarwin()) {
|
if (target.result.isDarwin()) {
|
||||||
if (!target.query.isNative()) {
|
if (!target.query.isNative()) {
|
||||||
try @import("apple_sdk").addPaths(b, lib);
|
try @import("apple_sdk").addPaths(b, lib);
|
||||||
try @import("apple_sdk").addPathsModule(b, module);
|
try @import("apple_sdk").addPaths(b, module);
|
||||||
}
|
}
|
||||||
lib.addCSourceFile(.{
|
lib.addCSourceFile(.{
|
||||||
.file = imgui.path("backends/imgui_impl_metal.mm"),
|
.file = imgui.path("backends/imgui_impl_metal.mm"),
|
||||||
|
@@ -62,7 +62,7 @@ pub fn build(b: *std.Build) !void {
|
|||||||
if (coretext_enabled) {
|
if (coretext_enabled) {
|
||||||
try flags.appendSlice(&.{"-DHAVE_CORETEXT=1"});
|
try flags.appendSlice(&.{"-DHAVE_CORETEXT=1"});
|
||||||
try apple_sdk.addPaths(b, lib);
|
try apple_sdk.addPaths(b, lib);
|
||||||
try apple_sdk.addPathsModule(b, module);
|
try apple_sdk.addPaths(b, module);
|
||||||
lib.linkFramework("ApplicationServices");
|
lib.linkFramework("ApplicationServices");
|
||||||
module.linkFramework("ApplicationServices", .{});
|
module.linkFramework("ApplicationServices", .{});
|
||||||
}
|
}
|
||||||
|
@@ -40,7 +40,7 @@ pub fn build(b: *std.Build) !void {
|
|||||||
|
|
||||||
if (!target.query.isNative()) {
|
if (!target.query.isNative()) {
|
||||||
try apple_sdk.addPaths(b, lib);
|
try apple_sdk.addPaths(b, lib);
|
||||||
try apple_sdk.addPathsModule(b, module);
|
try apple_sdk.addPaths(b, module);
|
||||||
}
|
}
|
||||||
b.installArtifact(lib);
|
b.installArtifact(lib);
|
||||||
|
|
||||||
|
Reference in New Issue
Block a user