Skip to content

Commit 82f12a0

Browse files
committed
Fix detectWin32ResourceIncludeDirs
These changes got lost in a rebase or something. This commit will be squashed.
1 parent a299a02 commit 82f12a0

File tree

1 file changed

+15
-15
lines changed

1 file changed

+15
-15
lines changed

src/Compilation.zig

Lines changed: 15 additions & 15 deletions
Original file line numberDiff line numberDiff line change
@@ -5188,6 +5188,15 @@ fn failCObjWithOwnedErrorMsg(
51885188
fn detectWin32ResourceIncludeDirs(arena: Allocator, options: InitOptions) !LibCDirs {
51895189
// Set the includes to .none here when there are no rc files to compile
51905190
var includes = if (options.rc_source_files.len > 0) options.rc_includes else .none;
5191+
if (builtin.target.os.tag != .windows) {
5192+
switch (includes) {
5193+
// MSVC can't be found when the host isn't Windows, so short-circuit.
5194+
.msvc => includes = .none,
5195+
// Skip straight to gnu since we won't be able to detect MSVC on non-Windows hosts.
5196+
.any => includes = .gnu,
5197+
.none, .gnu => {},
5198+
}
5199+
}
51915200
while (true) {
51925201
switch (includes) {
51935202
.any, .msvc => return detectLibCIncludeDirs(
@@ -5212,21 +5221,12 @@ fn detectWin32ResourceIncludeDirs(arena: Allocator, options: InitOptions) !LibCD
52125221
}
52135222
return err;
52145223
},
5215-
.gnu => return detectLibCIncludeDirs(
5216-
arena,
5217-
options.zig_lib_directory.path.?,
5218-
.{
5219-
.cpu = options.target.cpu,
5220-
.os = options.target.os,
5221-
.abi = .gnu,
5222-
.ofmt = options.target.ofmt,
5223-
},
5224-
options.is_native_abi,
5225-
// The .rc preprocessor will need to know the libc include dirs even if we
5226-
// are not linking libc, so force 'link_libc' to true
5227-
true,
5228-
options.libc_installation,
5229-
),
5224+
.gnu => return detectLibCFromBuilding(arena, options.zig_lib_directory.path.?, .{
5225+
.cpu = options.target.cpu,
5226+
.os = options.target.os,
5227+
.abi = .gnu,
5228+
.ofmt = options.target.ofmt,
5229+
}),
52305230
.none => return LibCDirs{
52315231
.libc_include_dir_list = &[0][]u8{},
52325232
.libc_installation = null,

0 commit comments

Comments
 (0)