aboutsummaryrefslogtreecommitdiff
path: root/src/Compilation.zig
diff options
context:
space:
mode:
authorJakub Konka <kubkon@jakubkonka.com>2021-08-06 11:36:40 +0200
committerJakub Konka <kubkon@jakubkonka.com>2021-08-10 13:41:10 +0200
commite9bee08f8869bc97312f37a76cb00b98b8c6ee3d (patch)
treeb6d4b2e6153740ccb7f0503d13c7613a5a45f30b /src/Compilation.zig
parent2371a63bd46cb1af7e3b9857136ea7677f6abdcc (diff)
downloadzig-e9bee08f8869bc97312f37a76cb00b98b8c6ee3d.tar.gz
zig-e9bee08f8869bc97312f37a76cb00b98b8c6ee3d.zip
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.
Diffstat (limited to 'src/Compilation.zig')
-rw-r--r--src/Compilation.zig3
1 files changed, 1 insertions, 2 deletions
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;
}