aboutsummaryrefslogtreecommitdiff
path: root/src
diff options
context:
space:
mode:
authorElaine Gibson <ypsvlq@gmail.com>2024-03-20 22:14:12 +0000
committerAndrew Kelley <andrew@ziglang.org>2024-03-21 15:05:17 -0700
commite12a72db92164dab46023dad03d10f5047477d95 (patch)
treec2bfed6754621d42e6031d5dba6bf140cf122141 /src
parentc5bd19e45edfa2989909f825269c462d1bf641b7 (diff)
downloadzig-e12a72db92164dab46023dad03d10f5047477d95.tar.gz
zig-e12a72db92164dab46023dad03d10f5047477d95.zip
main: set subsystem version from target windows version
Diffstat (limited to 'src')
-rw-r--r--src/main.zig10
1 files changed, 10 insertions, 0 deletions
diff --git a/src/main.zig b/src/main.zig
index be2083a0f8..4407ca72ce 100644
--- a/src/main.zig
+++ b/src/main.zig
@@ -2799,6 +2799,16 @@ fn buildOutputType(
const target = main_mod.resolved_target.result;
+ if (target.os.tag == .windows and major_subsystem_version == null and minor_subsystem_version == null) {
+ major_subsystem_version, minor_subsystem_version = switch (target.os.version_range.windows.min) {
+ .nt4 => .{ 4, 0 },
+ .win2k => .{ 5, 0 },
+ .xp => if (target.cpu.arch == .x86_64) .{ 5, 2 } else .{ 5, 1 },
+ .ws2003 => .{ 5, 2 },
+ else => .{ null, null },
+ };
+ }
+
if (target.ofmt != .coff) {
if (manifest_file != null) {
fatal("manifest file is not allowed unless the target object format is coff (Windows/UEFI)", .{});