@@ -110,10 +110,15 @@ fn computeTestTargets(isNative: bool, ci: ?bool) ?[]const TestTarget {
110110
111111// This creates a SQLite static library from the SQLite dependency code.
112112fn makeSQLiteLib (b : * std.Build , dep : * std.Build.Dependency , c_flags : []const []const u8 , target : std.Build.ResolvedTarget , optimize : std.builtin.OptimizeMode , sqlite_c : enum { with , without }) * std.Build.Step.Compile {
113- const lib = b .addStaticLibrary (.{
114- .name = "sqlite" ,
113+ const mod = b .addModule ("lib-sqlite" , .{
115114 .target = target ,
116115 .optimize = optimize ,
116+ .link_libc = true ,
117+ });
118+ const lib = b .addLibrary (.{
119+ .name = "sqlite" ,
120+ .linkage = .dynamic ,
121+ .root_module = mod ,
117122 });
118123
119124 lib .addIncludePath (dep .path ("." ));
@@ -128,7 +133,6 @@ fn makeSQLiteLib(b: *std.Build, dep: *std.Build.Dependency, c_flags: []const []c
128133 .file = b .path ("c/workaround.c" ),
129134 .flags = c_flags ,
130135 });
131- lib .linkLibC ();
132136
133137 return lib ;
134138}
@@ -225,13 +229,17 @@ pub fn build(b: *std.Build) !void {
225229
226230 const test_sqlite_lib = makeSQLiteLib (b , sqlite_dep , c_flags , cross_target , optimize , .with );
227231
228- const tests = b .addTest (.{
229- .name = test_name ,
232+ const mod = b .addModule (test_name , .{
230233 .target = cross_target ,
231234 .optimize = optimize ,
232235 .root_source_file = b .path ("sqlite.zig" ),
233236 .single_threaded = test_target .single_threaded ,
234237 });
238+
239+ const tests = b .addTest (.{
240+ .name = test_name ,
241+ .root_module = mod ,
242+ });
235243 tests .addIncludePath (b .path ("c" ));
236244 tests .addIncludePath (sqlite_dep .path ("." ));
237245 tests .linkLibrary (test_sqlite_lib );
@@ -282,13 +290,17 @@ fn addPreprocessStep(b: *std.Build, sqlite_dep: *std.Build.Dependency) void {
282290}
283291
284292fn addZigcrypto (b : * std.Build , sqlite_mod : * std.Build.Module , target : std.Build.ResolvedTarget , optimize : std.builtin.OptimizeMode ) * std.Build.Step.InstallArtifact {
285- const exe = b .addSharedLibrary (.{
286- .name = "zigcrypto" ,
293+ const mod = b .addModule ("zigcryto" , .{
287294 .root_source_file = b .path ("examples/zigcrypto.zig" ),
288- .version = null ,
289295 .target = getTarget (target ),
290296 .optimize = optimize ,
291297 });
298+ const exe = b .addLibrary (.{
299+ .name = "zigcrypto" ,
300+ .root_module = mod ,
301+ .version = null ,
302+ .linkage = .dynamic ,
303+ });
292304 exe .root_module .addImport ("sqlite" , sqlite_mod );
293305
294306 const install_artifact = b .addInstallArtifact (exe , .{});
@@ -298,12 +310,15 @@ fn addZigcrypto(b: *std.Build, sqlite_mod: *std.Build.Module, target: std.Build.
298310}
299311
300312fn addZigcryptoTestRun (b : * std.Build , sqlite_mod : * std.Build.Module , target : std.Build.ResolvedTarget , optimize : std.builtin.OptimizeMode ) * std.Build.Step.Run {
301- const zigcrypto_test = b .addExecutable (.{
302- .name = "zigcrypto-test" ,
313+ const mod = b .addModule ("zigcryto-test" , .{
303314 .root_source_file = b .path ("examples/zigcrypto_test.zig" ),
304315 .target = getTarget (target ),
305316 .optimize = optimize ,
306317 });
318+ const zigcrypto_test = b .addExecutable (.{
319+ .name = "zigcrypto-test" ,
320+ .root_module = mod ,
321+ });
307322 zigcrypto_test .root_module .addImport ("sqlite" , sqlite_mod );
308323
309324 const install = b .addInstallArtifact (zigcrypto_test , .{});
0 commit comments