const std = @import("std"); const Build = std.Build; pub fn build(b: *Build) void { const target = b.standardTargetOptions(.{}); const optimize = b.standardOptimizeOption(.{}); const options = b.addOptions(); const known_folders = b.dependency("known_folders", .{}).module("known-folders"); const meta = b.createModule(.{ .root_source_file = b.path("src/meta/root.zig"), .target = target, .optimize = optimize, }); const st = b.addModule("st", .{ .root_source_file = b.path("src/st/root.zig"), .target = target, .optimize = optimize, .imports = &.{ .{ .name = "meta", .module = meta }, }, }); const agent = b.addModule("agent", .{ .root_source_file = b.path("src/agent/root.zig"), .target = target, .optimize = optimize, .imports = &.{ .{ .name = "known-folders", .module = known_folders }, // Modules .{ .name = "st", .module = st }, .{ .name = "meta", .module = meta }, }, }); const space = b.createModule(.{ .root_source_file = b.path("src/main.zig"), .target = target, .optimize = optimize, .imports = &.{ .{ .name = "known-folders", .module = known_folders }, // Modules .{ .name = "st", .module = st }, .{ .name = "agent", .module = agent }, .{ .name = "meta", .module = meta }, }, }); space.addOptions("build-options", options); const exe = b.addExecutable(.{ .root_module = space, .name = "space", }); b.installArtifact(exe); const run_cmd = b.addRunArtifact(exe); run_cmd.step.dependOn(b.getInstallStep()); if (b.args) |args| run_cmd.addArgs(args); const run_step = b.step("run", "Run the app"); run_step.dependOn(&run_cmd.step); const test_step = b.step("test", "Run tests"); addTest(b, test_step, "meta tests", meta); addTest(b, test_step, "st tests", st); addTest(b, test_step, "agent tests", agent); } fn addTest(b: *Build, step: *Build.Step, name: []const u8, root_module: *Build.Module) void { const t = b.addTest(.{ .name = name, .root_module = root_module, }); const run_test = b.addRunArtifact(t); step.dependOn(&run_test.step); }