From e9bee08f8869bc97312f37a76cb00b98b8c6ee3d Mon Sep 17 00:00:00 2001 From: Jakub Konka Date: Fri, 6 Aug 2021 11:36:40 +0200 Subject: Try audodetecting sysroot when building Darwin on Darwin This is now no longer limited to targeting macOS natively but also tries to detect the sysroot when targeting different Apple platforms from macOS; for instance targeting iPhone Simulator from macOS. In this case, Zig will try detecting the SDK path by invoking `xcrun --sdk iphonesimulator --show-sdk-path`, and if the command fails because the SDK doesn't exist (case when having CLT installed only) or not having either Xcode or CLT installed, we simply return null signaling that the user has to provide the sysroot themselves. --- src/Compilation.zig | 3 +-- 1 file changed, 1 insertion(+), 2 deletions(-) (limited to 'src/Compilation.zig') diff --git a/src/Compilation.zig b/src/Compilation.zig index 24e2d9e67f..7987ed95df 100644 --- a/src/Compilation.zig +++ b/src/Compilation.zig @@ -944,8 +944,7 @@ pub fn create(gpa: *Allocator, options: InitOptions) !*Compilation { if (options.sysroot) |sysroot| { break :blk sysroot; } else if (darwin_can_use_system_sdk) { - const at_least_big_sur = options.target.os.getVersionRange().semver.min.major >= 11; - break :blk if (at_least_big_sur) try std.zig.system.getSDKPath(arena) else null; + break :blk try std.zig.system.darwin.getSDKPath(arena, options.target); } else { break :blk null; } -- cgit v1.2.3