diff options
| author | Jakub Konka <kubkon@jakubkonka.com> | 2023-08-16 14:56:52 +0200 |
|---|---|---|
| committer | Jakub Konka <kubkon@jakubkonka.com> | 2023-08-18 08:00:40 +0200 |
| commit | 23b4a2b8e1135a8a1d487d68961c2f24df84a712 (patch) | |
| tree | 75adda8e8f56ed777bafb7b046951a0dff589ae7 /lib/std/Build/Step/Compile.zig | |
| parent | 510802d25e4211c2f6403e49ece19450933e0f59 (diff) | |
| download | zig-23b4a2b8e1135a8a1d487d68961c2f24df84a712.tar.gz zig-23b4a2b8e1135a8a1d487d68961c2f24df84a712.zip | |
build: disambiguate system framework path (-iframework) from framework path (-F)
Diffstat (limited to 'lib/std/Build/Step/Compile.zig')
| -rw-r--r-- | lib/std/Build/Step/Compile.zig | 32 |
1 files changed, 26 insertions, 6 deletions
diff --git a/lib/std/Build/Step/Compile.zig b/lib/std/Build/Step/Compile.zig index 0abfc61686..414a74f27e 100644 --- a/lib/std/Build/Step/Compile.zig +++ b/lib/std/Build/Step/Compile.zig @@ -42,7 +42,7 @@ unwind_tables: ?bool, compress_debug_sections: enum { none, zlib } = .none, lib_paths: ArrayList(LazyPath), rpaths: ArrayList(LazyPath), -framework_dirs: ArrayList(LazyPath), +framework_dirs: ArrayList(FrameworkDir), frameworks: StringHashMap(FrameworkLinkInfo), verbose_link: bool, verbose_cc: bool, @@ -265,6 +265,11 @@ pub const IncludeDir = union(enum) { config_header_step: *Step.ConfigHeader, }; +pub const FrameworkDir = union(enum) { + path: LazyPath, + path_system: LazyPath, +}; + pub const Options = struct { name: []const u8, root_source_file: ?LazyPath = null, @@ -442,7 +447,7 @@ pub fn create(owner: *std.Build, options: Options) *Compile { .c_macros = ArrayList([]const u8).init(owner.allocator), .lib_paths = ArrayList(LazyPath).init(owner.allocator), .rpaths = ArrayList(LazyPath).init(owner.allocator), - .framework_dirs = ArrayList(LazyPath).init(owner.allocator), + .framework_dirs = ArrayList(FrameworkDir).init(owner.allocator), .installed_headers = ArrayList(*Step).init(owner.allocator), .c_std = std.Build.CStd.C99, .zig_lib_dir = null, @@ -1050,9 +1055,16 @@ pub fn addRPath(self: *Compile, directory_source: LazyPath) void { directory_source.addStepDependencies(&self.step); } +pub fn addSystemFrameworkPath(self: *Compile, directory_source: LazyPath) void { + const b = self.step.owner; + self.framework_dirs.append(FrameworkDir{ .path_system = directory_source.dupe(b) }) catch + @panic("OOM"); + directory_source.addStepDependencies(&self.step); +} + pub fn addFrameworkPath(self: *Compile, directory_source: LazyPath) void { const b = self.step.owner; - self.framework_dirs.append(directory_source.dupe(b)) catch @panic("OOM"); + self.framework_dirs.append(FrameworkDir{ .path = directory_source.dupe(b) }) catch @panic("OOM"); directory_source.addStepDependencies(&self.step); } @@ -1828,9 +1840,17 @@ fn make(step: *Step, prog_node: *std.Progress.Node) !void { zig_args.appendAssumeCapacity(rpath.getPath2(b, step)); } - for (self.framework_dirs.items) |directory_source| { - try zig_args.append("-F"); - try zig_args.append(directory_source.getPath2(b, step)); + for (self.framework_dirs.items) |framework_dir| { + switch (framework_dir) { + .path => |p| { + try zig_args.append("-F"); + try zig_args.append(p.getPath2(b, step)); + }, + .path_system => |p| { + try zig_args.append("-iframework"); + try zig_args.append(p.getPath2(b, step)); + }, + } } { |
