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. // We always require the system SDK so that our system headers are available.
// This makes things like `os/log.h` available for cross-compiling. // This makes things like `os/log.h` available for cross-compiling.
if (step.rootModuleTarget().isDarwin()) { 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 // We always need the Zig packages

View File

@ -7,7 +7,7 @@ pub fn build(b: *std.Build) !void {
_ = optimize; _ = 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 // The active SDK we want to use
const sdk = "MacOSX14.sdk"; const sdk = "MacOSX14.sdk";
@ -19,19 +19,19 @@ pub fn addPaths(b: *std.Build, step: anytype) !void {
" \r\n", " \r\n",
); );
step.addSystemFrameworkPath(.{ m.addSystemFrameworkPath(.{
.cwd_relative = b.pathJoin(&.{ .cwd_relative = b.pathJoin(&.{
path, path,
"Platforms/MacOSX.platform/Developer/SDKs/" ++ sdk ++ "/System/Library/Frameworks", "Platforms/MacOSX.platform/Developer/SDKs/" ++ sdk ++ "/System/Library/Frameworks",
}), }),
}); });
step.addSystemIncludePath(.{ m.addSystemIncludePath(.{
.cwd_relative = b.pathJoin(&.{ .cwd_relative = b.pathJoin(&.{
path, path,
"Platforms/MacOSX.platform/Developer/SDKs/" ++ sdk ++ "/usr/include", "Platforms/MacOSX.platform/Developer/SDKs/" ++ sdk ++ "/usr/include",
}), }),
}); });
step.addLibraryPath(.{ m.addLibraryPath(.{
.cwd_relative = b.pathJoin(&.{ .cwd_relative = b.pathJoin(&.{
path, path,
"Platforms/MacOSX.platform/Developer/SDKs/" ++ sdk ++ "/usr/lib", "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.result.isDarwin()) {
if (!target.query.isNative()) { 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); try @import("apple_sdk").addPaths(b, module);
} }
lib.addCSourceFile(.{ lib.addCSourceFile(.{

View File

@ -61,7 +61,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.root_module);
try apple_sdk.addPaths(b, module); try apple_sdk.addPaths(b, module);
lib.linkFramework("ApplicationServices"); lib.linkFramework("ApplicationServices");
module.linkFramework("ApplicationServices", .{}); module.linkFramework("ApplicationServices", .{});

View File

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