mirror of
https://github.com/ziglang/zig.git
synced 2026-02-13 04:48:20 +00:00
define _WIN32_WINNT for windows compilations based on target minver (#17224)
This commit is contained in:
parent
f4c884617f
commit
15ce965252
@ -4880,6 +4880,14 @@ pub fn addCCArgs(
|
||||
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, .cu, .rc, .assembly, .assembly_with_cpp => {
|
||||
const minver: u16 = @truncate(@intFromEnum(target.os.getVersionRange().windows.min) >> 16);
|
||||
try argv.append(try std.fmt.allocPrint(argv.allocator, "-D_WIN32_WINNT=0x{x:0>4}", .{minver}));
|
||||
},
|
||||
else => {},
|
||||
};
|
||||
|
||||
switch (ext) {
|
||||
.c, .cpp, .m, .mm, .h, .cu, .rc => {
|
||||
try argv.appendSlice(&[_][]const u8{
|
||||
|
||||
@ -89,7 +89,6 @@ pub fn buildCRTFile(comp: *Compilation, crt_file: CRTFile, prog_node: *std.Progr
|
||||
|
||||
"-std=gnu99",
|
||||
"-D_CRTBLD",
|
||||
"-D_WIN32_WINNT=0x0f00",
|
||||
"-D__MSVCRT_VERSION__=0x700",
|
||||
"-D__USE_MINGW_ANSI_STDIO=0",
|
||||
});
|
||||
@ -114,7 +113,6 @@ pub fn buildCRTFile(comp: *Compilation, crt_file: CRTFile, prog_node: *std.Progr
|
||||
|
||||
"-std=gnu99",
|
||||
"-D_CRTBLD",
|
||||
"-D_WIN32_WINNT=0x0f00",
|
||||
"-D__MSVCRT_VERSION__=0x700",
|
||||
"-D__USE_MINGW_ANSI_STDIO=0",
|
||||
|
||||
@ -163,7 +161,6 @@ pub fn buildCRTFile(comp: *Compilation, crt_file: CRTFile, prog_node: *std.Progr
|
||||
|
||||
"-std=gnu99",
|
||||
"-D_CRTBLD",
|
||||
"-D_WIN32_WINNT=0x0f00",
|
||||
"-D__MSVCRT_VERSION__=0x700",
|
||||
"-D__USE_MINGW_ANSI_STDIO=0",
|
||||
|
||||
@ -226,7 +223,6 @@ pub fn buildCRTFile(comp: *Compilation, crt_file: CRTFile, prog_node: *std.Progr
|
||||
|
||||
"-std=gnu99",
|
||||
"-D_CRTBLD",
|
||||
"-D_WIN32_WINNT=0x0f00",
|
||||
"-D__MSVCRT_VERSION__=0x700",
|
||||
"-D__USE_MINGW_ANSI_STDIO=0",
|
||||
|
||||
@ -272,7 +268,6 @@ fn add_cc_args(
|
||||
try args.appendSlice(&[_][]const u8{
|
||||
"-std=gnu11",
|
||||
"-D_CRTBLD",
|
||||
"-D_WIN32_WINNT=0x0f00",
|
||||
"-D__MSVCRT_VERSION__=0x700",
|
||||
"-D__USE_MINGW_ANSI_STDIO=0",
|
||||
});
|
||||
|
||||
Loading…
x
Reference in New Issue
Block a user