From f4bffc292b5b07e79cefac3870a9dee4924035a6 Mon Sep 17 00:00:00 2001 From: Jonas Everaert Date: Mon, 15 Dec 2025 15:55:48 +0100 Subject: [PATCH 1/2] change build script for zig 0.15 --- build.zig | 27 +++++++++++++++------------ 1 file changed, 15 insertions(+), 12 deletions(-) diff --git a/build.zig b/build.zig index 8a4b29d..ad6cddb 100644 --- a/build.zig +++ b/build.zig @@ -4,24 +4,31 @@ pub fn build(b: *std.Build) void { const target = b.standardTargetOptions(.{}); const optimize = b.standardOptimizeOption(.{}); - _ = b.addModule("chroma", .{ .root_source_file = .{ .src_path = .{ .owner = b, .sub_path = "src/lib.zig" } } }); - - const lib = b.addStaticLibrary(.{ - .name = "chroma", + const mod = b.addModule("chroma", .{ .root_source_file = .{ .src_path = .{ .owner = b, .sub_path = "src/lib.zig" } }, .target = target, .optimize = optimize, }); + const lib = b.addLibrary(.{ + .name = "chroma", + .linkage = .static, + .root_module = mod, + }); + b.installArtifact(lib); - const exe = b.addExecutable(.{ - .name = "chroma", + const exe_mod = b.addModule("chroma", .{ .root_source_file = .{ .src_path = .{ .owner = b, .sub_path = "src/main.zig" } }, .target = target, .optimize = optimize, }); + const exe = b.addExecutable(.{ + .name = "chroma", + .root_module = exe_mod, + }); + b.installArtifact(exe); const run_cmd = b.addRunArtifact(exe); @@ -36,17 +43,13 @@ pub fn build(b: *std.Build) void { run_step.dependOn(&run_cmd.step); const lib_unit_tests = b.addTest(.{ - .root_source_file = .{ .src_path = .{ .owner = b, .sub_path = "src/lib.zig" } }, - .target = target, - .optimize = optimize, + .root_module = mod, }); const run_lib_unit_tests = b.addRunArtifact(lib_unit_tests); const exe_unit_tests = b.addTest(.{ - .root_source_file = .{ .src_path = .{ .owner = b, .sub_path = "src/main.zig" } }, - .target = target, - .optimize = optimize, + .root_module = exe_mod, }); const run_exe_unit_tests = b.addRunArtifact(exe_unit_tests); From e4769de137b2efdf94dcce98b1ab7ef78f984606 Mon Sep 17 00:00:00 2001 From: Jonas Everaert Date: Mon, 15 Dec 2025 16:07:54 +0100 Subject: [PATCH 2/2] change exe mod name --- build.zig | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/build.zig b/build.zig index ad6cddb..4c67520 100644 --- a/build.zig +++ b/build.zig @@ -18,7 +18,7 @@ pub fn build(b: *std.Build) void { b.installArtifact(lib); - const exe_mod = b.addModule("chroma", .{ + const exe_mod = b.addModule("chroma-exe", .{ .root_source_file = .{ .src_path = .{ .owner = b, .sub_path = "src/main.zig" } }, .target = target, .optimize = optimize,