From 163c82287609b0873fc308b71de2a6d3e7a88eec Mon Sep 17 00:00:00 2001 From: Vincent Rischmann Date: Sun, 8 Dec 2024 14:56:17 +0100 Subject: readme: stop supporting using a git submodule The official package manager works fine enough now that I don't wan't to support this use case myself; if people want to use Git submodules they'll have to figure it out themselves. --- README.md | 64 --------------------------------------------------------------- 1 file changed, 64 deletions(-) diff --git a/README.md b/README.md index 39273c3..e6de59e 100644 --- a/README.md +++ b/README.md @@ -119,70 +119,6 @@ deps.addAllTo(exe); This is the easiest way to add `zig-sqlite` because it uses the bundled source code, avoiding all sorts of linking problems. -## Git submodule - -If you don't want to use a package manager you can simply add this repository as a git submodule. - -Then you need to chose if you want to use the system sqlite library or the bundled source code. - -## Using the system sqlite library - -If you want to use the system sqlite library, add the following to your `build.zig` target(s): - -```zig -const sqlite = b.addModule("sqlite", .{ - .root_source_file = b.path("third_party/zig-sqlite/sqlite.zig"), -}); -sqlite.addCSourceFiles(.{ - .files = &[_][]const u8{ - "third_party/zig-sqlite/c/workaround.c", - }, - .flags = &[_][]const u8{"-std=c99"}, -}); -sqlite.addIncludePath(b.path("third_party/sqlite/c")); - -exe.linkLibC(); -exe.linkSystemLibrary("sqlite3"); -exe.root_module.addImport("sqlite", sqlite); -``` - -## Using the bundled sqlite source code file - -If you want to use the bundled sqlite source code file, first you need to add it to the module in your `build.zig` file: - -```zig -const sqlite = b.addModule("sqlite", .{ - .root_source_file = b.path("third_party/zig-sqlite/sqlite.zig"), -}); -sqlite.addCSourceFiles(.{ - .files = &[_][]const u8{ - "third_party/zig-sqlite/c/sqlite3.c", - "third_party/zig-sqlite/c/workaround.c", - }, - .flags = &[_][]const u8{"-std=c99"}, -}); -sqlite.addIncludePath(b.path("third_party/sqlite/c")); - -exe.linkLibC(); -exe.root_module.addImport("sqlite", sqlite); -``` - -If you need to define custom [compile-time options](https://www.sqlite.org/compile.html#overview) for sqlite, modify the flags (second argument to `addCSourceFiles`). - -If you're building with glibc you must make sure that the version used is at least 2.28. - -You can do that in your `build.zig` file: -```zig -var target = b.standardTargetOptions(.{}); -target.setGnuLibCVersion(2, 28, 0); -exe.setTarget(target); -``` - -Or with `-Dtarget`: -``` -$ zig build -Dtarget=native-linux-gnu.2.28 -``` - # Usage ## Demo -- cgit v1.2.3