| ... | @@ -0,0 +1,25 @@ |
| 1 | const std = @import("std"); |
| 2 | |
| 3 | pub fn build(b: *std.Build) void { |
| 4 | const target = b.standardTargetOptions(.{}); |
| 5 | const mode = b.option(std.builtin.Mode, "mode", "") orelse .Debug; |
| 6 | const disable_llvm = b.option(bool, "disable_llvm", "use the non-llvm zig codegen") orelse false; |
| 7 | |
| 8 | const mod = b.addModule("cookies", .{ .root_source_file = b.path("cookies.zig") }); |
| 9 | |
| 10 | const tests = b.addTest(.{ |
| 11 | .root_source_file = b.path("test.zig"), |
| 12 | .target = target, |
| 13 | .optimize = mode, |
| 14 | }); |
| 15 | tests.root_module.addImport("cookies", mod); |
| 16 | tests.root_module.link_libc = true; |
| 17 | tests.use_llvm = !disable_llvm; |
| 18 | tests.use_lld = !disable_llvm; |
| 19 | |
| 20 | const test_step = b.step("test", "Run all library tests"); |
| 21 | const tests_run = b.addRunArtifact(tests); |
| 22 | tests_run.setCwd(b.path(".")); |
| 23 | tests_run.has_side_effects = true; |
| 24 | test_step.dependOn(&tests_run.step); |
| 25 | } |