summaryrefslogtreecommitdiff
path: root/build.zig
diff options
context:
space:
mode:
Diffstat (limited to 'build.zig')
-rw-r--r--build.zig38
1 files changed, 19 insertions, 19 deletions
diff --git a/build.zig b/build.zig
index b5ab38a..ed064a2 100644
--- a/build.zig
+++ b/build.zig
@@ -123,7 +123,7 @@ pub fn build(b: *std.Build) !void {
123 .optimize = optimize, 123 .optimize = optimize,
124 }); 124 });
125 125
126 sqlite_lib.addIncludePath(.{ .path = "c/" }); 126 sqlite_lib.addIncludePath(b.path("c/"));
127 sqlite_lib.addCSourceFiles(.{ 127 sqlite_lib.addCSourceFiles(.{
128 .files = &[_][]const u8{ 128 .files = &[_][]const u8{
129 "c/sqlite3.c", 129 "c/sqlite3.c",
@@ -132,16 +132,16 @@ pub fn build(b: *std.Build) !void {
132 .flags = c_flags, 132 .flags = c_flags,
133 }); 133 });
134 sqlite_lib.linkLibC(); 134 sqlite_lib.linkLibC();
135 sqlite_lib.installHeader(.{ .path = "c/sqlite3.h" }, "sqlite3.h"); 135 sqlite_lib.installHeader(b.path("c/sqlite3.h"), "sqlite3.h");
136 136
137 b.installArtifact(sqlite_lib); 137 b.installArtifact(sqlite_lib);
138 138
139 // Create the public 'sqlite' module to be exported 139 // Create the public 'sqlite' module to be exported
140 const sqlite_mod = b.addModule("sqlite", .{ 140 const sqlite_mod = b.addModule("sqlite", .{
141 .root_source_file = .{ .path = "sqlite.zig" }, 141 .root_source_file = b.path("sqlite.zig"),
142 .link_libc = true, 142 .link_libc = true,
143 }); 143 });
144 sqlite_mod.addIncludePath(.{ .path = "c/" }); 144 sqlite_mod.addIncludePath(b.path("c/"));
145 sqlite_mod.linkLibrary(sqlite_lib); 145 sqlite_mod.linkLibrary(sqlite_lib);
146 146
147 // Tool to preprocess the sqlite header files. 147 // Tool to preprocess the sqlite header files.
@@ -151,7 +151,7 @@ pub fn build(b: *std.Build) !void {
151 151
152 const preprocess_files_tool = b.addExecutable(.{ 152 const preprocess_files_tool = b.addExecutable(.{
153 .name = "preprocess-files", 153 .name = "preprocess-files",
154 .root_source_file = .{ .path = "tools/preprocess_files.zig" }, 154 .root_source_file = b.path("tools/preprocess_files.zig"),
155 .target = getTarget(target, true), 155 .target = getTarget(target, true),
156 .optimize = optimize, 156 .optimize = optimize,
157 }); 157 });
@@ -201,15 +201,15 @@ pub fn build(b: *std.Build) !void {
201 .name = test_name, 201 .name = test_name,
202 .target = cross_target, 202 .target = cross_target,
203 .optimize = optimize, 203 .optimize = optimize,
204 .root_source_file = .{ .path = "sqlite.zig" }, 204 .root_source_file = b.path("sqlite.zig"),
205 .single_threaded = test_target.single_threaded, 205 .single_threaded = test_target.single_threaded,
206 }); 206 });
207 tests.addIncludePath(.{ .path = "c" }); 207 tests.addIncludePath(b.path("c"));
208 if (bundled) { 208 if (bundled) {
209 tests.linkLibrary(test_sqlite_lib); 209 tests.linkLibrary(test_sqlite_lib);
210 } else { 210 } else {
211 tests.linkLibC(); 211 tests.linkLibC();
212 tests.addCSourceFile(.{ .file = .{ .path = "c/workaround.c" }, .flags = c_flags }); 212 tests.addCSourceFile(.{ .file = b.path("c/workaround.c"), .flags = c_flags });
213 tests.linkSystemLibrary("sqlite3"); 213 tests.linkSystemLibrary("sqlite3");
214 } 214 }
215 215
@@ -230,18 +230,18 @@ pub fn build(b: *std.Build) !void {
230 .target = getTarget(target, true), 230 .target = getTarget(target, true),
231 .optimize = optimize, 231 .optimize = optimize,
232 }); 232 });
233 lib.addCSourceFile(.{ .file = .{ .path = "c/sqlite3.c" }, .flags = c_flags }); 233 lib.addCSourceFile(.{ .file = b.path("c/sqlite3.c"), .flags = c_flags });
234 lib.addIncludePath(.{ .path = "c" }); 234 lib.addIncludePath(b.path("c"));
235 lib.linkLibC(); 235 lib.linkLibC();
236 236
237 // The library 237 // The library
238 const fuzz_lib = b.addStaticLibrary(.{ 238 const fuzz_lib = b.addStaticLibrary(.{
239 .name = "fuzz-lib", 239 .name = "fuzz-lib",
240 .root_source_file = .{ .path = "fuzz/main.zig" }, 240 .root_source_file = b.path("fuzz/main.zig"),
241 .target = getTarget(target, true), 241 .target = getTarget(target, true),
242 .optimize = optimize, 242 .optimize = optimize,
243 }); 243 });
244 fuzz_lib.addIncludePath(.{ .path = "c" }); 244 fuzz_lib.addIncludePath(b.path("c"));
245 fuzz_lib.linkLibrary(lib); 245 fuzz_lib.linkLibrary(lib);
246 fuzz_lib.want_lto = true; 246 fuzz_lib.want_lto = true;
247 fuzz_lib.bundle_compiler_rt = true; 247 fuzz_lib.bundle_compiler_rt = true;
@@ -257,7 +257,7 @@ pub fn build(b: *std.Build) !void {
257 fuzz_compile.addArtifactArg(fuzz_lib); 257 fuzz_compile.addArtifactArg(fuzz_lib);
258 258
259 // Install the cached output to the install 'bin' path 259 // Install the cached output to the install 'bin' path
260 const fuzz_install = b.addInstallBinFile(.{ .path = fuzz_exe_path }, fuzz_executable_name); 260 const fuzz_install = b.addInstallBinFile(.{ .cwd_relative = fuzz_exe_path }, fuzz_executable_name);
261 261
262 // Add a top-level step that compiles and installs the fuzz executable 262 // Add a top-level step that compiles and installs the fuzz executable
263 const fuzz_compile_run = b.step("fuzz", "Build executable for fuzz testing using afl-clang-lto"); 263 const fuzz_compile_run = b.step("fuzz", "Build executable for fuzz testing using afl-clang-lto");
@@ -268,11 +268,11 @@ pub fn build(b: *std.Build) !void {
268 // Compile a companion exe for debugging crashes 268 // Compile a companion exe for debugging crashes
269 const fuzz_debug_exe = b.addExecutable(.{ 269 const fuzz_debug_exe = b.addExecutable(.{
270 .name = "fuzz-debug", 270 .name = "fuzz-debug",
271 .root_source_file = .{ .path = "fuzz/main.zig" }, 271 .root_source_file = b.path("fuzz/main.zig"),
272 .target = getTarget(target, true), 272 .target = getTarget(target, true),
273 .optimize = optimize, 273 .optimize = optimize,
274 }); 274 });
275 fuzz_debug_exe.addIncludePath(.{ .path = "c" }); 275 fuzz_debug_exe.addIncludePath(b.path("c"));
276 fuzz_debug_exe.linkLibrary(lib); 276 fuzz_debug_exe.linkLibrary(lib);
277 fuzz_debug_exe.root_module.addImport("sqlite", sqlite_mod); 277 fuzz_debug_exe.root_module.addImport("sqlite", sqlite_mod);
278 278
@@ -290,12 +290,12 @@ pub fn build(b: *std.Build) !void {
290 290
291 const zigcrypto_loadable_ext = b.addSharedLibrary(.{ 291 const zigcrypto_loadable_ext = b.addSharedLibrary(.{
292 .name = "zigcrypto", 292 .name = "zigcrypto",
293 .root_source_file = .{ .path = "examples/zigcrypto.zig" }, 293 .root_source_file = b.path("examples/zigcrypto.zig"),
294 .version = null, 294 .version = null,
295 .target = getTarget(target, true), 295 .target = getTarget(target, true),
296 .optimize = optimize, 296 .optimize = optimize,
297 }); 297 });
298 zigcrypto_loadable_ext.addIncludePath(.{ .path = "c" }); 298 zigcrypto_loadable_ext.addIncludePath(b.path("c"));
299 zigcrypto_loadable_ext.root_module.addImport("sqlite", sqlite_mod); 299 zigcrypto_loadable_ext.root_module.addImport("sqlite", sqlite_mod);
300 zigcrypto_loadable_ext.linkLibrary(lib); 300 zigcrypto_loadable_ext.linkLibrary(lib);
301 301
@@ -303,11 +303,11 @@ pub fn build(b: *std.Build) !void {
303 303
304 const zigcrypto_test = b.addExecutable(.{ 304 const zigcrypto_test = b.addExecutable(.{
305 .name = "zigcrypto-test", 305 .name = "zigcrypto-test",
306 .root_source_file = .{ .path = "examples/zigcrypto_test.zig" }, 306 .root_source_file = b.path("examples/zigcrypto_test.zig"),
307 .target = getTarget(target, true), 307 .target = getTarget(target, true),
308 .optimize = optimize, 308 .optimize = optimize,
309 }); 309 });
310 zigcrypto_test.addIncludePath(.{ .path = "c" }); 310 zigcrypto_test.addIncludePath(b.path("c"));
311 zigcrypto_test.root_module.addImport("sqlite", sqlite_mod); 311 zigcrypto_test.root_module.addImport("sqlite", sqlite_mod);
312 zigcrypto_test.linkLibrary(lib); 312 zigcrypto_test.linkLibrary(lib);
313 313