@@ -135,6 +135,44 @@ pub const IncludeDir = union(enum) {
135
135
framework_path_system : LazyPath ,
136
136
other_step : * Step.Compile ,
137
137
config_header_step : * Step.ConfigHeader ,
138
+
139
+ pub fn appendZigProcessFlags (
140
+ include_dir : IncludeDir ,
141
+ b : * std.Build ,
142
+ zig_args : * std .ArrayList ([]const u8 ),
143
+ asking_step : ? * Step ,
144
+ ) ! void {
145
+ switch (include_dir ) {
146
+ .path = > | include_path | {
147
+ try zig_args .appendSlice (&.{ "-I" , include_path .getPath2 (b , asking_step ) });
148
+ },
149
+ .path_system = > | include_path | {
150
+ try zig_args .appendSlice (&.{ "-isystem" , include_path .getPath2 (b , asking_step ) });
151
+ },
152
+ .path_after = > | include_path | {
153
+ try zig_args .appendSlice (&.{ "-idirafter" , include_path .getPath2 (b , asking_step ) });
154
+ },
155
+ .framework_path = > | include_path | {
156
+ try zig_args .appendSlice (&.{ "-F" , include_path .getPath2 (b , asking_step ) });
157
+ },
158
+ .framework_path_system = > | include_path | {
159
+ try zig_args .appendSlice (&.{ "-iframework" , include_path .getPath2 (b , asking_step ) });
160
+ },
161
+ .other_step = > | other | {
162
+ if (other .generated_h ) | header | {
163
+ try zig_args .appendSlice (&.{ "-isystem" , std .fs .path .dirname (header .getPath ()).? });
164
+ }
165
+ if (other .installed_headers_include_tree ) | include_tree | {
166
+ try zig_args .appendSlice (&.{ "-I" , include_tree .generated_directory .getPath () });
167
+ }
168
+ },
169
+ .config_header_step = > | config_header | {
170
+ const full_file_path = config_header .output_file .getPath ();
171
+ const header_dir_path = full_file_path [0 .. full_file_path .len - config_header .include_path .len ];
172
+ try zig_args .appendSlice (&.{ "-I" , header_dir_path });
173
+ },
174
+ }
175
+ }
138
176
};
139
177
140
178
pub const LinkFrameworkOptions = struct {
@@ -690,36 +728,7 @@ pub fn appendZigProcessFlags(
690
728
}
691
729
692
730
for (m .include_dirs .items ) | include_dir | {
693
- switch (include_dir ) {
694
- .path = > | include_path | {
695
- try zig_args .appendSlice (&.{ "-I" , include_path .getPath2 (b , asking_step ) });
696
- },
697
- .path_system = > | include_path | {
698
- try zig_args .appendSlice (&.{ "-isystem" , include_path .getPath2 (b , asking_step ) });
699
- },
700
- .path_after = > | include_path | {
701
- try zig_args .appendSlice (&.{ "-idirafter" , include_path .getPath2 (b , asking_step ) });
702
- },
703
- .framework_path = > | include_path | {
704
- try zig_args .appendSlice (&.{ "-F" , include_path .getPath2 (b , asking_step ) });
705
- },
706
- .framework_path_system = > | include_path | {
707
- try zig_args .appendSlice (&.{ "-iframework" , include_path .getPath2 (b , asking_step ) });
708
- },
709
- .other_step = > | other | {
710
- if (other .generated_h ) | header | {
711
- try zig_args .appendSlice (&.{ "-isystem" , std .fs .path .dirname (header .getPath ()).? });
712
- }
713
- if (other .installed_headers_include_tree ) | include_tree | {
714
- try zig_args .appendSlice (&.{ "-I" , include_tree .generated_directory .getPath () });
715
- }
716
- },
717
- .config_header_step = > | config_header | {
718
- const full_file_path = config_header .output_file .getPath ();
719
- const header_dir_path = full_file_path [0 .. full_file_path .len - config_header .include_path .len ];
720
- try zig_args .appendSlice (&.{ "-I" , header_dir_path });
721
- },
722
- }
731
+ try include_dir .appendZigProcessFlags (b , zig_args , asking_step );
723
732
}
724
733
725
734
try zig_args .appendSlice (m .c_macros .items );
0 commit comments