diff options
Diffstat (limited to '')
| -rw-r--r-- | build.zig | 9 |
1 files changed, 5 insertions, 4 deletions
| @@ -133,7 +133,7 @@ const all_test_targets = switch (std.Target.current.cpu.arch) { | |||
| 133 | pub fn build(b: *std.build.Builder) void { | 133 | pub 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(); |