34 lines
1.1 KiB
Zig
34 lines
1.1 KiB
Zig
const std = @import("std");
|
|
|
|
pub fn build(b: *std.Build) void {
|
|
const target = b.standardTargetOptions(.{});
|
|
const optimize = b.standardOptimizeOption(.{});
|
|
|
|
const mod = b.addModule("p2", .{
|
|
.target = target,
|
|
.optimize = optimize,
|
|
.root_source_file = b.path("src/p2.zig"),
|
|
});
|
|
|
|
const filter_option = b.option([]const []const u8, "test-filter", "Skip test that do not match this filter");
|
|
const test_filters = filter_option orelse &.{};
|
|
const test_step = b.step("test", "test p2");
|
|
const tests = b.addTest(.{
|
|
.root_module = b.createModule(.{
|
|
.target = target,
|
|
.optimize = optimize,
|
|
.root_source_file = b.path("src/p2.zig"),
|
|
}),
|
|
.use_llvm = b.option(bool, "llvm", "compiles the tests with llvm "),
|
|
.filters = test_filters,
|
|
});
|
|
|
|
tests.root_module.addImport("p2", mod);
|
|
const installArtifact = b.addInstallArtifact(tests, .{});
|
|
const runArtifact = b.addRunArtifact(tests);
|
|
test_step.dependOn(&installArtifact.step);
|
|
test_step.dependOn(&runArtifact.step);
|
|
runArtifact.addPassthruArgs();
|
|
b.installArtifact(tests);
|
|
}
|