From 76b8fd82237ca543b586d840b9a22b9ceb8abf34 Mon Sep 17 00:00:00 2001 From: Robert Guthrie Date: Wed, 24 Apr 2024 15:52:43 +1200 Subject: [PATCH] Update readme.md This is a very poor update to the readme, sorry. The zig build system has changed and I've not updated the original build instructions to accomodate for this. I've just added a code snippet with build.zig code that worked for me. --- readme.md | 18 ++++++++++++++++-- 1 file changed, 16 insertions(+), 2 deletions(-) diff --git a/readme.md b/readme.md index 590d881..9ac7618 100644 --- a/readme.md +++ b/readme.md @@ -42,7 +42,21 @@ Add into `dependencies` of `build.zig.zon`: }, ``` -The library doesn't attempt to link/include SQLite. You're free to do this how you want. If you download the SQLite amalgamation from [the SQLite download page](https://www.sqlite.org/download.html) and place the `sqlite.c` and `sqlite.h` file in your project's `lib/sqlite3/` folder, you can then: +The library doesn't attempt to link/include SQLite. You're free to do this how you want. + +If you have sqlite3 installed on your system you might get away with just adding this to your build.zig + +```zig + const zqlite = b.dependency("zqlite", .{ + .target = target, + .optimize = optimize, + }); + + exe.linkSystemLibrary("sqlite3"); + exe.root_module.addImport("zqlite", zqlite.module("zqlite")); +``` + +Alternatively, If you download the SQLite amalgamation from [the SQLite download page](https://www.sqlite.org/download.html) and place the `sqlite.c` and `sqlite.h` file in your project's `lib/sqlite3/` folder, you can then: 2) Add this in `build.zig`: ```zig @@ -73,7 +87,7 @@ zqlite.addCSourceFile(.{ }, }); zqlite.addIncludePath(LazyPath.relative("lib/sqlite3/")); -exe.root_module.addImport("zqlite", zqlite); +exe.root_module.addImport("zqlite", zqlite.module("zqlite")); ``` You can tweak the SQLite build flags for your own needs/platform.