From 63ca2c0f0cb20507b0b6238d6d5250e716636f39 Mon Sep 17 00:00:00 2001 From: Mitchell Hashimoto Date: Wed, 14 Feb 2024 08:56:11 -0800 Subject: [PATCH] pkg/apple-sdk: more descriptive error when SDK not found --- pkg/apple-sdk/build.zig | 11 ++++++++++- 1 file changed, 10 insertions(+), 1 deletion(-) diff --git a/pkg/apple-sdk/build.zig b/pkg/apple-sdk/build.zig index 580c0de3c..1be733dd6 100644 --- a/pkg/apple-sdk/build.zig +++ b/pkg/apple-sdk/build.zig @@ -40,7 +40,16 @@ pub fn addPaths(b: *std.Build, m: *std.Build.Module) !void { } // The active SDK we want to use - const path = gop.value_ptr.* orelse return error.AppleSDKNotFound; + const path = gop.value_ptr.* orelse return switch (target.os.tag) { + // Return a more descriptive error. Before we just returned the + // generic error but this was confusing a lot of community members. + // It costs us nothing in the build script to return something better. + .macos => error.XcodeMacOSSDKNotFound, + .ios => error.XcodeiOSSDKNotFound, + .tvos => error.XcodeTVOSSDKNotFound, + .watchos => error.XcodeWatchOSSDKNotFound, + else => error.XcodeAppleSDKNotFound, + }; m.addSystemFrameworkPath(.{ .cwd_relative = b.pathJoin(&.{ path, "/System/Library/Frameworks" }) }); m.addSystemIncludePath(.{ .cwd_relative = b.pathJoin(&.{ path, "/usr/include" }) }); m.addLibraryPath(.{ .cwd_relative = b.pathJoin(&.{ path, "/usr/lib" }) });