const std = @import("std"); pub fn build(b: *std.Build) void { const target = b.standardTargetOptions(.{}); const optimize = b.standardOptimizeOption(.{}); const cli_mod = b.addModule("cli", .{ .root_source_file = .{ .path = "cli.zig" } }); const demo_exe = b.addExecutable(.{ .name = "cli-demo", .root_source_file = .{ .path = "demo.zig" }, .optimize = optimize, .target = target, .link_libc = true, }); demo_exe.root_module.addImport("cli", cli_mod); // compile const compile_step = b.step("compile", "Compile demo executable"); compile_step.dependOn(&demo_exe.step); // install b.installArtifact(demo_exe); // run test const run_demo_exe1 = b.addRunArtifact(demo_exe); run_demo_exe1.addArgs(&[_][]const u8{ "-e", "4" }); const run_demo_exe2 = b.addRunArtifact(demo_exe); run_demo_exe2.addArgs(&[_][]const u8{"subexample"}); const unit_tests = b.addTest(.{ .root_source_file = .{ .path = "cli.zig" }, .target = target, .optimize = optimize, }); const run_unit_tests = b.addRunArtifact(unit_tests); const test_step = b.step("test", "Run unit tests"); test_step.dependOn(&run_unit_tests.step); test_step.dependOn(&run_demo_exe1.step); test_step.dependOn(&run_demo_exe2.step); }