summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorGravatar Vincent Rischmann2021-04-17 18:35:25 +0200
committerGravatar Vincent Rischmann2021-04-17 18:35:25 +0200
commitc7cd24d6414292d9d1adda52ba26aa099bd459a6 (patch)
treecdd04de62b2862caeb56c551456afca017827f93
parentMerge pull request #24 from vrischmann/pragma-arg-string (diff)
downloadzig-sqlite-c7cd24d6414292d9d1adda52ba26aa099bd459a6.tar.gz
zig-sqlite-c7cd24d6414292d9d1adda52ba26aa099bd459a6.tar.xz
zig-sqlite-c7cd24d6414292d9d1adda52ba26aa099bd459a6.zip
make use_bundled work for all targets
We might want to force the use of the bundled source code even when testing all targets.
-rw-r--r--build.zig9
1 files changed, 5 insertions, 4 deletions
diff --git a/build.zig b/build.zig
index 7aff67d..80b5104 100644
--- a/build.zig
+++ b/build.zig
@@ -133,7 +133,7 @@ const all_test_targets = switch (std.Target.current.cpu.arch) {
133pub fn build(b: *std.build.Builder) void { 133pub fn build(b: *std.build.Builder) void {
134 const in_memory = b.option(bool, "in_memory", "Should the tests run with sqlite in memory (default true)") orelse true; 134 const in_memory = b.option(bool, "in_memory", "Should the tests run with sqlite in memory (default true)") orelse true;
135 const dbfile = b.option([]const u8, "dbfile", "Always use this database file instead of a temporary one"); 135 const dbfile = b.option([]const u8, "dbfile", "Always use this database file instead of a temporary one");
136 const use_bundled = b.option(bool, "use_bundled", "Use the bundled sqlite3 source instead of linking the system library (default false)") orelse false; 136 const use_bundled = b.option(bool, "use_bundled", "Use the bundled sqlite3 source instead of linking the system library (default false)");
137 const enable_qemu = b.option(bool, "enable_qemu", "Enable qemu for running tests (default false)") orelse false; 137 const enable_qemu = b.option(bool, "enable_qemu", "Enable qemu for running tests (default false)") orelse false;
138 138
139 const target = b.standardTargetOptions(.{}); 139 const target = b.standardTargetOptions(.{});
@@ -143,16 +143,17 @@ pub fn build(b: *std.build.Builder) void {
143 else 143 else
144 &[_]TestTarget{.{ 144 &[_]TestTarget{.{
145 .target = target, 145 .target = target,
146 .bundled = use_bundled, 146 .bundled = use_bundled orelse false,
147 }}; 147 }};
148 148
149 const test_step = b.step("test", "Run library tests"); 149 const test_step = b.step("test", "Run library tests");
150 for (test_targets) |test_target| { 150 for (test_targets) |test_target| {
151 const cross_target = getTarget(test_target.target, test_target.bundled); 151 const bundled = use_bundled orelse test_target.bundled;
152 const cross_target = getTarget(test_target.target, bundled);
152 153
153 const tests = b.addTest("sqlite.zig"); 154 const tests = b.addTest("sqlite.zig");
154 155
155 if (test_target.bundled) { 156 if (bundled) {
156 const lib = b.addStaticLibrary("sqlite", null); 157 const lib = b.addStaticLibrary("sqlite", null);
157 lib.addCSourceFile("c/sqlite3.c", &[_][]const u8{"-std=c99"}); 158 lib.addCSourceFile("c/sqlite3.c", &[_][]const u8{"-std=c99"});
158 lib.linkLibC(); 159 lib.linkLibC();