49 lines
1.6 KiB
Zig
49 lines
1.6 KiB
Zig
const std = @import("std");
|
|
const sdl3 = @import("sdl3");
|
|
|
|
const dependencyList = [_][]const u8{
|
|
"core",
|
|
"platform",
|
|
"rend",
|
|
"papyrus",
|
|
"shaderTypes",
|
|
"sdl3",
|
|
};
|
|
|
|
pub fn build(b: *std.Build) void {
|
|
const target = b.standardTargetOptions(.{});
|
|
const optimize = b.standardOptimizeOption(.{});
|
|
|
|
const mod = b.addModule("ui", .{
|
|
.target = target,
|
|
.optimize = optimize,
|
|
.root_source_file = b.path("src/ui.zig"),
|
|
});
|
|
|
|
for (dependencyList) |depName| {
|
|
const dep = b.dependency(depName, .{ .target = target, .optimize = optimize });
|
|
const dep_mod = dep.module(depName);
|
|
mod.addImport(depName, dep_mod);
|
|
}
|
|
|
|
// shaders
|
|
sdl3.shaderDefintion(b, mod, "../../lib/sdl3", target, optimize, "rect.vert", b.path("shaders/rect.vert.json"));
|
|
sdl3.shaderDefintion(b, mod, "../../lib/sdl3", target, optimize, "rect.frag", b.path("shaders/rect.frag.json"));
|
|
|
|
sdl3.shaderDefintion(b, mod, "../../lib/sdl3", target, optimize, "text.vert", b.path("shaders/text.vert.json"));
|
|
sdl3.shaderDefintion(b, mod, "../../lib/sdl3", target, optimize, "text.frag", b.path("shaders/text.frag.json"));
|
|
|
|
// ========== tests ==========
|
|
const tests = b.addTest(.{
|
|
.target = target,
|
|
.optimize = optimize,
|
|
.root_source_file = b.path("tests/tests.zig"),
|
|
});
|
|
const test_step = b.step("test", "run unit tests for ui");
|
|
|
|
tests.root_module.addImport("ui", mod);
|
|
const runArtifact = b.addRunArtifact(tests);
|
|
test_step.dependOn(&runArtifact.step);
|
|
b.installArtifact(tests);
|
|
}
|