mirror of
https://github.com/ziglang/zig.git
synced 2024-11-14 16:13:24 +00:00
Add standalone test for all possible MinGW exe entry points
This commit is contained in:
parent
4e428415e5
commit
bad9efbcc1
@ -195,6 +195,10 @@ pub const build_cases = [_]BuildCase{
|
||||
.build_root = "test/standalone/windows_resources",
|
||||
.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"),
|
||||
|
68
test/standalone/windows_entry_points/build.zig
Normal file
68
test/standalone/windows_entry_points/build.zig
Normal file
@ -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);
|
||||
}
|
||||
}
|
6
test/standalone/windows_entry_points/main.c
Normal file
6
test/standalone/windows_entry_points/main.c
Normal file
@ -0,0 +1,6 @@
|
||||
#include <stdio.h>
|
||||
|
||||
int main(int argc, char *argv[ ], char *envp[ ]) {
|
||||
printf("hello from main\n");
|
||||
return 0;
|
||||
}
|
7
test/standalone/windows_entry_points/winmain.c
Normal file
7
test/standalone/windows_entry_points/winmain.c
Normal file
@ -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;
|
||||
}
|
7
test/standalone/windows_entry_points/wmain.c
Normal file
7
test/standalone/windows_entry_points/wmain.c
Normal file
@ -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;
|
||||
}
|
7
test/standalone/windows_entry_points/wwinmain.c
Normal file
7
test/standalone/windows_entry_points/wwinmain.c
Normal file
@ -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;
|
||||
}
|
Loading…
Reference in New Issue
Block a user