Skip to content

Commit a7b0aec

Browse files
committed
Only populate rc_include_dirs if there are .rc files in the compilation
1 parent 4e02f4a commit a7b0aec

File tree

1 file changed

+18
-9
lines changed

1 file changed

+18
-9
lines changed

src/Compilation.zig

+18-9
Original file line numberDiff line numberDiff line change
@@ -1001,15 +1001,24 @@ pub fn create(gpa: Allocator, options: InitOptions) !*Compilation {
10011001
options.libc_installation,
10021002
);
10031003

1004-
// .rc preprocessor needs to know the libc dirs even if we are not linking libc
1005-
const rc_dirs = try detectLibCIncludeDirs(
1006-
arena,
1007-
options.zig_lib_directory.path.?,
1008-
options.target,
1009-
options.is_native_abi,
1010-
true,
1011-
options.libc_installation,
1012-
);
1004+
// If we have .rc files to compile, then the .rc preprocessor needs
1005+
// to know the libc dirs even if we are not linking libc
1006+
const rc_dirs = if (options.rc_source_files.len > 0)
1007+
try detectLibCIncludeDirs(
1008+
arena,
1009+
options.zig_lib_directory.path.?,
1010+
options.target,
1011+
options.is_native_abi,
1012+
true,
1013+
options.libc_installation,
1014+
)
1015+
else
1016+
LibCDirs{
1017+
.libc_include_dir_list = &[0][]u8{},
1018+
.libc_installation = null,
1019+
.libc_framework_dir_list = &.{},
1020+
.sysroot = null,
1021+
};
10131022

10141023
const sysroot = options.sysroot orelse libc_dirs.sysroot;
10151024

0 commit comments

Comments
 (0)