summaryrefslogtreecommitdiff
path: root/README.md
diff options
context:
space:
mode:
Diffstat (limited to 'README.md')
-rw-r--r--README.md24
1 files changed, 19 insertions, 5 deletions
diff --git a/README.md b/README.md
index 40c8d0c..d338331 100644
--- a/README.md
+++ b/README.md
@@ -136,7 +136,9 @@ If you want to use the system sqlite library, add the following to your `build.z
136```zig 136```zig
137exe.linkLibC(); 137exe.linkLibC();
138exe.linkSystemLibrary("sqlite3"); 138exe.linkSystemLibrary("sqlite3");
139exe.addPackage(.{ .name = "sqlite", .path = "third_party/zig-sqlite/sqlite.zig" }); 139exe.addAnonymousModule("sqlite", .{
140 .source_file = .{ .path = "third_party/zig-sqlite/sqlite.zig" },
141});
140``` 142```
141 143
142## Using the bundled sqlite source code file 144## Using the bundled sqlite source code file
@@ -144,8 +146,18 @@ exe.addPackage(.{ .name = "sqlite", .path = "third_party/zig-sqlite/sqlite.zig"
144If you want to use the bundled sqlite source code file, first you need to add it as a static library in your `build.zig` file: 146If you want to use the bundled sqlite source code file, first you need to add it as a static library in your `build.zig` file:
145 147
146```zig 148```zig
147const sqlite = b.addStaticLibrary("sqlite", null); 149const sqlite = b.addStaticLibrary(.{
148sqlite.addCSourceFile("third_party/zig-sqlite/c/sqlite3.c", &[_][]const u8{"-std=c99"}); 150 .name = "sqlite",
151 .target = target,
152 .optimize = optimize,
153});
154sqlite.addCSourceFile(.{
155 .file = .{ .path = "third_party/zig-sqlite/c/sqlite3.c" },
156 .flags = &[_][]const u8{
157 "-std=c99",
158 },
159});
160sqlite.addIncludePath(.{ .path = "third_party/zig-sqlite/c" });
149sqlite.linkLibC(); 161sqlite.linkLibC();
150``` 162```
151 163
@@ -155,8 +167,10 @@ Now it's just a matter of linking your `build.zig` target(s) to this library ins
155 167
156```zig 168```zig
157exe.linkLibrary(sqlite); 169exe.linkLibrary(sqlite);
158exe.addPackagePath("sqlite", "third_party/zig-sqlite/sqlite.zig"); 170exe.addIncludePath(.{ .path = "third_party/zig-sqlite/c" });
159exe.addIncludeDir("third_party/zig-sqlite/c"); 171exe.addAnonymousModule("sqlite", .{
172 .source_file = .{ .path = "third_party/zig-sqlite/sqlite.zig" },
173});
160``` 174```
161 175
162If you're building with glibc you must make sure that the version used is at least 2.28. 176If you're building with glibc you must make sure that the version used is at least 2.28.