glfw: add instructions for Gyro in README.md (#184)

* glfw: add instructions for Gyro in README.md
This commit is contained in:
BratishkaErik 2022-03-19 20:43:23 +06:00 committed by GitHub
parent 9ef611c0b4
commit ac7e0eed64

View file

@ -43,15 +43,18 @@ A minimal Vulkan example can be found in the [mach-glfw-vulkan-example](https://
## Getting started
### Adding dependency (using Git)
In a `libs` subdirectory of the root of your project:
```sg
```sh
git clone https://github.com/hexops/mach-glfw
```
Then in your `build.zig` add:
```zig
...
const glfw = @import("libs/mach-glfw/build.zig");
pub fn build(b: *Builder) void {
@ -61,6 +64,33 @@ pub fn build(b: *Builder) void {
}
```
### Adding dependency (using Gyro)
```sh
gyro add --src github hexops/mach-glfw --root src/main.zig --alias glfw
gyro add --build-dep --src github hexops/mach-glfw --root build.zig --alias build-glfw
```
Then in your `build.zig` add:
```zig
...
const pkgs = @import("deps.zig").pkgs;
const glfw = @import("build-glfw");
pub fn build(b: *Builder) void {
...
exe.addPackage(pkgs.glfw);
glfw.link(b, exe, .{});
}
```
**WARNING: You should use `gyro build` instead of `zig build` now!**
# Next steps
Now in your code you may import and use GLFW:
```zig