build.zig (958B)
1 const std = @import("std"); 2 3 pub fn build(b: *std.Build) void { 4 const target = b.standardTargetOptions(.{}); 5 const optimize = b.standardOptimizeOption(.{}); 6 7 const exe = b.addExecutable(.{ 8 .name = "server", 9 .root_source_file = .{ .path = "src/main.zig" }, 10 .target = target, 11 .optimize = optimize, 12 }); 13 14 b.installArtifact(exe); 15 const run_cmd = b.addRunArtifact(exe); 16 17 run_cmd.step.dependOn(b.getInstallStep()); 18 19 if (b.args) |args| { 20 run_cmd.addArgs(args); 21 } 22 23 const run_step = b.step("run", "Run the app"); 24 run_step.dependOn(&run_cmd.step); 25 26 const exe_unit_tests = b.addTest(.{ 27 .root_source_file = .{ .path = "src/main.zig" }, 28 .target = target, 29 .optimize = optimize, 30 }); 31 32 const run_exe_unit_tests = b.addRunArtifact(exe_unit_tests); 33 34 const test_step = b.step("test", "Run unit tests"); 35 test_step.dependOn(&run_exe_unit_tests.step); 36 }