| 1 | const std = @import("std"); |
| 2 | const builtin = @import("builtin"); |
| 3 | |
| 4 | pub fn build(b: *std.Build) void { |
| 5 | const test_step = b.step("test", "Test it"); |
| 6 | b.default_step = test_step; |
| 7 | |
| 8 | const optimize: std.builtin.Optimize = .debug; |
| 9 | const target = b.graph.host; |
| 10 | |
| 11 | if (builtin.os.tag != .windows) return; |
| 12 | |
| 13 | const hello = b.addExecutable(.{ |
| 14 | .name = "hello", |
| 15 | .root_module = b.createModule(.{ |
| 16 | .root_source_file = b.path("hello.zig"), |
| 17 | .optimize = optimize, |
| 18 | .target = target, |
| 19 | }), |
| 20 | }); |
| 21 | |
| 22 | const main = b.addExecutable(.{ |
| 23 | .name = "main", |
| 24 | .root_module = b.createModule(.{ |
| 25 | .root_source_file = b.path("main.zig"), |
| 26 | .optimize = optimize, |
| 27 | .target = target, |
| 28 | }), |
| 29 | }); |
| 30 | |
| 31 | const run = b.addRunArtifact(main); |
| 32 | run.addArtifactArg(hello); |
| 33 | run.addDirectoryArg(b.tmpPath()); |
| 34 | run.expectExitCode(0); |
| 35 | run.skip_foreign_checks = true; |
| 36 | |
| 37 | test_step.dependOn(&run.step); |
| 38 | } |