From 412d863ba5801c1376af7ab8f04a71b839a820a6 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Carl=20=C3=85stholm?= Date: Sun, 1 Oct 2023 20:16:00 +0200 Subject: [PATCH] std.Build: expose `-idirafter` to the build system --- lib/std/Build/Step/Compile.zig | 11 +++++++++++ 1 file changed, 11 insertions(+) diff --git a/lib/std/Build/Step/Compile.zig b/lib/std/Build/Step/Compile.zig index 572e2692d3..5ffc6c33ac 100644 --- a/lib/std/Build/Step/Compile.zig +++ b/lib/std/Build/Step/Compile.zig @@ -289,6 +289,7 @@ const FrameworkLinkInfo = struct { pub const IncludeDir = union(enum) { path: LazyPath, path_system: LazyPath, + path_after: LazyPath, framework_path: LazyPath, framework_path_system: LazyPath, other_step: *Compile, @@ -1062,6 +1063,12 @@ pub fn addObject(self: *Compile, obj: *Compile) void { self.linkLibraryOrObject(obj); } +pub fn addAfterIncludePath(self: *Compile, path: LazyPath) void { + const b = self.step.owner; + self.include_dirs.append(IncludeDir{ .path_after = path.dupe(b) }) catch @panic("OOM"); + path.addStepDependencies(&self.step); +} + pub fn addSystemIncludePath(self: *Compile, path: LazyPath) void { const b = self.step.owner; self.include_dirs.append(IncludeDir{ .path_system = path.dupe(b) }) catch @panic("OOM"); @@ -1842,6 +1849,10 @@ fn make(step: *Step, prog_node: *std.Progress.Node) !void { try zig_args.append("-isystem"); try zig_args.append(include_path.getPath(b)); }, + .path_after => |include_path| { + try zig_args.append("-idirafter"); + try zig_args.append(include_path.getPath(b)); + }, .framework_path => |include_path| { try zig_args.append("-F"); try zig_args.append(include_path.getPath2(b, step));