pkg/apple-sdk: always require a module

This commit is contained in:
Mitchell Hashimoto
2024-01-09 22:11:03 -08:00
parent fde52e9eca
commit 829776bebd
5 changed files with 8 additions and 8 deletions

View File

@ -792,7 +792,7 @@ fn addDeps(
// We always require the system SDK so that our system headers are available.
// This makes things like `os/log.h` available for cross-compiling.
if (step.rootModuleTarget().isDarwin()) {
try @import("apple_sdk").addPaths(b, step);
try @import("apple_sdk").addPaths(b, &step.root_module);
}
// We always need the Zig packages

View File

@ -7,7 +7,7 @@ pub fn build(b: *std.Build) !void {
_ = optimize;
}
pub fn addPaths(b: *std.Build, step: anytype) !void {
pub fn addPaths(b: *std.Build, m: *std.Build.Module) !void {
// The active SDK we want to use
const sdk = "MacOSX14.sdk";
@ -19,19 +19,19 @@ pub fn addPaths(b: *std.Build, step: anytype) !void {
" \r\n",
);
step.addSystemFrameworkPath(.{
m.addSystemFrameworkPath(.{
.cwd_relative = b.pathJoin(&.{
path,
"Platforms/MacOSX.platform/Developer/SDKs/" ++ sdk ++ "/System/Library/Frameworks",
}),
});
step.addSystemIncludePath(.{
m.addSystemIncludePath(.{
.cwd_relative = b.pathJoin(&.{
path,
"Platforms/MacOSX.platform/Developer/SDKs/" ++ sdk ++ "/usr/include",
}),
});
step.addLibraryPath(.{
m.addLibraryPath(.{
.cwd_relative = b.pathJoin(&.{
path,
"Platforms/MacOSX.platform/Developer/SDKs/" ++ sdk ++ "/usr/lib",

View File

@ -60,7 +60,7 @@ pub fn build(b: *std.Build) !void {
if (target.result.isDarwin()) {
if (!target.query.isNative()) {
try @import("apple_sdk").addPaths(b, lib);
try @import("apple_sdk").addPaths(b, &lib.root_module);
try @import("apple_sdk").addPaths(b, module);
}
lib.addCSourceFile(.{

View File

@ -61,7 +61,7 @@ pub fn build(b: *std.Build) !void {
});
if (coretext_enabled) {
try flags.appendSlice(&.{"-DHAVE_CORETEXT=1"});
try apple_sdk.addPaths(b, lib);
try apple_sdk.addPaths(b, &lib.root_module);
try apple_sdk.addPaths(b, module);
lib.linkFramework("ApplicationServices");
module.linkFramework("ApplicationServices", .{});

View File

@ -38,7 +38,7 @@ pub fn build(b: *std.Build) !void {
module.linkFramework("CoreVideo", .{});
if (!target.query.isNative()) {
try apple_sdk.addPaths(b, lib);
try apple_sdk.addPaths(b, &lib.root_module);
try apple_sdk.addPaths(b, module);
}
}