Commit graph

58 commits

Author SHA1 Message Date
Carl Åstholm
affdd6ae6f Update README with setup instructions
Adapted from https://machengine.org/v0.4/pkg/mach-glfw/

Co-authored-by: Jayson Bunnell <jaysonbunnell@gmail.com>
2024-12-21 22:10:06 +01:00
Carl Åstholm
1338578255 support other Zig versions in addition to Zig 2024.10
Support for Zig 0.12.1, 0.13.0, master, etc. is only incidental and is
not as thoroughly tested. mach-glfw only officially targets Zig 2024.10.
2024-12-03 23:34:00 +01:00
Stephen Gutekanst
fb4ae48540
mach-glfw is now community maintained
Helps hexops/mach#1166
2024-07-07 20:57:29 -07:00
Stephen Gutekanst
ed29b281e1
README: fix alt text 2023-08-04 19:55:16 -07:00
Stephen Gutekanst
37c3eadb5f README: fix links
Signed-off-by: Stephen Gutekanst <stephen@hexops.com>
2023-08-04 19:50:42 -07:00
Stephen Gutekanst
fae6bfd3c4 README: minimal README linking to new website
Helps hexops/mach#881

Signed-off-by: Stephen Gutekanst <stephen@hexops.com>
2023-08-04 19:49:52 -07:00
Stephen Gutekanst
1b516bae92 README: this is a standalone repository
Signed-off-by: Stephen Gutekanst <stephen@hexops.com>
2023-07-08 14:58:00 -07:00
Stephen Gutekanst
9b3373b9b2 all: use mach-glfw via package manager
Signed-off-by: Stephen Gutekanst <stephen@hexops.com>
2023-07-07 06:32:36 -07:00
Stephen Gutekanst
98418ac4dc glfw: remove xcode_frameworks submodule; Sdk type
Signed-off-by: Stephen Gutekanst <stephen@hexops.com>
2023-07-06 23:48:39 -07:00
Stephen Gutekanst
3ef11aec02 glfw: prepare to use via package manager
Signed-off-by: Stephen Gutekanst <stephen@hexops.com>
2023-07-06 22:30:29 -07:00
Stephen Gutekanst
b5618e8501 all: update to latest mach-glfw build API
Signed-off-by: Stephen Gutekanst <stephen@hexops.com>
2023-07-03 22:11:06 -07:00
Stephen Gutekanst
871de93349 glfw: move glfw upstream submodule in preparation of Zig package manager
Signed-off-by: Stephen Gutekanst <stephen@hexops.com>
2023-04-05 03:49:50 -07:00
Stephen Gutekanst
74b0c807b8 officially deprecate Matrix chat in favor of Discord
Signed-off-by: Stephen Gutekanst <stephen@hexops.com>
2023-02-13 06:46:23 -07:00
avokadoen
14790d5b1e glfw: update to latest Zig build API
Signed-off-by: Stephen Gutekanst <stephen@hexops.com>
2023-02-12 10:05:03 -07:00
Lue
097bea84ab glfw: refactor getError and related functions
`getError()` now returns a struct `Error` containing `error_code` and
`description`. Rationale: retrieving the error code with the previous
implementation of `getError()` caused `getErrorString()` to return
null (the reverse is also true). The new implementation allows both
values to be retrieved at once.

The previous `getError()` function has been renamed to
`getErrorCode()` to reflect the fact that it returns a simple Zig
error rather than the `Error` struct. The error set returned by
`getErrorCode()` is now named `ErrorCode` rather than `Error`.

The behavior of the `getError()` family of functions clearing the
stored error is unchanged. However, since all code that used
`defer glfw.getError() catch {}` to explicitly clear errors had to be
refactored, a new `glfw.clearError()` function that returns void is
now available to make this operation more explicit.

Additionally, `mustGetError()` is now `mustGetErrorCode()`, and new
functions `mustGetError()` and `mustGetErrorString()` have been added
which wrap `getError()` and `getErrorString()` but panic if no error
is actually available.

Tests and API documentation had to be refactored across all of
`mach/glfw`. This commit also takes the opportunity to skip tests
involving window creation on CI so that other tests may still execute
normally.
2023-01-10 20:52:41 -07:00
Stephen Gutekanst
20fc0272f0 Revert "all: build: fix sdkPath for relative @src.file / fix autocompletion with ZLS / IDEs (#661)"
This reverts commit 711e644a061cf8e21c35308873fe0f0e698ac490.

Lue suggested reverting #661 because ZLS worked around the issue of @src
being relative in that environment: https://github.com/zigtools/zls/pull/898

This is not a perfect solution (what zls did seems to be a workaround), but
is good enough for us until Zig gets an official package manager.
2023-01-10 01:57:52 -07:00
Stephen Gutekanst
c244a7b72e glfw: README: update usage example
Signed-off-by: Stephen Gutekanst <stephen@hexops.com>
2023-01-08 18:21:11 -07:00
Lue
a9e9ac0955 all: build: fix sdkPath for relative @src.file / fix autocompletion with ZLS / IDEs (#661)
* all: build: fix sdkPath for relative @src.file

Prior to this commit, the build system heavily assumed that the result
`@src.file` would always be absolute, but this is no longer
guaranteed, likely due to there being no such thing as an "absolute
path" in WASI.

It appears that for normal invocations of `zig build`, it is safe to
assume that `@src.file` is absolute. However, when ZLS uses a custom
`build_runner.zig` to collect build configuration, `@src.file` is
actually relative to the current working directory, at least on my
system. For a while, this led to ZLS completions breaking entirely,
but presently it actually causes ZLS to crash!

The solution is not as simple as using relative `sdkPath` results
as-is, because the build system may attempt to resolve these paths
relative to build root, when the paths are actually relative to the
current working directory.

This leads to a sticky situation: the current working directory is a
runtime concept, but `@src.file` is resolved at compile time. However,
it appears that the build runner does not change current working
directory in between compilation and execution, so it is probably safe
to calculate `sdkPath` using runtime current working directory.

Still, this requires major changes with how `sdkPath` works, since
runtime computation and allocations are required. So pretty much
anything that relied on `sdkPath` being comptime-known has been
refactored in this commit.

The most severe result of this is that, for example, `gpu.pkg` can no
longer be a comptime-known constant: it has to be a runtime function
that takes a `*Builder` and returns a `Pkg`.

This commit deals with usages of `*.pkg` and `sdkPath` within Mach
itself, but projects that depend on Mach such as `mach-examples` will
almost certainly require changes as well.

* all: update README to reflect change in pkg usage

For details on updating your code to use this version, see: 88b1106953

Signed-off-by: Stephen Gutekanst <stephen@hexops.com>
Co-authored-by: Stephen Gutekanst <stephen@hexops.com>
2023-01-02 01:23:46 -07:00
BratishkaErik
b19ef0319a all: README: fix links to main repository (#600) 2022-10-28 10:22:23 -07:00
Ali Chraghi
56b6222b2f all: build: organize build files and reduce unreachables (#567) 2022-09-25 10:02:51 -07:00
Eric Joldasov
f4d9c0d171 glfw: fix instructions for Gyro in README.md
"--build-dep" has been recently renamed to "--build_dep"

Signed-off-by: Eric Joldasov <bratishkaerik@getgoogleoff.me>
2022-08-18 21:02:09 -07:00
Stephen Gutekanst
6c5148b0a6 glfw: collapse/hide Gyro instructions by default to avoid confusion 2022-08-11 05:10:36 -07:00
Stephen Gutekanst
05a2118ef5 glfw: README: update usage example
Signed-off-by: Stephen Gutekanst <stephen@hexops.com>
2022-06-11 17:39:25 -07:00
Stephen Gutekanst
95d34e68ad glfw: README: mention that we are now tracking glfw@master
Signed-off-by: Stephen Gutekanst <stephen@hexops.com>
2022-06-11 17:39:25 -07:00
BratishkaErik
ac7e0eed64 glfw: add instructions for Gyro in README.md (#184)
* glfw: add instructions for Gyro in README.md
2022-03-19 07:43:23 -07:00
Stephen Gutekanst
bdf74cf422 glfw: mention Matrix chat room
Signed-off-by: Stephen Gutekanst <stephen@hexops.com>
2021-12-14 18:16:45 -08:00
InKryption
23c922f0a4 glfw: window hints rework (#71)
* glfw: make comments into doc comments
* glfw: Publicize Window.CursorPos, Window.Size, Window.Pos, and Window.FrameSize
* glfw: Make enum value name the same format as other enum value names
* glfw: Window hints rework patch
* glfw: Relegate `Window.hint` to testing; move it down to just above the tests to reflect this, add doc comment line
* glfw: handle error `Error.InvalidEnum` explicitly, for clear error message in this unlikely edge case
* glfw: instate `Hint.context_no_error` as a hint, as it actually is specified to be a Window creation hint by the docs, and affirm removal of `Hint.context_revision`, which isn't.
The docs don't seem to specify a default value for `Hints.context_no_error` to take on, so we could set it based on `std.debug.runtime_safety` like this.
* glfw: default `context_no_error` to `false`, and added a note of caution about its usage as suggested.
* glfw: Inline enum values of `ClientApi`, `ContextCreationApi`, `ContextRobustness`, `ContextReleaseBehavior`, and `OpenGlProfile` from consts.zig, and remove the now unused constants (replaced by aformentioned enum values).
* glfw: Reference `Window.Hint` enum instead of `Window.Hints` struct to ensure fields are the same
* glfw: add comment explaining default values of `Window.Hints`
* glfw: change `OpenGlProfile` to `OpenGLProfile` based on established naming convention
* glfw: Update actual declaration of `OpenGLProfile`
* glfw: call `Window.defaultHints` after window creation, not before
* glfw: remove 'consts.zig', and move `dont_care` directly into 'main.zig'; fix anything referencing it.
* glfw: put `Window.defaultHints` into defer statement to handle cleanup in all paths
* glfw: move `Hint.focused` to match position of `Hints.focused`
* glfw: do 'zig fmt glfw/src'
* glfw: Cull `Window.Hint` comments, polish remaining; match order entirely according to current GLFW docs
* glfw: Change `Window.Hints.*Api` to `Window.Hints.*API`

Co-authored-by: Stephen Gutekanst <stephen@hexops.com>
2021-11-15 18:41:16 -07:00
Ali Chraghi
80e609b0cb Update README.md 2021-11-15 16:14:38 -07:00
InKryption
ec9e770673 glfw: Update readme to reflect changes made to glfw.init 2021-11-10 11:42:24 -07:00
Stephen Gutekanst
e6084af0e5 glfw: send pull requests to the main repository to avoid merge conflicts
When changes are merged to both hexops/mach and hexops/mach-glfw, we get a conflict
which is difficult to resolve with `git subtree`, particularly because we don't want
to squash commits for either repository (we prefer to maintain the full commit history
in both repos.)

Instead, require that all pull requests be sent to the main hexops/mach repository.
That's not as nice, I admit, but should be pretty easy to handle (literally just copy
changes over) and will ensure we can always keep both repos in sync easily and without
conflict.

Signed-off-by: Stephen Gutekanst <stephen@hexops.com>
2021-11-07 20:51:16 -07:00
Noora Heinsuo
fd131c83a9
Fix code example (#1) 2021-11-03 20:13:39 -07:00
Stephen Gutekanst
96cb20e9e8 glfw: add Vulkan example to README
Signed-off-by: Stephen Gutekanst <stephen@hexops.com>
2021-10-31 01:14:46 -07:00
Stephen Gutekanst
f0a71f53a4 glfw: update README, send pull requests to the main repo if possible
Signed-off-by: Stephen Gutekanst <stephen@hexops.com>
2021-10-30 21:23:17 -07:00
Stephen Gutekanst
3b231b7456 glfw: improve README, add getting started, error handling, etc
Signed-off-by: Stephen Gutekanst <stephen@hexops.com>
2021-10-30 21:23:17 -07:00
Stephen Gutekanst
cdf1f1b1c1 glfw: correct CI status badge in README
Signed-off-by: Stephen Gutekanst <stephen@hexops.com>
2021-10-24 08:53:59 -07:00
Stephen Gutekanst
00648d7b2d glfw: cleanup README, explain how to use Vulkan/OpenGL with it
Signed-off-by: Stephen Gutekanst <stephen@hexops.com>
2021-10-24 07:47:05 -07:00
Stephen Gutekanst
3d19b4993c
glfw: README: cleanup 2021-10-24 05:50:56 -07:00
Stephen Gutekanst
63f29665ff glfw: update README
Signed-off-by: Stephen Gutekanst <stephen@hexops.com>
2021-10-24 05:48:08 -07:00
Stephen Gutekanst
7ca9b85d43 README: cross compilation from all desktop OS now working
Signed-off-by: Stephen Gutekanst <stephen@hexops.com>
2021-09-13 20:49:34 -07:00
Stephen Gutekanst
28efaca99a
README: Linux support officially working
Helps #4
2021-08-02 23:50:12 -07:00
Stephen Gutekanst
2fbbd82287
README: update the state of Linux support 2021-07-29 21:21:32 -07:00
Stephen Gutekanst
72972b8725 README: Windows cross compilation fully supported
Signed-off-by: Stephen Gutekanst <stephen@hexops.com>
2021-07-25 23:16:57 -07:00
Stephen Gutekanst
a54de46a8a README: x86_64-windows support verified
Signed-off-by: Stephen Gutekanst <stephen@hexops.com>
2021-07-25 22:59:08 -07:00
Stephen Gutekanst
c9af091855
README: x86_64-macos -> aarch64-macos verified 2021-07-25 17:27:41 -07:00
Stephen Gutekanst
37f738fec8 README: x86_64-linux -> aarch64-macos now working
Signed-off-by: Stephen Gutekanst <stephen@hexops.com>
2021-07-25 17:25:33 -07:00
Stephen Gutekanst
e5642c5471 verify cross compilation: x86_64-macos -> aarch64-macos
Signed-off-by: Stephen Gutekanst <stephen@hexops.com>
2021-07-25 17:09:43 -07:00
Stephen Gutekanst
79db884e50 README: aarch64-macos -> aarch64-macos now tested via CI
Signed-off-by: Stephen Gutekanst <stephen@hexops.com>
2021-07-25 16:09:28 -07:00
Stephen Gutekanst
c57a2374ab
README: update state of macOS support
Closes #3
2021-07-25 15:33:52 -07:00
Stephen Gutekanst
3627edfbba README: add supported platforms matrix
Signed-off-by: Stephen Gutekanst <stephen@hexops.com>
2021-07-18 14:52:45 -07:00
Stephen Gutekanst
fcdaba5cc2 README: explain zero fuss installation & cross compilation
Signed-off-by: Stephen Gutekanst <stephen@hexops.com>
2021-07-18 14:52:11 -07:00