summaryrefslogtreecommitdiff
path: root/build.zig
diff options
context:
space:
mode:
Diffstat (limited to 'build.zig')
-rw-r--r--build.zig30
1 files changed, 18 insertions, 12 deletions
diff --git a/build.zig b/build.zig
index faa7262..e00e4d9 100644
--- a/build.zig
+++ b/build.zig
@@ -243,12 +243,15 @@ pub fn build(b: *std.Build) !void {
243 .target = cross_target, 243 .target = cross_target,
244 .optimize = optimize, 244 .optimize = optimize,
245 }); 245 });
246 lib.addCSourceFile("c/sqlite3.c", &[_][]const u8{"-std=c99"}); 246 lib.addCSourceFile(.{
247 .file = .{ .path = "c/sqlite3.c" },
248 .flags = &[_][]const u8{"-std=c99"},
249 });
247 lib.linkLibC(); 250 lib.linkLibC();
248 sqlite3 = lib; 251 sqlite3 = lib;
249 } 252 }
250 253
251 if (bundled) tests.addIncludePath("c"); 254 if (bundled) tests.addIncludePath(.{ .path = "c" });
252 linkSqlite(tests); 255 linkSqlite(tests);
253 256
254 const lib = b.addStaticLibrary(.{ 257 const lib = b.addStaticLibrary(.{
@@ -257,7 +260,7 @@ pub fn build(b: *std.Build) !void {
257 .target = cross_target, 260 .target = cross_target,
258 .optimize = optimize, 261 .optimize = optimize,
259 }); 262 });
260 if (bundled) lib.addIncludePath("c"); 263 if (bundled) lib.addIncludePath(.{ .path = "c" });
261 linkSqlite(lib); 264 linkSqlite(lib);
262 265
263 const tests_options = b.addOptions(); 266 const tests_options = b.addOptions();
@@ -276,8 +279,11 @@ pub fn build(b: *std.Build) !void {
276 .target = getTarget(target, true), 279 .target = getTarget(target, true),
277 .optimize = optimize, 280 .optimize = optimize,
278 }); 281 });
279 lib.addCSourceFile("c/sqlite3.c", &[_][]const u8{"-std=c99"}); 282 lib.addCSourceFile(.{
280 lib.addIncludePath("c"); 283 .file = .{ .path = "c/sqlite3.c" },
284 .flags = &[_][]const u8{"-std=c99"},
285 });
286 lib.addIncludePath(.{ .path = "c" });
281 lib.linkLibC(); 287 lib.linkLibC();
282 288
283 // The library 289 // The library
@@ -287,7 +293,7 @@ pub fn build(b: *std.Build) !void {
287 .target = getTarget(target, true), 293 .target = getTarget(target, true),
288 .optimize = optimize, 294 .optimize = optimize,
289 }); 295 });
290 fuzz_lib.addIncludePath("c"); 296 fuzz_lib.addIncludePath(.{ .path = "c" });
291 fuzz_lib.linkLibrary(lib); 297 fuzz_lib.linkLibrary(lib);
292 fuzz_lib.want_lto = true; 298 fuzz_lib.want_lto = true;
293 fuzz_lib.bundle_compiler_rt = true; 299 fuzz_lib.bundle_compiler_rt = true;
@@ -320,14 +326,14 @@ pub fn build(b: *std.Build) !void {
320 .target = getTarget(target, true), 326 .target = getTarget(target, true),
321 .optimize = optimize, 327 .optimize = optimize,
322 }); 328 });
323 fuzz_debug_exe.addIncludePath("c"); 329 fuzz_debug_exe.addIncludePath(.{ .path = "c" });
324 fuzz_debug_exe.linkLibrary(lib); 330 fuzz_debug_exe.linkLibrary(lib);
325 fuzz_debug_exe.addAnonymousModule("sqlite", .{ 331 fuzz_debug_exe.addAnonymousModule("sqlite", .{
326 .source_file = .{ .path = "sqlite.zig" }, 332 .source_file = .{ .path = "sqlite.zig" },
327 }); 333 });
328 334
329 // Only install fuzz-debug when the fuzz step is run 335 // Only install fuzz-debug when the fuzz step is run
330 const install_fuzz_debug_exe = b.addInstallArtifact(fuzz_debug_exe); 336 const install_fuzz_debug_exe = b.addInstallArtifact(fuzz_debug_exe, .{});
331 fuzz_compile_run.dependOn(&install_fuzz_debug_exe.step); 337 fuzz_compile_run.dependOn(&install_fuzz_debug_exe.step);
332 338
333 // 339 //
@@ -346,13 +352,13 @@ pub fn build(b: *std.Build) !void {
346 .optimize = optimize, 352 .optimize = optimize,
347 }); 353 });
348 zigcrypto_loadable_ext.force_pic = true; 354 zigcrypto_loadable_ext.force_pic = true;
349 zigcrypto_loadable_ext.addIncludePath("c"); 355 zigcrypto_loadable_ext.addIncludePath(.{ .path = "c" });
350 zigcrypto_loadable_ext.addAnonymousModule("sqlite", .{ 356 zigcrypto_loadable_ext.addAnonymousModule("sqlite", .{
351 .source_file = .{ .path = "sqlite.zig" }, 357 .source_file = .{ .path = "sqlite.zig" },
352 }); 358 });
353 zigcrypto_loadable_ext.linkLibrary(lib); 359 zigcrypto_loadable_ext.linkLibrary(lib);
354 360
355 const install_zigcrypto_loadable_ext = b.addInstallArtifact(zigcrypto_loadable_ext); 361 const install_zigcrypto_loadable_ext = b.addInstallArtifact(zigcrypto_loadable_ext, .{});
356 362
357 const zigcrypto_test = b.addExecutable(.{ 363 const zigcrypto_test = b.addExecutable(.{
358 .name = "zigcrypto-test", 364 .name = "zigcrypto-test",
@@ -360,13 +366,13 @@ pub fn build(b: *std.Build) !void {
360 .target = getTarget(target, true), 366 .target = getTarget(target, true),
361 .optimize = optimize, 367 .optimize = optimize,
362 }); 368 });
363 zigcrypto_test.addIncludePath("c"); 369 zigcrypto_test.addIncludePath(.{ .path = "c" });
364 zigcrypto_test.addAnonymousModule("sqlite", .{ 370 zigcrypto_test.addAnonymousModule("sqlite", .{
365 .source_file = .{ .path = "sqlite.zig" }, 371 .source_file = .{ .path = "sqlite.zig" },
366 }); 372 });
367 zigcrypto_test.linkLibrary(lib); 373 zigcrypto_test.linkLibrary(lib);
368 374
369 const install_zigcrypto_test = b.addInstallArtifact(zigcrypto_test); 375 const install_zigcrypto_test = b.addInstallArtifact(zigcrypto_test, .{});
370 376
371 const zigcrypto_compile_run = b.step("zigcrypto", "Build the 'zigcrypto' SQLite loadable extension"); 377 const zigcrypto_compile_run = b.step("zigcrypto", "Build the 'zigcrypto' SQLite loadable extension");
372 zigcrypto_compile_run.dependOn(&install_zigcrypto_loadable_ext.step); 378 zigcrypto_compile_run.dependOn(&install_zigcrypto_loadable_ext.step);