You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
Copy file name to clipboardExpand all lines: README.md
+38-4Lines changed: 38 additions & 4 deletions
Display the source diff
Display the rich diff
Original file line number
Diff line number
Diff line change
@@ -2,8 +2,29 @@
2
2
3
3
This is a fork of [glfw](https://github.com/glfw/glfw), packaged for Zig. Unnecessary files have been deleted, and the build system has been replaced with build.zig.
4
4
5
-
_Looking for Zig bindings to GLFW?_ See [mach/glfw](https://github.com/hexops/mach-glfw).
5
+
_Looking for Zig bindings to GLFW?_ See [zlfw](https://github.com/Batres3/zlfw).
6
6
7
+
## Usage
8
+
```
9
+
git clone https://github.com/Batres3/glfw/
10
+
cd glfw
11
+
zig build
12
+
```
13
+
14
+
If you would like to integrate this into your own project, it is as simple as adding the dependency to `build.zig.zon`,
15
+
and adding the following to your `build.zig`
16
+
```
17
+
const glfw = b.dependency("glfw", .{
18
+
.target = target,
19
+
.optimize = optimize,
20
+
// Additional options here
21
+
});
22
+
23
+
your_module.linkLibrary(glfw.artifact("glfw"));
24
+
25
+
```
26
+
By default, the the library adds the `include/` folder as an include path, meaning that you may access `glfw3.h` via `GLFW/glfw3.h`, however,
27
+
if you would like access to the files in `src/` you must add the `include_src` build option.
7
28
## Updating
8
29
9
30
To update this repository, run `./update.sh` followed by `./verify.sh` to verify the repository contents.
@@ -18,6 +39,19 @@ For supply chain security reasons (e.g. to confirm we made no patches to the cod
18
39
19
40
If nothing is printed, there is no diff. Deleted files, and changes to `README.md`, `build.zig`, `.github` CI files and `.gitignore` are ignored.
20
41
21
-
## Issues
22
-
23
-
Issues are tracked in the [main Mach repository](https://github.com/hexops/mach/issues?q=is%3Aissue+is%3Aopen+label%3Aglfw).
42
+
## Dependencies
43
+
Technically, glfw has no _explicit_ dependencies and can, in theory, obtain all necessary code to compile directly from the user,
44
+
this would include things such as vulkan headers, wayland headers and so on. However, considering that one of the main selling points of zig
45
+
is the seamless cross compilation, it would defeat the point to use system dependencies, as such, the necessary files are included as dependencies
46
+
in `build.zig.zon`, of those dependencies, x11, wayland and vulkan, which are public, are simple forks of the sources.
47
+
On the other hand the macos dependencies are private, and can only be found on mac systems, I do not have access to one of these, so for
48
+
now I am using the [mach xcode repo](https://github.com/hexops/xcode-frameworks), which is maintained by the [mach](https://machengine.org/) team
49
+
50
+
However, I understand now wanting to depend on some other repo for dependencies to header file, therefore, I have added the `native` build option
51
+
which will simply ignore the dependencies and assume that the user will provide the appropriate headers. If you are building for your own system,
52
+
this method is entirely equivalent to the other one, however, you will not be able to cross-compile.
53
+
54
+
### Wayland
55
+
There is a caveat here for wayland, since it does not provide the headers files for many of its protocols, even when natively running wayland
56
+
if you would like to build it natively, you may use `wayland-scanner` to do so, see [wayland-headers](https://github.com/Batres3/wayland-headers/)
0 commit comments