diff options
| author | Andrew Kelley <andrew@ziglang.org> | 2024-03-28 14:16:30 -0700 |
|---|---|---|
| committer | GitHub <noreply@github.com> | 2024-03-28 14:16:30 -0700 |
| commit | 3661133f989fefa64c58447dd0073b8c0e8050fc (patch) | |
| tree | c1cd62ba6278ab912f9fcdbc0b6ea27778b2dc10 /test | |
| parent | c808e546a766192c4a9bd45190d4bcfae61d6f3b (diff) | |
| parent | bad9efbcc140ce5e9837ef06652610636593c1d0 (diff) | |
| download | zig-3661133f989fefa64c58447dd0073b8c0e8050fc.tar.gz zig-3661133f989fefa64c58447dd0073b8c0e8050fc.zip | |
Merge pull request #19399 from ypsvlq/mingw
mingw: support -municode
Diffstat (limited to 'test')
| -rw-r--r-- | test/standalone.zig | 4 | ||||
| -rw-r--r-- | test/standalone/windows_entry_points/build.zig | 68 | ||||
| -rw-r--r-- | test/standalone/windows_entry_points/main.c | 6 | ||||
| -rw-r--r-- | test/standalone/windows_entry_points/winmain.c | 7 | ||||
| -rw-r--r-- | test/standalone/windows_entry_points/wmain.c | 7 | ||||
| -rw-r--r-- | test/standalone/windows_entry_points/wwinmain.c | 7 |
6 files changed, 99 insertions, 0 deletions
diff --git a/test/standalone.zig b/test/standalone.zig index c8158364e2..495468eb24 100644 --- a/test/standalone.zig +++ b/test/standalone.zig @@ -196,6 +196,10 @@ pub const build_cases = [_]BuildCase{ .import = @import("standalone/windows_resources/build.zig"), }, .{ + .build_root = "test/standalone/windows_entry_points", + .import = @import("standalone/windows_entry_points/build.zig"), + }, + .{ .build_root = "test/standalone/windows_spawn", .import = @import("standalone/windows_spawn/build.zig"), }, diff --git a/test/standalone/windows_entry_points/build.zig b/test/standalone/windows_entry_points/build.zig new file mode 100644 index 0000000000..25c4839147 --- /dev/null +++ b/test/standalone/windows_entry_points/build.zig @@ -0,0 +1,68 @@ +const std = @import("std"); + +pub fn build(b: *std.Build) void { + const test_step = b.step("test", "Test it"); + b.default_step = test_step; + + const target = b.resolveTargetQuery(.{ + .cpu_arch = .x86_64, + .os_tag = .windows, + .abi = .gnu, + }); + + { + const exe = b.addExecutable(.{ + .name = "main", + .target = target, + .optimize = .Debug, + .link_libc = true, + }); + exe.addCSourceFile(.{ .file = .{ .path = "main.c" } }); + + _ = exe.getEmittedBin(); + test_step.dependOn(&exe.step); + } + + { + const exe = b.addExecutable(.{ + .name = "wmain", + .target = target, + .optimize = .Debug, + .link_libc = true, + }); + exe.mingw_unicode_entry_point = true; + exe.addCSourceFile(.{ .file = .{ .path = "wmain.c" } }); + + _ = exe.getEmittedBin(); + test_step.dependOn(&exe.step); + } + + { + const exe = b.addExecutable(.{ + .name = "winmain", + .target = target, + .optimize = .Debug, + .link_libc = true, + }); + // Note: `exe.subsystem = .Windows;` is not necessary + exe.addCSourceFile(.{ .file = .{ .path = "winmain.c" } }); + + _ = exe.getEmittedBin(); + test_step.dependOn(&exe.step); + } + + { + const exe = b.addExecutable(.{ + .name = "wwinmain", + .target = target, + .optimize = .Debug, + .link_libc = true, + }); + exe.mingw_unicode_entry_point = true; + // Note: `exe.subsystem = .Windows;` is not necessary + exe.addCSourceFile(.{ .file = .{ .path = "wwinmain.c" } }); + + _ = exe.getEmittedBin(); + test_step.dependOn(&exe.step); + } +} diff --git a/test/standalone/windows_entry_points/main.c b/test/standalone/windows_entry_points/main.c new file mode 100644 index 0000000000..1e47eefae0 --- /dev/null +++ b/test/standalone/windows_entry_points/main.c @@ -0,0 +1,6 @@ +#include <stdio.h> + +int main(int argc, char *argv[ ], char *envp[ ]) { + printf("hello from main\n"); + return 0; +}
\ No newline at end of file diff --git a/test/standalone/windows_entry_points/winmain.c b/test/standalone/windows_entry_points/winmain.c new file mode 100644 index 0000000000..c5c0de2434 --- /dev/null +++ b/test/standalone/windows_entry_points/winmain.c @@ -0,0 +1,7 @@ +#include <windows.h> +#include <stdio.h> + +int APIENTRY WinMain(HINSTANCE hInst, HINSTANCE hInstPrev, PSTR cmdline, int cmdshow) { + printf("hello from WinMain\n"); + return 0; +}
\ No newline at end of file diff --git a/test/standalone/windows_entry_points/wmain.c b/test/standalone/windows_entry_points/wmain.c new file mode 100644 index 0000000000..41ec522c57 --- /dev/null +++ b/test/standalone/windows_entry_points/wmain.c @@ -0,0 +1,7 @@ +#include <stdio.h> +#include <windows.h> + +int wmain(int argc, wchar_t *argv[ ], wchar_t *envp[ ]) { + printf("hello from wmain\n"); + return 0; +}
\ No newline at end of file diff --git a/test/standalone/windows_entry_points/wwinmain.c b/test/standalone/windows_entry_points/wwinmain.c new file mode 100644 index 0000000000..7bf97bfae3 --- /dev/null +++ b/test/standalone/windows_entry_points/wwinmain.c @@ -0,0 +1,7 @@ +#include <windows.h> +#include <stdio.h> + +int APIENTRY wWinMain(HINSTANCE hInst, HINSTANCE hInstPrev, PWSTR cmdline, int cmdshow) { + printf("hello from wWinMain\n"); + return 0; +}
\ No newline at end of file |
