| 1 | const std = @import("std"); |
| 2 | |
| 3 | pub fn build(b: *std.Build) void { |
| 4 | const main = b.addTest(.{ .root_module = b.createModule(.{ |
| 5 | .root_source_file = b.path("src/main.zig"), |
| 6 | .target = b.graph.host, |
| 7 | .optimize = .debug, |
| 8 | }) }); |
| 9 | |
| 10 | const options = b.addOptions(); |
| 11 | main.root_module.addOptions("build_options", options); |
| 12 | options.addOption(bool, "bool_true", b.option(bool, "bool_true", "t").?); |
| 13 | options.addOption(bool, "bool_false", b.option(bool, "bool_false", "f").?); |
| 14 | options.addOption(u32, "int", b.option(u32, "int", "i").?); |
| 15 | const E = enum { one, two, three }; |
| 16 | options.addOption(E, "e", b.option(E, "e", "e").?); |
| 17 | options.addOption([]const u8, "string", b.option([]const u8, "string", "s").?); |
| 18 | |
| 19 | const test_step = b.step("test", "Run unit tests"); |
| 20 | test_step.dependOn(&b.addRunArtifact(main).step); |
| 21 | } |