authorgravatar for kubkon@jakubkonka.comJakub Konka <kubkon@jakubkonka.com> 2023-08-18 08:08:24+02:00
committergravatar for kubkon@jakubkonka.comJakub Konka <kubkon@jakubkonka.com> 2023-08-18 08:08:24+02:00
log71cc2e67593fb5da38e84900ef4c409f6aa99b94
treeb876e2b047544bad430ff228f93fb2443c0bc6c2
parent23b4a2b8e1135a8a1d487d68961c2f24df84a712

build: merge FrameworkDir into IncludeDir


1 files changed, 12 insertions(+), 23 deletions(-)

lib/std/Build/Step/Compile.zig+12-23
......@@ -42,7 +42,6 @@ unwind_tables: ?bool,
4242compress_debug_sections: enum { none, zlib } = .none,
4343lib_paths: ArrayList(LazyPath),
4444rpaths: ArrayList(LazyPath),
45framework_dirs: ArrayList(FrameworkDir),
4645frameworks: StringHashMap(FrameworkLinkInfo),
4746verbose_link: bool,
4847verbose_cc: bool,
......@@ -261,15 +260,12 @@ const FrameworkLinkInfo = struct {
261260pub const IncludeDir = union(enum) {
262261 path: LazyPath,
263262 path_system: LazyPath,
263 framework_path: LazyPath,
264 framework_path_system: LazyPath,
264265 other_step: *Compile,
265266 config_header_step: *Step.ConfigHeader,
266267};
267268
268pub const FrameworkDir = union(enum) {
269 path: LazyPath,
270 path_system: LazyPath,
271};
272
273269pub const Options = struct {
274270 name: []const u8,
275271 root_source_file: ?LazyPath = null,
......@@ -447,7 +443,6 @@ pub fn create(owner: *std.Build, options: Options) *Compile {
447443 .c_macros = ArrayList([]const u8).init(owner.allocator),
448444 .lib_paths = ArrayList(LazyPath).init(owner.allocator),
449445 .rpaths = ArrayList(LazyPath).init(owner.allocator),
450 .framework_dirs = ArrayList(FrameworkDir).init(owner.allocator),
451446 .installed_headers = ArrayList(*Step).init(owner.allocator),
452447 .c_std = std.Build.CStd.C99,
453448 .zig_lib_dir = null,
......@@ -1057,14 +1052,13 @@ pub fn addRPath(self: *Compile, directory_source: LazyPath) void {
10571052
10581053pub fn addSystemFrameworkPath(self: *Compile, directory_source: LazyPath) void {
10591054 const b = self.step.owner;
1060 self.framework_dirs.append(FrameworkDir{ .path_system = directory_source.dupe(b) }) catch
1061 @panic("OOM");
1055 self.include_dirs.append(IncludeDir{ .framework_path_system = directory_source.dupe(b) }) catch @panic("OOM");
10621056 directory_source.addStepDependencies(&self.step);
10631057}
10641058
10651059pub fn addFrameworkPath(self: *Compile, directory_source: LazyPath) void {
10661060 const b = self.step.owner;
1067 self.framework_dirs.append(FrameworkDir{ .path = directory_source.dupe(b) }) catch @panic("OOM");
1061 self.include_dirs.append(IncludeDir{ .framework_path = directory_source.dupe(b) }) catch @panic("OOM");
10681062 directory_source.addStepDependencies(&self.step);
10691063}
10701064
......@@ -1787,6 +1781,14 @@ fn make(step: *Step, prog_node: *std.Progress.Node) !void {
17871781 try zig_args.append("-isystem");
17881782 try zig_args.append(include_path.getPath(b));
17891783 },
1784 .framework_path => |include_path| {
1785 try zig_args.append("-F");
1786 try zig_args.append(include_path.getPath2(b, step));
1787 },
1788 .framework_path_system => |include_path| {
1789 try zig_args.append("-iframework");
1790 try zig_args.append(include_path.getPath2(b, step));
1791 },
17901792 .other_step => |other| {
17911793 if (other.generated_h) |header| {
17921794 try zig_args.append("-isystem");
......@@ -1840,19 +1842,6 @@ fn make(step: *Step, prog_node: *std.Progress.Node) !void {
18401842 zig_args.appendAssumeCapacity(rpath.getPath2(b, step));
18411843 }
18421844
1843 for (self.framework_dirs.items) |framework_dir| {
1844 switch (framework_dir) {
1845 .path => |p| {
1846 try zig_args.append("-F");
1847 try zig_args.append(p.getPath2(b, step));
1848 },
1849 .path_system => |p| {
1850 try zig_args.append("-iframework");
1851 try zig_args.append(p.getPath2(b, step));
1852 },
1853 }
1854 }
1855
18561845 {
18571846 var it = self.frameworks.iterator();
18581847 while (it.next()) |entry| {