const std = @import("std"); const Coverage = @import("build/Coverage.zig"); pub fn build(b: *std.Build) void { const target = b.standardTargetOptions(.{}); const optimize = b.standardOptimizeOption(.{}); const srf_dep = b.dependency("srf", .{ .target = target, .optimize = optimize, }); const srf_mod = srf_dep.module("srf"); const zfin_dep = b.dependency("zfin", .{ .target = target, .optimize = optimize, }); const imports: []const std.Build.Module.Import = &.{ .{ .name = "srf", .module = srf_mod }, .{ .name = "zfin", .module = zfin_dep.module("zfin") }, }; const exe_mod = b.createModule(.{ .root_source_file = b.path("src/main.zig"), .target = target, .optimize = optimize, .imports = imports, }); const exe = b.addExecutable(.{ .name = "zfin-vestwell", .root_module = exe_mod, }); b.installArtifact(exe); const run_cmd = b.addRunArtifact(exe); run_cmd.step.dependOn(b.getInstallStep()); if (b.args) |args| run_cmd.addArgs(args); b.step("run", "Build and run the CLI").dependOn(&run_cmd.step); const test_mod = b.createModule(.{ .root_source_file = b.path("src/main.zig"), .target = target, .optimize = optimize, .imports = imports, }); const unit_tests = b.addTest(.{ .root_module = test_mod }); const run_tests = b.addRunArtifact(unit_tests); b.step("test", "Run all tests").dependOn(&run_tests.step); // Coverage: `zig build coverage -Dcoverage-threshold=N` (kcov, Linux only). // kcov is downloaded into the zig cache on first use. { var cov = Coverage.init(b); const cov_mod = b.createModule(.{ .root_source_file = b.path("src/main.zig"), .target = target, .optimize = optimize, .imports = imports, }); _ = cov.addModule(cov_mod, "zfin-vestwell"); } }