This commit is contained in:
Dario48 2026-04-18 22:35:31 +02:00
commit c0f3adda16

View file

@ -4,6 +4,16 @@ pub fn build(b: *std.Build) void {
const target = b.standardTargetOptions(.{});
const optimize = b.standardOptimizeOption(.{});
const raylib_dep = b.dependency("raylib_zig", .{
.target = target,
.optimize = optimize,
.linux_display_backend = .Wayland,
});
const raylib = raylib_dep.module("raylib");
const raygui = raylib_dep.module("raygui");
const raylib_artifact = raylib_dep.artifact("raylib"); // raylib C library
const mod = b.addModule("sand", .{
.root_source_file = b.path("src/root.zig"),
.target = target,
@ -17,36 +27,29 @@ pub fn build(b: *std.Build) void {
.optimize = optimize,
.imports = &.{
.{ .name = "sand", .module = mod },
.{ .name = "raylib", .module = raylib },
.{ .name = "raygui", .module = raygui },
},
}),
});
exe.root_module.linkLibrary(raylib_artifact);
b.installArtifact(exe);
const run_step = b.step("run", "Run the app");
const run_cmd = b.addRunArtifact(exe);
run_step.dependOn(&run_cmd.step);
run_cmd.step.dependOn(b.getInstallStep());
if (b.args) |args| {
run_cmd.addArgs(args);
}
const mod_tests = b.addTest(.{
.root_module = mod,
});
const run_mod_tests = b.addRunArtifact(mod_tests);
const exe_tests = b.addTest(.{
const test_step = b.step("test", "Run tests");
test_step.dependOn(&run_mod_tests.step);
const exe_check = b.addExecutable(.{
.name = "sand",
.root_module = exe.root_module,
});
const run_exe_tests = b.addRunArtifact(exe_tests);
const test_step = b.step("test", "Run tests");
test_step.dependOn(&run_mod_tests.step);
test_step.dependOn(&run_exe_tests.step);
const check = b.step("check", "Check if foo compiles");
check.dependOn(&exe_check.step);
}