diff options
| author | 2021-04-12 22:18:08 +0200 | |
|---|---|---|
| committer | 2021-04-12 22:52:27 +0200 | |
| commit | fba32d2ecd07be2f1f30d7e9156ca51ca2b58fe1 (patch) | |
| tree | 298e996319325e7546a9ed62dc1d75f1e2b829d1 /README.md | |
| parent | Merge branch 'zigmod' (diff) | |
| download | zig-sqlite-fba32d2ecd07be2f1f30d7e9156ca51ca2b58fe1.tar.gz zig-sqlite-fba32d2ecd07be2f1f30d7e9156ca51ca2b58fe1.tar.xz zig-sqlite-fba32d2ecd07be2f1f30d7e9156ca51ca2b58fe1.zip | |
document how to use zigmod
Diffstat (limited to 'README.md')
| -rw-r--r-- | README.md | 31 |
1 files changed, 28 insertions, 3 deletions
| @@ -25,12 +25,37 @@ For sqlite, you have options depending on your target: | |||
| 25 | 25 | ||
| 26 | # Installation | 26 | # Installation |
| 27 | 27 | ||
| 28 | Since there's no package manager for Zig yet, the recommended way is to use a git submodule: | 28 | There are two primary ways to include `zig-sqlite` in your project: |
| 29 | * using the [zigmod](https://github.com/nektro/zigmod) package manager | ||
| 30 | * using a git submodule | ||
| 29 | 31 | ||
| 30 | ```bash | 32 | ## zigmod |
| 31 | $ git submodule add https://github.com/vrischmann/zig-sqlite.git third_party/zig-sqlite | 33 | |
| 34 | Add this to your `zig.mod` file: | ||
| 35 | ``` | ||
| 36 | dependencies: | ||
| 37 | - src: git https://github.com/vrischmann/zig-sqlite branch-master | ||
| 32 | ``` | 38 | ``` |
| 33 | 39 | ||
| 40 | Note that if you're building an executable and not a library you should use `dev_dependencies` instead. | ||
| 41 | |||
| 42 | Next run `zigmod fetch`; it should create a `deps.zig` file. | ||
| 43 | |||
| 44 | Now in your `build.zig` you can access the package like this: | ||
| 45 | ```zig | ||
| 46 | const deps = @import("deps.zig"); | ||
| 47 | ... | ||
| 48 | deps.addAllTo(exe); | ||
| 49 | ``` | ||
| 50 | |||
| 51 | This is the easiest way to add `zig-sqlite` because it uses the bundled source code, avoiding all sorts of linking problems. | ||
| 52 | |||
| 53 | ## Git submodule | ||
| 54 | |||
| 55 | If you don't want to use a package manager you can simply add this repository as a git submodule. | ||
| 56 | |||
| 57 | Then you need to chose if you want to use the system sqlite library or the bundled source code. | ||
| 58 | |||
| 34 | ## Using the system sqlite library | 59 | ## Using the system sqlite library |
| 35 | 60 | ||
| 36 | If you want to use the system sqlite library, add the following to your `build.zig` target(s): | 61 | If you want to use the system sqlite library, add the following to your `build.zig` target(s): |