| author | |
| committer | |
| log | bad9efbcc140ce5e9837ef06652610636593c1d0 |
| tree | 4b62c7ee0d140903ff5d3689295e79300f8ee464 |
| parent | 4e428415e575c183050d8108af697ac8aeb9a493 |
6 files changed, 99 insertions(+), 0 deletions(-)
test/standalone.zig+4| ... | @@ -195,6 +195,10 @@ pub const build_cases = [_]BuildCase{ | ... | @@ -195,6 +195,10 @@ pub const build_cases = [_]BuildCase{ |
| 195 | .build_root = "test/standalone/windows_resources", | 195 | .build_root = "test/standalone/windows_resources", |
| 196 | .import = @import("standalone/windows_resources/build.zig"), | 196 | .import = @import("standalone/windows_resources/build.zig"), |
| 197 | }, | 197 | }, |
| 198 | .{ | ||
| 199 | .build_root = "test/standalone/windows_entry_points", | ||
| 200 | .import = @import("standalone/windows_entry_points/build.zig"), | ||
| 201 | }, | ||
| 198 | .{ | 202 | .{ |
| 199 | .build_root = "test/standalone/windows_spawn", | 203 | .build_root = "test/standalone/windows_spawn", |
| 200 | .import = @import("standalone/windows_spawn/build.zig"), | 204 | .import = @import("standalone/windows_spawn/build.zig"), |
test/standalone/windows_entry_points/build.zig created+68| ... | @@ -0,0 +1,68 @@ | ||
| 1 | const std = @import("std"); | ||
| 2 | |||
| 3 | pub fn build(b: *std.Build) void { | ||
| 4 | const test_step = b.step("test", "Test it"); | ||
| 5 | b.default_step = test_step; | ||
| 6 | |||
| 7 | const target = b.resolveTargetQuery(.{ | ||
| 8 | .cpu_arch = .x86_64, | ||
| 9 | .os_tag = .windows, | ||
| 10 | .abi = .gnu, | ||
| 11 | }); | ||
| 12 | |||
| 13 | { | ||
| 14 | const exe = b.addExecutable(.{ | ||
| 15 | .name = "main", | ||
| 16 | .target = target, | ||
| 17 | .optimize = .Debug, | ||
| 18 | .link_libc = true, | ||
| 19 | }); | ||
| 20 | exe.addCSourceFile(.{ .file = .{ .path = "main.c" } }); | ||
| 21 | |||
| 22 | _ = exe.getEmittedBin(); | ||
| 23 | test_step.dependOn(&exe.step); | ||
| 24 | } | ||
| 25 | |||
| 26 | { | ||
| 27 | const exe = b.addExecutable(.{ | ||
| 28 | .name = "wmain", | ||
| 29 | .target = target, | ||
| 30 | .optimize = .Debug, | ||
| 31 | .link_libc = true, | ||
| 32 | }); | ||
| 33 | exe.mingw_unicode_entry_point = true; | ||
| 34 | exe.addCSourceFile(.{ .file = .{ .path = "wmain.c" } }); | ||
| 35 | |||
| 36 | _ = exe.getEmittedBin(); | ||
| 37 | test_step.dependOn(&exe.step); | ||
| 38 | } | ||
| 39 | |||
| 40 | { | ||
| 41 | const exe = b.addExecutable(.{ | ||
| 42 | .name = "winmain", | ||
| 43 | .target = target, | ||
| 44 | .optimize = .Debug, | ||
| 45 | .link_libc = true, | ||
| 46 | }); | ||
| 47 | // Note: `exe.subsystem = .Windows;` is not necessary | ||
| 48 | exe.addCSourceFile(.{ .file = .{ .path = "winmain.c" } }); | ||
| 49 | |||
| 50 | _ = exe.getEmittedBin(); | ||
| 51 | test_step.dependOn(&exe.step); | ||
| 52 | } | ||
| 53 | |||
| 54 | { | ||
| 55 | const exe = b.addExecutable(.{ | ||
| 56 | .name = "wwinmain", | ||
| 57 | .target = target, | ||
| 58 | .optimize = .Debug, | ||
| 59 | .link_libc = true, | ||
| 60 | }); | ||
| 61 | exe.mingw_unicode_entry_point = true; | ||
| 62 | // Note: `exe.subsystem = .Windows;` is not necessary | ||
| 63 | exe.addCSourceFile(.{ .file = .{ .path = "wwinmain.c" } }); | ||
| 64 | |||
| 65 | _ = exe.getEmittedBin(); | ||
| 66 | test_step.dependOn(&exe.step); | ||
| 67 | } | ||
| 68 | } | ||
test/standalone/windows_entry_points/main.c created+6| ... | @@ -0,0 +1,6 @@ | ||
| 1 | #include <stdio.h> | ||
| 2 | |||
| 3 | int main(int argc, char *argv[ ], char *envp[ ]) { | ||
| 4 | printf("hello from main\n"); | ||
| 5 | return 0; | ||
| 6 | } | ||
| \ No newline at end of file | |||
test/standalone/windows_entry_points/winmain.c created+7| ... | @@ -0,0 +1,7 @@ | ||
| 1 | #include <windows.h> | ||
| 2 | #include <stdio.h> | ||
| 3 | |||
| 4 | int APIENTRY WinMain(HINSTANCE hInst, HINSTANCE hInstPrev, PSTR cmdline, int cmdshow) { | ||
| 5 | printf("hello from WinMain\n"); | ||
| 6 | return 0; | ||
| 7 | } | ||
| \ No newline at end of file | |||
test/standalone/windows_entry_points/wmain.c created+7| ... | @@ -0,0 +1,7 @@ | ||
| 1 | #include <stdio.h> | ||
| 2 | #include <windows.h> | ||
| 3 | |||
| 4 | int wmain(int argc, wchar_t *argv[ ], wchar_t *envp[ ]) { | ||
| 5 | printf("hello from wmain\n"); | ||
| 6 | return 0; | ||
| 7 | } | ||
| \ No newline at end of file | |||
test/standalone/windows_entry_points/wwinmain.c created+7| ... | @@ -0,0 +1,7 @@ | ||
| 1 | #include <windows.h> | ||
| 2 | #include <stdio.h> | ||
| 3 | |||
| 4 | int APIENTRY wWinMain(HINSTANCE hInst, HINSTANCE hInstPrev, PWSTR cmdline, int cmdshow) { | ||
| 5 | printf("hello from wWinMain\n"); | ||
| 6 | return 0; | ||
| 7 | } | ||
| \ No newline at end of file | |||