diff --git a/README.md b/README.md index 98c84f63..9d6976aa 100644 --- a/README.md +++ b/README.md @@ -115,10 +115,49 @@ pub fn main() !void { +## 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# + ``` + +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/)