summaryrefslogtreecommitdiff
path: root/build.zig
diff options
context:
space:
mode:
authorGabriel A. Giovanini <mail@gabrielgio.me>2024-07-19 00:01:55 +0200
committerGabriel A. Giovanini <mail@gabrielgio.me>2024-07-19 00:01:55 +0200
commit5d391ac3c3bf0ffc02e5f6eae00db949810346b3 (patch)
treea086b976b53c8af23b960f57a64f8e66f00c35ed /build.zig
downloaduf-5d391ac3c3bf0ffc02e5f6eae00db949810346b3.tar.gz
uf-5d391ac3c3bf0ffc02e5f6eae00db949810346b3.tar.bz2
uf-5d391ac3c3bf0ffc02e5f6eae00db949810346b3.zip
feat: Initial setup
Diffstat (limited to 'build.zig')
-rw-r--r--build.zig42
1 files changed, 42 insertions, 0 deletions
diff --git a/build.zig b/build.zig
new file mode 100644
index 0000000..17d4fb7
--- /dev/null
+++ b/build.zig
@@ -0,0 +1,42 @@
+const std = @import("std");
+
+pub fn build(b: *std.Build) void {
+ const target = b.standardTargetOptions(.{});
+
+ const optimize = b.standardOptimizeOption(.{
+ .preferred_optimize_mode = std.builtin.OptimizeMode.ReleaseFast,
+ });
+
+ const exe = b.addExecutable(.{
+ .name = "uf",
+ .root_source_file = b.path("src/main.zig"),
+ .target = target,
+ .optimize = optimize,
+ .single_threaded = true,
+ .strip = true,
+ });
+
+ 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 exe_unit_tests = b.addTest(.{
+ .root_source_file = b.path("src/main.zig"),
+ .target = target,
+ .optimize = optimize,
+ });
+
+ const run_exe_unit_tests = b.addRunArtifact(exe_unit_tests);
+
+ const test_step = b.step("test", "Run unit tests");
+ test_step.dependOn(&run_exe_unit_tests.step);
+}