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 packer = bh.MakeModLib(b, .{ .name = "packer", .target = target, .optimize = optimize, .static_build = static_build, .root = b.path("src/packer.zig"), }); packer.install(); const p2dep = b.dependency("p2", .{ .target = target, .optimize = optimize, .static_build = static_build }); const p2mod = p2dep.module("p2"); packer.mod.addImport("p2", p2mod); const test_exe = b.addTest(.{ .root_module = b.createModule(.{ .target = target, .optimize = optimize, .root_source_file = b.path("tests/test.zig"), }), }); test_exe.root_module.addImport("packer", packer.mod); test_exe.root_module.linkLibrary(packer.lib); test_exe.root_module.addImport("p2", p2mod); const test_step = b.step("test", "runs sample unit tests for packer"); test_step.dependOn(&b.addRunArtifact(test_exe).step); b.installArtifact(test_exe); }