libvaxis/build.zig
Tim Culverhouse d22b2a89f3 chore: refactor build
Signed-off-by: Tim Culverhouse <tim@timculverhouse.com>
2024-01-18 20:17:26 -06:00

46 lines
1.3 KiB
Zig

const std = @import("std");
pub fn build(b: *std.Build) void {
const target = b.standardTargetOptions(.{});
const optimize = b.standardOptimizeOption(.{});
const odditui = b.addModule("odditui", .{ .root_source_file = .{ .path = "src/main.zig" } });
const ziglyph = b.dependency("ziglyph", .{
.optimize = optimize,
.target = target,
});
odditui.addImport("ziglyph", ziglyph.module("ziglyph"));
const exe = b.addExecutable(.{
.name = "odditui",
.root_source_file = .{ .path = "examples/main.zig" },
.target = target,
.optimize = optimize,
});
exe.root_module.addImport("odditui", odditui);
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);
// Creates a step for unit testing. This only builds the test executable
// but does not run it.
const lib_unit_tests = b.addTest(.{
.root_source_file = .{ .path = "src/main.zig" },
.target = target,
.optimize = optimize,
});
const run_lib_unit_tests = b.addRunArtifact(lib_unit_tests);
const test_step = b.step("test", "Run unit tests");
test_step.dependOn(&run_lib_unit_tests.step);
}