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