const std = @import("std"); pub fn build(b: *std.Build) void { const target = b.standardTargetOptions(.{}); const optimize = b.standardOptimizeOption(.{}); const mod = b.addModule("aether", .{ .root_source_file = b.path("src/root.zig"), .target = target, }); const mod_exe = b.createModule(.{ .root_source_file = b.path("src/main.zig"), .target = target, .optimize = optimize, .imports = &.{ .{ .name = "aether", .module = mod }, }, }); const exe = b.addExecutable(.{ .name = "aether", .root_module = mod_exe, }); b.installArtifact(exe); const run_step = b.step("run", "Run the app"); const run_cmd = b.addRunArtifact(exe); run_step.dependOn(&run_cmd.step); run_cmd.step.dependOn(b.getInstallStep()); if (b.args) |args| { run_cmd.addArgs(args); } const test_step = b.step("test", "Run tests"); addTest(b, test_step, mod, "aether"); addTest(b, test_step, mod_exe, "aether-exe"); } fn addTest(b: *std.Build, step: *std.Build.Step, mod: *std.Build.Module, name: ?[]const u8) void { const mod_tests = b.addTest(.{ .root_module = mod, .name = if (name) |n| n else "test", }); const run_mod_tests = b.addRunArtifact(mod_tests); step.dependOn(&run_mod_tests.step); }