| 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 optimize: std.builtin.Optimize = .debug; |
| 8 | |
| 9 | const exe = b.addExecutable(.{ |
| 10 | .name = "test", |
| 11 | .root_module = b.createModule(.{ |
| 12 | .target = b.graph.host, |
| 13 | .optimize = optimize, |
| 14 | }), |
| 15 | }); |
| 16 | exe.root_module.addCSourceFile(.{ |
| 17 | .file = b.path("test.c"), |
| 18 | .flags = &.{"-std=c23"}, |
| 19 | }); |
| 20 | exe.root_module.link_libc = true; |
| 21 | exe.root_module.addEmbedPath(b.path("data")); |
| 22 | |
| 23 | const run_c_cmd = b.addRunArtifact(exe); |
| 24 | run_c_cmd.expectExitCode(0); |
| 25 | run_c_cmd.skip_foreign_checks = true; |
| 26 | test_step.dependOn(&run_c_cmd.step); |
| 27 | } |