diff options
| author | Phil Richards <phildrip@users.noreply.github.com> | 2023-09-26 20:25:08 +0100 |
|---|---|---|
| committer | GitHub <noreply@github.com> | 2023-09-26 15:25:08 -0400 |
| commit | 15ce9652525de2cc245203042d8c62ef30d5de1f (patch) | |
| tree | 96d41cb813a1ee5e291a54bb2cf1b3a788866e96 /src/Compilation.zig | |
| parent | f4c884617f499b52eaecc0ef674609c774052f8f (diff) | |
| download | zig-15ce9652525de2cc245203042d8c62ef30d5de1f.tar.gz zig-15ce9652525de2cc245203042d8c62ef30d5de1f.zip | |
define `_WIN32_WINNT` for windows compilations based on target minver (#17224)
Diffstat (limited to 'src/Compilation.zig')
| -rw-r--r-- | src/Compilation.zig | 8 |
1 files changed, 8 insertions, 0 deletions
diff --git a/src/Compilation.zig b/src/Compilation.zig index 47d0125ffb..c1cfe4613c 100644 --- a/src/Compilation.zig +++ b/src/Compilation.zig @@ -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{ |
