48 lines
1.5 KiB
Zig
48 lines
1.5 KiB
Zig
const std = @import("std");
|
|
const core = @import("core");
|
|
|
|
const depList = [_][]const u8{
|
|
"core",
|
|
};
|
|
|
|
// very tiny, not intended to build anything just to run tests linked with libc
|
|
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 engineMod = core.MakeModLib(b, .{
|
|
.name = "physics",
|
|
.target = target,
|
|
.optimize = optimize,
|
|
.static_build = static_build,
|
|
});
|
|
|
|
engineMod.install();
|
|
engineMod.linkModLibs(&depList);
|
|
|
|
const zphysics_dep = b.dependency("zphysics", .{
|
|
.target = target,
|
|
.optimize = optimize,
|
|
.static_build = static_build,
|
|
});
|
|
|
|
engineMod.mod.addImport("zphysics", zphysics_dep.module("root"));
|
|
engineMod.lib.linkLibrary(zphysics_dep.artifact("zphysics"));
|
|
|
|
const test_step = b.step("test", "run unit tests for physics");
|
|
const tests = b.addTest(.{
|
|
.root_module = b.createModule(.{
|
|
.target = target,
|
|
.optimize = optimize,
|
|
.root_source_file = b.path("tests/tests.zig"),
|
|
}),
|
|
});
|
|
|
|
tests.root_module.addImport("physics", engineMod.mod);
|
|
tests.root_module.linkLibrary(zphysics_dep.artifact("zphysics"));
|
|
const runArtifact = b.addRunArtifact(tests);
|
|
test_step.dependOn(&runArtifact.step);
|
|
b.installArtifact(tests);
|
|
}
|