Backlog/lib/zmath/build.zig

34 lines
1.0 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 false;
const zmath = bh.MakeModLib(b, .{
.name = "zmath",
.target = target,
.optimize = optimize,
.static_build = static_build,
.root = b.path("zmath.zig"),
});
zmath.install();
const test_step = b.step("test", "runs tests for zmath");
const tests = b.addTest(.{
.root_module = b.createModule(.{
.target = target,
.optimize = optimize,
.root_source_file = b.path("zmath.zig"),
.link_libc = true,
}),
});
tests.root_module.addImport("zmath", zmath.mod);
tests.root_module.linkLibrary(zmath.lib);
const runArtifact = b.addRunArtifact(tests);
test_step.dependOn(&runArtifact.step);
}