Skip to content

Commit

Permalink
readme: Add installation section
Browse files Browse the repository at this point in the history
  • Loading branch information
ibokuri committed Jan 20, 2024
1 parent 9ca7537 commit 34e189c
Showing 1 changed file with 40 additions and 1 deletion.
41 changes: 40 additions & 1 deletion README.md
Original file line number Diff line number Diff line change
Expand Up @@ -115,10 +115,49 @@ pub fn main() !void {

</details>

## Installation

1. Declare Getty as a project dependency with `zig fetch`:

```sh
# Latest version
zig fetch --save git+https://github.com/getty-zig/getty.git#master

# Specific version
zig fetch --save git+https://github.com/getty-zig/getty.git#<COMMIT>
```

2. Expose Getty as a module in your project's `build.zig`:
```zig
pub fn build(b: *std.Build) void {
const target = b.standardTargetOptions(.{});
const optimize = b.standardOptimizeOption(.{});
const opts = .{ .target = target, .optimize = optimize }; // 👈
const getty_mod = b.dependency("getty", opts).module("getty"); // 👈
const exe = b.addExecutable(.{
.name = "my-project",
.root_source_file = .{ .path = "src/main.zig" },
.target = target,
.optimize = optimize,
});
exe.root_module.addImport("getty", getty_mod); // 👈
// ...
}
```
3. Import Getty into your code:
```zig
const getty = @import("getty");
```
## Resources
- [Website](https://getty.so/)
- [Installation](https://getty.so/user-guide/installation/)
- [Tutorial](https://getty.so/user-guide/tutorial/)
- [Examples](examples)
- [API Reference](https://docs.getty.so/)
Expand Down

0 comments on commit 34e189c

Please sign in to comment.