38 lines
1.1 KiB
Zig
38 lines
1.1 KiB
Zig
const std = @import("std");
|
|
const bh = @import("bh");
|
|
|
|
pub fn build(b: *std.Build) void {
|
|
const target = b.standardTargetOptions(.{});
|
|
const optimize = b.standardOptimizeOption(.{});
|
|
const static_build = b.option(bool, "static_build", "builds backlog dependencies for static linking") orelse true;
|
|
|
|
const p2 = bh.MakeModlib(b, .{
|
|
.name = "p2",
|
|
.target = target,
|
|
.optimize = optimize,
|
|
.static_build = static_build,
|
|
.root = b.path("src/p2.zig"),
|
|
});
|
|
|
|
p2.install();
|
|
|
|
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"),
|
|
}),
|
|
// .link_libc = true,
|
|
});
|
|
|
|
tests.root_module.addImport("p2", p2.mod);
|
|
tests.root_module.linkLibrary(p2.lib);
|
|
const runArtifact = b.addRunArtifact(tests);
|
|
test_step.dependOn(&runArtifact.step);
|
|
if (b.args) |args| {
|
|
runArtifact.addArgs(args);
|
|
}
|
|
b.installArtifact(tests);
|
|
}
|