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,...@@ -42,7 +42,6 @@ unwind_tables: ?bool,
42compress_debug_sections: enum { none, zlib } = .none,42compress_debug_sections: enum { none, zlib } = .none,
43lib_paths: ArrayList(LazyPath),43lib_paths: ArrayList(LazyPath),
44rpaths: ArrayList(LazyPath),44rpaths: ArrayList(LazyPath),
45framework_dirs: ArrayList(FrameworkDir),
46frameworks: StringHashMap(FrameworkLinkInfo),45frameworks: StringHashMap(FrameworkLinkInfo),
47verbose_link: bool,46verbose_link: bool,
48verbose_cc: bool,47verbose_cc: bool,
...@@ -261,15 +260,12 @@ const FrameworkLinkInfo = struct {...@@ -261,15 +260,12 @@ const FrameworkLinkInfo = struct {
261pub const IncludeDir = union(enum) {260pub const IncludeDir = union(enum) {
262 path: LazyPath,261 path: LazyPath,
263 path_system: LazyPath,262 path_system: LazyPath,
263 framework_path: LazyPath,
264 framework_path_system: LazyPath,
264 other_step: *Compile,265 other_step: *Compile,
265 config_header_step: *Step.ConfigHeader,266 config_header_step: *Step.ConfigHeader,
266};267};
267268
268pub const FrameworkDir = union(enum) {
269 path: LazyPath,
270 path_system: LazyPath,
271};
272
273pub const Options = struct {269pub const Options = struct {
274 name: []const u8,270 name: []const u8,
275 root_source_file: ?LazyPath = null,271 root_source_file: ?LazyPath = null,
...@@ -447,7 +443,6 @@ pub fn create(owner: *std.Build, options: Options) *Compile {...@@ -447,7 +443,6 @@ pub fn create(owner: *std.Build, options: Options) *Compile {
447 .c_macros = ArrayList([]const u8).init(owner.allocator),443 .c_macros = ArrayList([]const u8).init(owner.allocator),
448 .lib_paths = ArrayList(LazyPath).init(owner.allocator),444 .lib_paths = ArrayList(LazyPath).init(owner.allocator),
449 .rpaths = ArrayList(LazyPath).init(owner.allocator),445 .rpaths = ArrayList(LazyPath).init(owner.allocator),
450 .framework_dirs = ArrayList(FrameworkDir).init(owner.allocator),
451 .installed_headers = ArrayList(*Step).init(owner.allocator),446 .installed_headers = ArrayList(*Step).init(owner.allocator),
452 .c_std = std.Build.CStd.C99,447 .c_std = std.Build.CStd.C99,
453 .zig_lib_dir = null,448 .zig_lib_dir = null,
...@@ -1057,14 +1052,13 @@ pub fn addRPath(self: *Compile, directory_source: LazyPath) void {...@@ -1057,14 +1052,13 @@ pub fn addRPath(self: *Compile, directory_source: LazyPath) void {
10571052
1058pub fn addSystemFrameworkPath(self: *Compile, directory_source: LazyPath) void {1053pub fn addSystemFrameworkPath(self: *Compile, directory_source: LazyPath) void {
1059 const b = self.step.owner;1054 const b = self.step.owner;
1060 self.framework_dirs.append(FrameworkDir{ .path_system = directory_source.dupe(b) }) catch1055 self.include_dirs.append(IncludeDir{ .framework_path_system = directory_source.dupe(b) }) catch @panic("OOM");
1061 @panic("OOM");
1062 directory_source.addStepDependencies(&self.step);1056 directory_source.addStepDependencies(&self.step);
1063}1057}
10641058
1065pub fn addFrameworkPath(self: *Compile, directory_source: LazyPath) void {1059pub fn addFrameworkPath(self: *Compile, directory_source: LazyPath) void {
1066 const b = self.step.owner;1060 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");
1068 directory_source.addStepDependencies(&self.step);1062 directory_source.addStepDependencies(&self.step);
1069}1063}
10701064
...@@ -1787,6 +1781,14 @@ fn make(step: *Step, prog_node: *std.Progress.Node) !void {...@@ -1787,6 +1781,14 @@ fn make(step: *Step, prog_node: *std.Progress.Node) !void {
1787 try zig_args.append("-isystem");1781 try zig_args.append("-isystem");
1788 try zig_args.append(include_path.getPath(b));1782 try zig_args.append(include_path.getPath(b));
1789 },1783 },
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 },
1790 .other_step => |other| {1792 .other_step => |other| {
1791 if (other.generated_h) |header| {1793 if (other.generated_h) |header| {
1792 try zig_args.append("-isystem");1794 try zig_args.append("-isystem");
...@@ -1840,19 +1842,6 @@ fn make(step: *Step, prog_node: *std.Progress.Node) !void {...@@ -1840,19 +1842,6 @@ fn make(step: *Step, prog_node: *std.Progress.Node) !void {
1840 zig_args.appendAssumeCapacity(rpath.getPath2(b, step));1842 zig_args.appendAssumeCapacity(rpath.getPath2(b, step));
1841 }1843 }
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
1856 {1845 {
1857 var it = self.frameworks.iterator();1846 var it = self.frameworks.iterator();
1858 while (it.next()) |entry| {1847 while (it.next()) |entry| {