Skip to content

Commit b939b24

Browse files
authored
Merge pull request #4 from Jomy10/main
Fixes for zig 0.15
2 parents ba49abb + e4769de commit b939b24

File tree

1 file changed

+15
-12
lines changed

1 file changed

+15
-12
lines changed

build.zig

Lines changed: 15 additions & 12 deletions
Original file line numberDiff line numberDiff line change
@@ -4,24 +4,31 @@ pub fn build(b: *std.Build) void {
44
const target = b.standardTargetOptions(.{});
55
const optimize = b.standardOptimizeOption(.{});
66

7-
_ = b.addModule("chroma", .{ .root_source_file = .{ .src_path = .{ .owner = b, .sub_path = "src/lib.zig" } } });
8-
9-
const lib = b.addStaticLibrary(.{
10-
.name = "chroma",
7+
const mod = b.addModule("chroma", .{
118
.root_source_file = .{ .src_path = .{ .owner = b, .sub_path = "src/lib.zig" } },
129
.target = target,
1310
.optimize = optimize,
1411
});
1512

13+
const lib = b.addLibrary(.{
14+
.name = "chroma",
15+
.linkage = .static,
16+
.root_module = mod,
17+
});
18+
1619
b.installArtifact(lib);
1720

18-
const exe = b.addExecutable(.{
19-
.name = "chroma",
21+
const exe_mod = b.addModule("chroma-exe", .{
2022
.root_source_file = .{ .src_path = .{ .owner = b, .sub_path = "src/main.zig" } },
2123
.target = target,
2224
.optimize = optimize,
2325
});
2426

27+
const exe = b.addExecutable(.{
28+
.name = "chroma",
29+
.root_module = exe_mod,
30+
});
31+
2532
b.installArtifact(exe);
2633

2734
const run_cmd = b.addRunArtifact(exe);
@@ -36,17 +43,13 @@ pub fn build(b: *std.Build) void {
3643
run_step.dependOn(&run_cmd.step);
3744

3845
const lib_unit_tests = b.addTest(.{
39-
.root_source_file = .{ .src_path = .{ .owner = b, .sub_path = "src/lib.zig" } },
40-
.target = target,
41-
.optimize = optimize,
46+
.root_module = mod,
4247
});
4348

4449
const run_lib_unit_tests = b.addRunArtifact(lib_unit_tests);
4550

4651
const exe_unit_tests = b.addTest(.{
47-
.root_source_file = .{ .src_path = .{ .owner = b, .sub_path = "src/main.zig" } },
48-
.target = target,
49-
.optimize = optimize,
52+
.root_module = exe_mod,
5053
});
5154

5255
const run_exe_unit_tests = b.addRunArtifact(exe_unit_tests);

0 commit comments

Comments
 (0)