From 1954cdc1066f2d59961e4cdd24a9d80fd6eb86c3 Mon Sep 17 00:00:00 2001 From: Jakub Konka Date: Wed, 24 Nov 2021 23:41:09 +0100 Subject: Autofetch macOS SDK if native target on macOS only This means that I am purposefully regressing linking iOS and related which will require manual specification of the sysroot path, etc. --- src/Compilation.zig | 8 +++++--- 1 file changed, 5 insertions(+), 3 deletions(-) (limited to 'src/Compilation.zig') diff --git a/src/Compilation.zig b/src/Compilation.zig index 7520e7cb4b..20d67e7c77 100644 --- a/src/Compilation.zig +++ b/src/Compilation.zig @@ -962,15 +962,17 @@ pub fn create(gpa: *Allocator, options: InitOptions) !*Compilation { break :blk false; }; - const darwin_can_use_system_sdk = blk: { + const darwin_use_system_sdk = blk: { if (comptime !builtin.target.isDarwin()) break :blk false; - break :blk builtin.os.tag == .macos and options.target.isDarwin(); + if (!options.is_native_os) break :blk false; + if (builtin.os.tag != .macos or !options.target.isDarwin()) break :blk false; + break :blk options.frameworks.len > 0 or options.framework_dirs.len > 0; }; const sysroot = blk: { if (options.sysroot) |sysroot| { break :blk sysroot; - } else if (darwin_can_use_system_sdk) { + } else if (darwin_use_system_sdk) { break :blk try std.zig.system.darwin.getSDKPath(arena, options.target); } else { break :blk null; -- cgit v1.2.3