authorgravatar for andrew@ziglang.orgAndrew Kelley <andrew@ziglang.org> 2019-10-19 15:11:23-04:00
committergravatar for noreply@github.comGitHub <noreply@github.com> 2019-10-19 15:11:23-04:00
logdbb1eaefb50572d3c11129925f3e0fdedf758723
tree3e60ffbd5cb90d8322fb1ca64d7d0f4400b0edc9
parent6f7939a452e69b77581f5390b8075e9dfa81b03e
parentc8dec5729cabb90fa56fad2b6d77171189e01703
signaturebadge-question-mark Signed by PGP key 4AEE18F83AFDEB23

Merge pull request #3473 from nrdmn/subsystem

Configurable PE Subsystem

2 files changed, 16 insertions(+), 1 deletions(-)

lib/std/build.zig+16
...@@ -1491,6 +1491,8 @@ pub const LibExeObjStep = struct {...@@ -1491,6 +1491,8 @@ pub const LibExeObjStep = struct {
1491 /// Position Independent Code1491 /// Position Independent Code
1492 force_pic: ?bool = null,1492 force_pic: ?bool = null,
14931493
1494 subsystem: ?builtin.SubSystem = null,
1495
1494 const LinkObject = union(enum) {1496 const LinkObject = union(enum) {
1495 StaticPath: []const u8,1497 StaticPath: []const u8,
1496 OtherStep: *LibExeObjStep,1498 OtherStep: *LibExeObjStep,
...@@ -2325,6 +2327,20 @@ pub const LibExeObjStep = struct {...@@ -2325,6 +2327,20 @@ pub const LibExeObjStep = struct {
2325 }2327 }
2326 }2328 }
23272329
2330 if (self.subsystem) |subsystem| {
2331 try zig_args.append("--subsystem");
2332 try zig_args.append(switch (subsystem) {
2333 .Console => "console",
2334 .Windows => "windows",
2335 .Posix => "posix",
2336 .Native => "native",
2337 .EfiApplication => "efi_application",
2338 .EfiBootServiceDriver => "efi_boot_service_driver",
2339 .EfiRom => "efi_rom",
2340 .EfiRuntimeDriver => "efi_runtime_driver",
2341 });
2342 }
2343
2328 if (self.kind == Kind.Test) {2344 if (self.kind == Kind.Test) {
2329 try builder.spawnChild(zig_args.toSliceConst());2345 try builder.spawnChild(zig_args.toSliceConst());
2330 } else {2346 } else {
lib/std/os/windows.zig-1
...@@ -42,7 +42,6 @@ pub const subsystem: ?builtin.SubSystem = blk: {...@@ -42,7 +42,6 @@ pub const subsystem: ?builtin.SubSystem = blk: {
42 break :blk builtin.SubSystem.Console;42 break :blk builtin.SubSystem.Console;
43 }43 }
44 },44 },
45 .uefi => break :blk builtin.SubSystem.EfiApplication,
46 else => break :blk null,45 else => break :blk null,
47 }46 }
48};47};