const std = @import("std"); 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 mod = b.addModule("net", .{ .target = target, .optimize = optimize, .root_source_file = b.path("src/net.zig"), }); for (depList) |depName| { const dep = b.dependency(depName, .{ .target = target, .optimize = optimize, .static_build = static_build }); mod.addImport(depName, dep.module(depName)); } 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", mod); const runArtifact = b.addRunArtifact(tests); test_step.dependOn(&runArtifact.step); b.installArtifact(tests); }