summaryrefslogtreecommitdiff
path: root/build.zig
diff options
context:
space:
mode:
authorGravatar Vincent Rischmann2022-09-17 20:33:33 +0200
committerGravatar Vincent Rischmann2022-09-18 02:30:19 +0200
commitd8aba28118ddf754d984d25bac1718e10cf54d94 (patch)
treef487d497e4f8d57622e35b45c94517680c7f1e51 /build.zig
parentadd wrapper functions when building a loadable extension (diff)
downloadzig-sqlite-d8aba28118ddf754d984d25bac1718e10cf54d94.tar.gz
zig-sqlite-d8aba28118ddf754d984d25bac1718e10cf54d94.tar.xz
zig-sqlite-d8aba28118ddf754d984d25bac1718e10cf54d94.zip
build: add the zigcrypto loadable extension
Diffstat (limited to '')
-rw-r--r--build.zig34
1 files changed, 34 insertions, 0 deletions
diff --git a/build.zig b/build.zig
index 71417e2..74e681f 100644
--- a/build.zig
+++ b/build.zig
@@ -262,6 +262,7 @@ pub fn build(b: *std.build.Builder) !void {
262 262
263 const lib = b.addStaticLibrary("sqlite", null); 263 const lib = b.addStaticLibrary("sqlite", null);
264 lib.addCSourceFile("c/sqlite3.c", &[_][]const u8{"-std=c99"}); 264 lib.addCSourceFile("c/sqlite3.c", &[_][]const u8{"-std=c99"});
265 lib.addIncludePath("c");
265 lib.linkLibC(); 266 lib.linkLibC();
266 lib.setBuildMode(mode); 267 lib.setBuildMode(mode);
267 lib.setTarget(getTarget(target, true)); 268 lib.setTarget(getTarget(target, true));
@@ -307,4 +308,37 @@ pub fn build(b: *std.build.Builder) !void {
307 // Only install fuzz-debug when the fuzz step is run 308 // Only install fuzz-debug when the fuzz step is run
308 const install_fuzz_debug_exe = b.addInstallArtifact(fuzz_debug_exe); 309 const install_fuzz_debug_exe = b.addInstallArtifact(fuzz_debug_exe);
309 fuzz_compile_run.dependOn(&install_fuzz_debug_exe.step); 310 fuzz_compile_run.dependOn(&install_fuzz_debug_exe.step);
311
312 //
313 // Examples
314 //
315
316 // Loadable extension
317 //
318 // This builds an example shared library with the extension and a binary that tests it.
319
320 const zigcrypto_loadable_ext = b.addSharedLibrary("zigcrypto", "examples/zigcrypto.zig", .unversioned);
321 zigcrypto_loadable_ext.force_pic = true;
322 zigcrypto_loadable_ext.use_stage1 = true;
323 zigcrypto_loadable_ext.addIncludePath("c");
324 zigcrypto_loadable_ext.setBuildMode(mode);
325 zigcrypto_loadable_ext.setTarget(getTarget(target, true));
326 zigcrypto_loadable_ext.addPackagePath("sqlite", "sqlite.zig");
327 zigcrypto_loadable_ext.linkLibrary(lib);
328
329 const install_zigcrypto_loadable_ext = b.addInstallArtifact(zigcrypto_loadable_ext);
330
331 const zigcrypto_test = b.addExecutable("zigcrypto-test", "examples/zigcrypto_test.zig");
332 zigcrypto_test.use_stage1 = true;
333 zigcrypto_test.addIncludePath("c");
334 zigcrypto_test.setBuildMode(mode);
335 zigcrypto_test.setTarget(getTarget(target, true));
336 zigcrypto_test.addPackagePath("sqlite", "sqlite.zig");
337 zigcrypto_test.linkLibrary(lib);
338
339 const install_zigcrypto_test = b.addInstallArtifact(zigcrypto_test);
340
341 const zigcrypto_compile_run = b.step("zigcrypto", "Build the 'zigcrypto' SQLite loadable extension");
342 zigcrypto_compile_run.dependOn(&install_zigcrypto_loadable_ext.step);
343 zigcrypto_compile_run.dependOn(&install_zigcrypto_test.step);
310} 344}