update to zig 0.14.0 and clay 0.13

This commit is contained in:
johan0A 2025-03-06 22:13:31 +01:00
parent c26ef9d4b6
commit dff7f01dcd
22 changed files with 167 additions and 196 deletions

View file

@ -5,34 +5,28 @@ pub fn build(b: *B) void {
const target = b.standardTargetOptions(.{});
const optimize = b.standardOptimizeOption(.{});
const root_module = b.createModule(.{
.root_source_file = b.path("src/main.zig"),
.target = target,
.optimize = optimize,
});
addDependencies(root_module, b, target, optimize);
{
const exe = b.addExecutable(.{
.name = "zclay-example",
.root_source_file = b.path("src/main.zig"),
.target = target,
.optimize = optimize,
});
addDependencies(exe, b, target, optimize);
const exe = b.addExecutable(.{ .name = "zclay-example", .root_module = root_module });
b.installArtifact(exe);
const run_cmd = b.addRunArtifact(exe);
run_cmd.step.dependOn(b.getInstallStep());
if (b.args) |args| {
run_cmd.addArgs(args);
}
if (b.args) |args| run_cmd.addArgs(args);
const run_step = b.step("run", "Run the app");
run_step.dependOn(&run_cmd.step);
}
{
const exe_unit_tests = b.addTest(.{
.root_source_file = b.path("src/main.zig"),
.target = target,
.optimize = optimize,
});
addDependencies(exe_unit_tests, b, target, optimize);
const exe_unit_tests = b.addTest(.{ .root_module = root_module });
const run_exe_unit_tests = b.addRunArtifact(exe_unit_tests);
const test_step = b.step("test", "Run unit tests");
@ -40,21 +34,8 @@ pub fn build(b: *B) void {
}
{
const exe_check = b.addExecutable(.{
.name = "check",
.root_source_file = b.path("src/main.zig"),
.target = target,
.optimize = optimize,
});
addDependencies(exe_check, b, target, optimize);
const tests_check = b.addTest(.{
.name = "check",
.root_source_file = b.path("src/main.zig"),
.target = target,
.optimize = optimize,
});
addDependencies(tests_check, b, target, optimize);
const exe_check = b.addExecutable(.{ .name = "check", .root_module = root_module });
const tests_check = b.addTest(.{ .name = "check", .root_module = root_module });
const check = b.step("check", "Check if exe and tests compile");
check.dependOn(&exe_check.step);
@ -63,7 +44,7 @@ pub fn build(b: *B) void {
}
fn addDependencies(
compile_step: *B.Step.Compile,
module: *B.Module,
b: *B,
target: B.ResolvedTarget,
optimize: std.builtin.OptimizeMode,
@ -72,15 +53,12 @@ fn addDependencies(
.target = target,
.optimize = optimize,
});
const zclay = zclay_dep.module("zclay");
compile_step.root_module.addImport("zclay", zclay);
module.addImport("zclay", zclay_dep.module("zclay"));
const raylib_dep = b.dependency("raylib-zig", .{
const raylib_dep = b.dependency("raylib_zig", .{
.target = target,
.optimize = optimize,
});
const raylib = raylib_dep.module("raylib");
compile_step.root_module.addImport("raylib", raylib);
const raylib_artifact = raylib_dep.artifact("raylib");
compile_step.linkLibrary(raylib_artifact);
module.addImport("raylib", raylib_dep.module("raylib"));
module.linkLibrary(raylib_dep.artifact("raylib"));
}