master
1const builtin = @import("builtin");
2const std = @import("std");
3
4pub fn build(b: *std.Build) void {
5 const test_step = b.step("test", "Test it");
6 b.default_step = test_step;
7
8 // Building for the msvc abi requires a native MSVC installation
9 if (builtin.os.tag != .windows or builtin.cpu.arch != .x86_64) return;
10
11 const target = b.resolveTargetQuery(.{
12 .cpu_arch = .x86_64,
13 .os_tag = .windows,
14 .abi = .msvc,
15 });
16 const optimize: std.builtin.OptimizeMode = .Debug;
17 const obj = b.addObject(.{
18 .name = "issue_5825",
19 .root_module = b.createModule(.{
20 .root_source_file = b.path("main.zig"),
21 .optimize = optimize,
22 .target = target,
23 }),
24 });
25
26 const exe = b.addExecutable(.{
27 .name = "issue_5825",
28 .root_module = b.createModule(.{
29 .root_source_file = null,
30 .optimize = optimize,
31 .target = target,
32 }),
33 });
34 exe.subsystem = .console;
35 exe.root_module.linkSystemLibrary("kernel32", .{});
36 exe.root_module.linkSystemLibrary("ntdll", .{});
37 exe.root_module.addObject(obj);
38
39 // TODO: actually check the output
40 _ = exe.getEmittedBin();
41
42 test_step.dependOn(&exe.step);
43}