about summary refs log tree commit diff
path: root/build.zig
diff options
context:
space:
mode:
authoriurii plugatarov <[email protected]>2024-07-28 21:07:00 +0200
committeriurii plugatarov <[email protected]>2024-07-28 21:07:00 +0200
commita679ae0a00adc299ab89efb69fad44ebab777d35 (patch)
tree243d4ce9ea0effe6fcf89e61cee80b10b562925d /build.zig
downloaddsazitty-a679ae0a00adc299ab89efb69fad44ebab777d35.tar.gz
init
Diffstat (limited to 'build.zig')
-rw-r--r--build.zig51
1 files changed, 51 insertions, 0 deletions
diff --git a/build.zig b/build.zig
new file mode 100644
index 0000000..ad5ad10
--- /dev/null
+++ b/build.zig
@@ -0,0 +1,51 @@
+const std = @import("std");
+pub fn build(b: *std.Build) void {
+    const target = b.standardTargetOptions(.{});
+    const optimize = b.standardOptimizeOption(.{});
+
+    const lib = b.addStaticLibrary(.{
+        .name = "dsazitty",
+        .root_source_file = b.path("src/root.zig"),
+        .target = target,
+        .optimize = optimize,
+    });
+
+    b.installArtifact(lib);
+
+    const exe = b.addExecutable(.{
+        .name = "dsazitty",
+        .root_source_file = b.path("src/main.zig"),
+        .target = target,
+        .optimize = optimize,
+    });
+
+    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 lib_unit_tests = b.addTest(.{
+        .root_source_file = b.path("src/root.zig"),
+        .target = target,
+        .optimize = optimize,
+    });
+
+    const run_lib_unit_tests = b.addRunArtifact(lib_unit_tests);
+
+    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_lib_unit_tests.step);
+    test_step.dependOn(&run_exe_unit_tests.step);
+}