Commit 19b6995939
Changed files (2)
src/Compilation.zig
@@ -5205,22 +5205,21 @@ pub fn addCCArgs(
} else if (target.isMinGW()) {
try argv.append("-D__MSVCRT_VERSION__=0xE00"); // use ucrt
+ switch (ext) {
+ .c, .cpp, .m, .mm, .h, .hpp, .hm, .hmm, .cu, .rc, .assembly, .assembly_with_cpp => {
+ const minver: u16 = @truncate(@intFromEnum(target.os.getVersionRange().windows.min) >> 16);
+ try argv.append(
+ try std.fmt.allocPrint(arena, "-D_WIN32_WINNT=0x{x:0>4}", .{minver}),
+ );
+ },
+ else => {},
+ }
}
}
const llvm_triple = try @import("codegen/llvm.zig").targetTriple(arena, target);
try argv.appendSlice(&[_][]const u8{ "-target", llvm_triple });
- if (target.os.tag == .windows) switch (ext) {
- .c, .cpp, .m, .mm, .h, .hpp, .hm, .hmm, .cu, .rc, .assembly, .assembly_with_cpp => {
- const minver: u16 = @truncate(@intFromEnum(target.os.getVersionRange().windows.min) >> 16);
- try argv.append(
- try std.fmt.allocPrint(arena, "-D_WIN32_WINNT=0x{x:0>4}", .{minver}),
- );
- },
- else => {},
- };
-
switch (ext) {
.c, .cpp, .m, .mm, .h, .hpp, .hm, .hmm, .cu, .rc => {
try argv.appendSlice(&[_][]const u8{
src/mingw.zig
@@ -152,6 +152,7 @@ fn add_cc_args(
"-D_CRTBLD",
"-D_SYSCRT=1",
"-DCRTDLL=1",
+ "-D_WIN32_WINNT=0x0f00",
// According to Martin Storsjö,
// > the files under mingw-w64-crt are designed to always
// be built with __MSVCRT_VERSION__=0x700