zig/test/standalone/options/build.zig
Andrew Kelley 60eabc0eca std.Build.CompileStep: remove run() and install()
These functions are problematic in light of dependencies because they
run and install, respectively, for the *owner* package rather than for
the *user* package. By removing these functions, the build script is
forced to provide the *Build object to associate the new step with,
making everything less surprising.

Unfortunately, this is a widely breaking change.

see #15079
2023-04-10 18:35:14 -07:00

21 lines
809 B
Zig

const std = @import("std");
pub fn build(b: *std.Build) void {
const main = b.addTest(.{
.root_source_file = .{ .path = "src/main.zig" },
.target = .{},
.optimize = .Debug,
});
const options = b.addOptions();
main.addOptions("build_options", options);
options.addOption(bool, "bool_true", b.option(bool, "bool_true", "t").?);
options.addOption(bool, "bool_false", b.option(bool, "bool_false", "f").?);
options.addOption(u32, "int", b.option(u32, "int", "i").?);
const E = enum { one, two, three };
options.addOption(E, "e", b.option(E, "e", "e").?);
options.addOption([]const u8, "string", b.option([]const u8, "string", "s").?);
const test_step = b.step("test", "Run unit tests");
test_step.dependOn(&b.addRunArtifact(main).step);
}