aboutsummaryrefslogtreecommitdiff
path: root/lib/std/Build/Module.zig
diff options
context:
space:
mode:
authordave caruso <me@paperdave.net>2024-07-28 22:45:27 -0700
committerAndrew Kelley <andrew@ziglang.org>2024-09-25 21:50:55 -0700
commit085cc54aadb327b9910be2c72b31ea046e7e8f52 (patch)
tree3474fea2fe14b4c69cdfa7022db760db82f9dce4 /lib/std/Build/Module.zig
parent0e876a6378b5380900cf8755f624a670e8716f80 (diff)
downloadzig-085cc54aadb327b9910be2c72b31ea046e7e8f52.tar.gz
zig-085cc54aadb327b9910be2c72b31ea046e7e8f52.zip
replace TranslateC.addIncludeDir with variants with LazyPath/library names
Diffstat (limited to 'lib/std/Build/Module.zig')
-rw-r--r--lib/std/Build/Module.zig69
1 files changed, 39 insertions, 30 deletions
diff --git a/lib/std/Build/Module.zig b/lib/std/Build/Module.zig
index 635e6cc334..253945b3d7 100644
--- a/lib/std/Build/Module.zig
+++ b/lib/std/Build/Module.zig
@@ -135,6 +135,44 @@ pub const IncludeDir = union(enum) {
framework_path_system: LazyPath,
other_step: *Step.Compile,
config_header_step: *Step.ConfigHeader,
+
+ pub fn appendZigProcessFlags(
+ include_dir: IncludeDir,
+ b: *std.Build,
+ zig_args: *std.ArrayList([]const u8),
+ asking_step: ?*Step,
+ ) !void {
+ switch (include_dir) {
+ .path => |include_path| {
+ try zig_args.appendSlice(&.{ "-I", include_path.getPath2(b, asking_step) });
+ },
+ .path_system => |include_path| {
+ try zig_args.appendSlice(&.{ "-isystem", include_path.getPath2(b, asking_step) });
+ },
+ .path_after => |include_path| {
+ try zig_args.appendSlice(&.{ "-idirafter", include_path.getPath2(b, asking_step) });
+ },
+ .framework_path => |include_path| {
+ try zig_args.appendSlice(&.{ "-F", include_path.getPath2(b, asking_step) });
+ },
+ .framework_path_system => |include_path| {
+ try zig_args.appendSlice(&.{ "-iframework", include_path.getPath2(b, asking_step) });
+ },
+ .other_step => |other| {
+ if (other.generated_h) |header| {
+ try zig_args.appendSlice(&.{ "-isystem", std.fs.path.dirname(header.getPath()).? });
+ }
+ if (other.installed_headers_include_tree) |include_tree| {
+ try zig_args.appendSlice(&.{ "-I", include_tree.generated_directory.getPath() });
+ }
+ },
+ .config_header_step => |config_header| {
+ const full_file_path = config_header.output_file.getPath();
+ const header_dir_path = full_file_path[0 .. full_file_path.len - config_header.include_path.len];
+ try zig_args.appendSlice(&.{ "-I", header_dir_path });
+ },
+ }
+ }
};
pub const LinkFrameworkOptions = struct {
@@ -690,36 +728,7 @@ pub fn appendZigProcessFlags(
}
for (m.include_dirs.items) |include_dir| {
- switch (include_dir) {
- .path => |include_path| {
- try zig_args.appendSlice(&.{ "-I", include_path.getPath2(b, asking_step) });
- },
- .path_system => |include_path| {
- try zig_args.appendSlice(&.{ "-isystem", include_path.getPath2(b, asking_step) });
- },
- .path_after => |include_path| {
- try zig_args.appendSlice(&.{ "-idirafter", include_path.getPath2(b, asking_step) });
- },
- .framework_path => |include_path| {
- try zig_args.appendSlice(&.{ "-F", include_path.getPath2(b, asking_step) });
- },
- .framework_path_system => |include_path| {
- try zig_args.appendSlice(&.{ "-iframework", include_path.getPath2(b, asking_step) });
- },
- .other_step => |other| {
- if (other.generated_h) |header| {
- try zig_args.appendSlice(&.{ "-isystem", std.fs.path.dirname(header.getPath()).? });
- }
- if (other.installed_headers_include_tree) |include_tree| {
- try zig_args.appendSlice(&.{ "-I", include_tree.generated_directory.getPath() });
- }
- },
- .config_header_step => |config_header| {
- const full_file_path = config_header.output_file.getPath();
- const header_dir_path = full_file_path[0 .. full_file_path.len - config_header.include_path.len];
- try zig_args.appendSlice(&.{ "-I", header_dir_path });
- },
- }
+ try include_dir.appendZigProcessFlags(b, zig_args, asking_step);
}
try zig_args.appendSlice(m.c_macros.items);