| ... | @@ -124,6 +124,7 @@ zig_lib_directory: Directory, | ... | @@ -124,6 +124,7 @@ zig_lib_directory: Directory, |
| 124 | local_cache_directory: Directory, | 124 | local_cache_directory: Directory, |
| 125 | global_cache_directory: Directory, | 125 | global_cache_directory: Directory, |
| 126 | libc_include_dir_list: []const []const u8, | 126 | libc_include_dir_list: []const []const u8, |
| | 127 | libc_framework_dir_list: []const []const u8, |
| 127 | thread_pool: *ThreadPool, | 128 | thread_pool: *ThreadPool, |
| 128 | | 129 | |
| 129 | /// Populated when we build the libc++ static library. A Job to build this is placed in the queue | 130 | /// Populated when we build the libc++ static library. A Job to build this is placed in the queue |
| ... | @@ -1593,6 +1594,7 @@ pub fn create(gpa: Allocator, options: InitOptions) !*Compilation { | ... | @@ -1593,6 +1594,7 @@ pub fn create(gpa: Allocator, options: InitOptions) !*Compilation { |
| 1593 | .cache_parent = cache, | 1594 | .cache_parent = cache, |
| 1594 | .self_exe_path = options.self_exe_path, | 1595 | .self_exe_path = options.self_exe_path, |
| 1595 | .libc_include_dir_list = libc_dirs.libc_include_dir_list, | 1596 | .libc_include_dir_list = libc_dirs.libc_include_dir_list, |
| | 1597 | .libc_framework_dir_list = libc_dirs.libc_framework_dir_list, |
| 1596 | .sanitize_c = sanitize_c, | 1598 | .sanitize_c = sanitize_c, |
| 1597 | .thread_pool = options.thread_pool, | 1599 | .thread_pool = options.thread_pool, |
| 1598 | .clang_passthrough_mode = options.clang_passthrough_mode, | 1600 | .clang_passthrough_mode = options.clang_passthrough_mode, |
| ... | @@ -4335,8 +4337,12 @@ pub fn addCCArgs( | ... | @@ -4335,8 +4337,12 @@ pub fn addCCArgs( |
| 4335 | try argv.append("-ObjC++"); | 4337 | try argv.append("-ObjC++"); |
| 4336 | } | 4338 | } |
| 4337 | | 4339 | |
| | 4340 | for (comp.libc_framework_dir_list) |framework_dir| { |
| | 4341 | try argv.appendSlice(&.{ "-iframework", framework_dir }); |
| | 4342 | } |
| | 4343 | |
| 4338 | for (comp.bin_file.options.framework_dirs) |framework_dir| { | 4344 | for (comp.bin_file.options.framework_dirs) |framework_dir| { |
| 4339 | try argv.appendSlice(&.{ "-isystem", framework_dir }); | 4345 | try argv.appendSlice(&.{ "-F", framework_dir }); |
| 4340 | } | 4346 | } |
| 4341 | | 4347 | |
| 4342 | // According to Rich Felker libc headers are supposed to go before C language headers. | 4348 | // According to Rich Felker libc headers are supposed to go before C language headers. |
| ... | @@ -4821,6 +4827,7 @@ test "classifyFileExt" { | ... | @@ -4821,6 +4827,7 @@ test "classifyFileExt" { |
| 4821 | const LibCDirs = struct { | 4827 | const LibCDirs = struct { |
| 4822 | libc_include_dir_list: []const []const u8, | 4828 | libc_include_dir_list: []const []const u8, |
| 4823 | libc_installation: ?*const LibCInstallation, | 4829 | libc_installation: ?*const LibCInstallation, |
| | 4830 | libc_framework_dir_list: []const []const u8, |
| 4824 | }; | 4831 | }; |
| 4825 | | 4832 | |
| 4826 | fn getZigShippedLibCIncludeDirsDarwin(arena: Allocator, zig_lib_dir: []const u8, target: Target) !LibCDirs { | 4833 | fn getZigShippedLibCIncludeDirsDarwin(arena: Allocator, zig_lib_dir: []const u8, target: Target) !LibCDirs { |
| ... | @@ -4851,6 +4858,7 @@ fn getZigShippedLibCIncludeDirsDarwin(arena: Allocator, zig_lib_dir: []const u8, | ... | @@ -4851,6 +4858,7 @@ fn getZigShippedLibCIncludeDirsDarwin(arena: Allocator, zig_lib_dir: []const u8, |
| 4851 | return LibCDirs{ | 4858 | return LibCDirs{ |
| 4852 | .libc_include_dir_list = list, | 4859 | .libc_include_dir_list = list, |
| 4853 | .libc_installation = null, | 4860 | .libc_installation = null, |
| | 4861 | .libc_framework_dir_list = &.{}, |
| 4854 | }; | 4862 | }; |
| 4855 | } | 4863 | } |
| 4856 | | 4864 | |
| ... | @@ -4866,6 +4874,7 @@ fn detectLibCIncludeDirs( | ... | @@ -4866,6 +4874,7 @@ fn detectLibCIncludeDirs( |
| 4866 | return LibCDirs{ | 4874 | return LibCDirs{ |
| 4867 | .libc_include_dir_list = &[0][]u8{}, | 4875 | .libc_include_dir_list = &[0][]u8{}, |
| 4868 | .libc_installation = null, | 4876 | .libc_installation = null, |
| | 4877 | .libc_framework_dir_list = &.{}, |
| 4869 | }; | 4878 | }; |
| 4870 | } | 4879 | } |
| 4871 | | 4880 | |
| ... | @@ -4921,11 +4930,13 @@ fn detectLibCIncludeDirs( | ... | @@ -4921,11 +4930,13 @@ fn detectLibCIncludeDirs( |
| 4921 | return LibCDirs{ | 4930 | return LibCDirs{ |
| 4922 | .libc_include_dir_list = &[0][]u8{}, | 4931 | .libc_include_dir_list = &[0][]u8{}, |
| 4923 | .libc_installation = null, | 4932 | .libc_installation = null, |
| | 4933 | .libc_framework_dir_list = &.{}, |
| 4924 | }; | 4934 | }; |
| 4925 | } | 4935 | } |
| 4926 | | 4936 | |
| 4927 | fn detectLibCFromLibCInstallation(arena: Allocator, target: Target, lci: *const LibCInstallation) !LibCDirs { | 4937 | fn detectLibCFromLibCInstallation(arena: Allocator, target: Target, lci: *const LibCInstallation) !LibCDirs { |
| 4928 | var list = try std.ArrayList([]const u8).initCapacity(arena, 5); | 4938 | var list = try std.ArrayList([]const u8).initCapacity(arena, 5); |
| | 4939 | var framework_list = std.ArrayList([]const u8).init(arena); |
| 4929 | | 4940 | |
| 4930 | list.appendAssumeCapacity(lci.include_dir.?); | 4941 | list.appendAssumeCapacity(lci.include_dir.?); |
| 4931 | | 4942 | |
| ... | @@ -4953,9 +4964,16 @@ fn detectLibCFromLibCInstallation(arena: Allocator, target: Target, lci: *const | ... | @@ -4953,9 +4964,16 @@ fn detectLibCFromLibCInstallation(arena: Allocator, target: Target, lci: *const |
| 4953 | list.appendAssumeCapacity(config_dir); | 4964 | list.appendAssumeCapacity(config_dir); |
| 4954 | } | 4965 | } |
| 4955 | | 4966 | |
| | 4967 | if (target.isDarwin()) d: { |
| | 4968 | const down1 = std.fs.path.dirname(lci.sys_include_dir.?) orelse break :d; |
| | 4969 | const down2 = std.fs.path.dirname(down1) orelse break :d; |
| | 4970 | try framework_list.append(try std.fs.path.join(arena, &.{ down2, "System", "Library", "Frameworks" })); |
| | 4971 | } |
| | 4972 | |
| 4956 | return LibCDirs{ | 4973 | return LibCDirs{ |
| 4957 | .libc_include_dir_list = list.items, | 4974 | .libc_include_dir_list = list.items, |
| 4958 | .libc_installation = lci, | 4975 | .libc_installation = lci, |
| | 4976 | .libc_framework_dir_list = framework_list.items, |
| 4959 | }; | 4977 | }; |
| 4960 | } | 4978 | } |
| 4961 | | 4979 | |
| ... | @@ -5015,6 +5033,7 @@ fn detectLibCFromBuilding( | ... | @@ -5015,6 +5033,7 @@ fn detectLibCFromBuilding( |
| 5015 | return LibCDirs{ | 5033 | return LibCDirs{ |
| 5016 | .libc_include_dir_list = list, | 5034 | .libc_include_dir_list = list, |
| 5017 | .libc_installation = null, | 5035 | .libc_installation = null, |
| | 5036 | .libc_framework_dir_list = &.{}, |
| 5018 | }; | 5037 | }; |
| 5019 | } | 5038 | } |
| 5020 | | 5039 | |