2024-01-18 04:52:33 +01:00
|
|
|
const std = @import("std");
|
|
|
|
|
|
|
|
pub fn build(b: *std.Build) void {
|
|
|
|
const target = b.standardTargetOptions(.{});
|
|
|
|
const optimize = b.standardOptimizeOption(.{});
|
|
|
|
|
2024-01-19 17:13:32 +01:00
|
|
|
const vaxis = b.addModule("vaxis", .{ .root_source_file = .{ .path = "src/main.zig" } });
|
2024-01-19 03:17:26 +01:00
|
|
|
|
2024-01-18 04:52:33 +01:00
|
|
|
const ziglyph = b.dependency("ziglyph", .{
|
|
|
|
.optimize = optimize,
|
|
|
|
.target = target,
|
|
|
|
});
|
2024-01-19 17:13:32 +01:00
|
|
|
vaxis.addImport("ziglyph", ziglyph.module("ziglyph"));
|
2024-01-18 04:52:33 +01:00
|
|
|
|
2024-01-25 20:20:32 +01:00
|
|
|
const zigimg = b.dependency("zigimg", .{
|
|
|
|
.optimize = optimize,
|
|
|
|
.target = target,
|
|
|
|
});
|
|
|
|
vaxis.addImport("zigimg", zigimg.module("zigimg"));
|
|
|
|
|
2024-01-18 04:52:33 +01:00
|
|
|
const exe = b.addExecutable(.{
|
2024-01-19 17:13:32 +01:00
|
|
|
.name = "vaxis",
|
2024-01-31 19:50:00 +01:00
|
|
|
.root_source_file = .{ .path = "examples/text_input.zig" },
|
2024-01-18 04:52:33 +01:00
|
|
|
.target = target,
|
|
|
|
.optimize = optimize,
|
|
|
|
});
|
2024-01-19 17:13:32 +01:00
|
|
|
exe.root_module.addImport("vaxis", vaxis);
|
2024-01-18 04:52:33 +01:00
|
|
|
|
|
|
|
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,
|
|
|
|
});
|
2024-01-21 23:11:51 +01:00
|
|
|
lib_unit_tests.root_module.addImport("ziglyph", ziglyph.module("ziglyph"));
|
2024-01-25 20:20:32 +01:00
|
|
|
lib_unit_tests.root_module.addImport("zigimg", zigimg.module("zigimg"));
|
2024-01-18 04:52:33 +01:00
|
|
|
|
2024-01-19 03:17:26 +01:00
|
|
|
const run_lib_unit_tests = b.addRunArtifact(lib_unit_tests);
|
2024-01-18 04:52:33 +01:00
|
|
|
|
|
|
|
const test_step = b.step("test", "Run unit tests");
|
|
|
|
test_step.dependOn(&run_lib_unit_tests.step);
|
|
|
|
}
|