@@ -7,41 +7,49 @@ pub fn build(b: *std.Build) void {
77 const target = b .standardTargetOptions (.{});
88 const optimize = b .standardOptimizeOption (.{});
99
10- // Shared library (.so, .dylib, .dll)
11- const lib = b .addSharedLibrary (.{
12- . name = "panel_clades" ,
10+ // Root module shared by the library/test artifacts (Zig 0.15 API).
11+ const root_mod = b .createModule (.{
12+ . link_libc = true ,
1313 .root_source_file = b .path ("src/main.zig" ),
1414 .target = target ,
1515 .optimize = optimize ,
1616 });
1717
18- // Set version
19- lib .version = .{ .major = 0 , .minor = 1 , .patch = 0 };
18+ // Shared library (.so, .dylib, .dll)
19+ const lib = b .addLibrary (.{
20+ .name = "panel_clades" ,
21+ .linkage = .dynamic ,
22+ .root_module = root_mod ,
23+ .version = .{ .major = 0 , .minor = 1 , .patch = 0 },
24+ });
2025
2126 // Static library (.a)
22- const lib_static = b .addStaticLibrary (.{
27+ const lib_static = b .addLibrary (.{
2328 .name = "panel_clades" ,
24- .root_source_file = b .path ("src/main.zig" ),
25- .target = target ,
26- .optimize = optimize ,
29+ .linkage = .static ,
30+ .root_module = root_mod ,
2731 });
2832
2933 // Install artifacts
3034 b .installArtifact (lib );
3135 b .installArtifact (lib_static );
3236
33- // Generate header file for C compatibility
34- const header = b .addInstallHeader (
37+ // Install the C header (Zig 0.15 API).
38+ const header = b .addInstallFileWithDir (
3539 b .path ("include/panel_clades.h" ),
40+ .header ,
3641 "panel_clades.h" ,
3742 );
3843 b .getInstallStep ().dependOn (& header .step );
3944
4045 // Unit tests
4146 const lib_tests = b .addTest (.{
42- .root_source_file = b .path ("src/main.zig" ),
43- .target = target ,
44- .optimize = optimize ,
47+ .root_module = b .createModule (.{
48+ .link_libc = true ,
49+ .root_source_file = b .path ("src/main.zig" ),
50+ .target = target ,
51+ .optimize = optimize ,
52+ }),
4553 });
4654
4755 const run_lib_tests = b .addRunArtifact (lib_tests );
@@ -51,9 +59,12 @@ pub fn build(b: *std.Build) void {
5159
5260 // Integration tests
5361 const integration_tests = b .addTest (.{
54- .root_source_file = b .path ("test/integration_test.zig" ),
55- .target = target ,
56- .optimize = optimize ,
62+ .root_module = b .createModule (.{
63+ .link_libc = true ,
64+ .root_source_file = b .path ("test/integration_test.zig" ),
65+ .target = target ,
66+ .optimize = optimize ,
67+ }),
5768 });
5869
5970 integration_tests .linkLibrary (lib );
@@ -65,9 +76,12 @@ pub fn build(b: *std.Build) void {
6576
6677 // Documentation
6778 const docs = b .addTest (.{
68- .root_source_file = b .path ("src/main.zig" ),
69- .target = target ,
70- .optimize = .Debug ,
79+ .root_module = b .createModule (.{
80+ .link_libc = true ,
81+ .root_source_file = b .path ("src/main.zig" ),
82+ .target = target ,
83+ .optimize = .Debug ,
84+ }),
7185 });
7286
7387 const docs_step = b .step ("docs" , "Generate documentation" );
@@ -80,9 +94,12 @@ pub fn build(b: *std.Build) void {
8094 // Benchmark (if needed)
8195 const bench = b .addExecutable (.{
8296 .name = "panel_clades-bench" ,
83- .root_source_file = b .path ("bench/bench.zig" ),
84- .target = target ,
85- .optimize = .ReleaseFast ,
97+ .root_module = b .createModule (.{
98+ .link_libc = true ,
99+ .root_source_file = b .path ("bench/bench.zig" ),
100+ .target = target ,
101+ .optimize = .ReleaseFast ,
102+ }),
86103 });
87104
88105 bench .linkLibrary (lib );
0 commit comments