Backlog/engine/net/build.zig

38 lines
1.0 KiB
Zig

const std = @import("std");
const core = @import("core");
const depList = [_][]const u8{
"core",
"enet",
};
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 = "net",
.target = target,
.optimize = optimize,
.static_build = static_build,
});
engineMod.install();
engineMod.linkModLibs(&depList);
const test_step = b.step("test", "run unit tests for net");
const tests = b.addTest(.{
.root_module = b.createModule(.{
.target = target,
.optimize = optimize,
.root_source_file = b.path("tests/tests.zig"),
}),
});
tests.root_module.addImport("net", engineMod.mod);
const runArtifact = b.addRunArtifact(tests);
test_step.dependOn(&runArtifact.step);
b.installArtifact(tests);
}