Commit graph

376 commits

Author SHA1 Message Date
iddev5
27146af8ce glfw: add getErrorString() to access the current error description 2022-04-17 10:49:05 -07:00
Isaac Freund
02e357ab44
build: never use pkg-config to link system libraries (#217)
Every library we want to link against is either provided by the Zig
toolchain or part of our SDK. Therefore, using pkg-config to link
against libraries on the host system is never what we intend.

To fix this, use linkSystemLibraryName() everywhere instead of
linkSystemLibrary() as the latter integrates with pkg-config while the
former just passes -lfoo to the zig compiler.

In combination with Zig commit 38d6e1d8a8 fixing an std.build bug,
this change fixes the linking of the necessary X11 libraries on my
x86_64 glibc based Void Linux system.
2022-04-12 12:08:30 -07:00
Stephen Gutekanst
d2d5bdc892 glfw: zig fmt
Signed-off-by: Stephen Gutekanst <stephen@hexops.com>
2022-04-08 16:54:37 -07:00
Silver
017ca6dd08 glfw: add type to pkg def in build.zig 2022-04-07 18:42:15 -07:00
Stephen Gutekanst
0161ccef37 glfw: add std.build.Pkg definition
Signed-off-by: Stephen Gutekanst <stephen@hexops.com>
2022-04-05 00:16:51 -07:00
Mitchell Hashimoto
d26c76b074 system_sdk for linux-aarch64 2022-03-30 10:05:58 -07:00
Stephen Gutekanst
0753c5e4c8 glfw: update to Zig 0.10.0-dev.1600+af844931b
Signed-off-by: Stephen Gutekanst <stephen@hexops.com>
2022-03-26 13:31:24 -07:00
Stephen Gutekanst
2288fa8d78 glfw: CI: windows: disable progress bar for faster downloads
Signed-off-by: Stephen Gutekanst <stephen@hexops.com>
2022-03-26 13:25:56 -07:00
BratishkaErik
1838faf3f9
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
38b896ed83 glfw: CI: uninstall libx11 on x86_64-macos to avoid conflicts
Signed-off-by: Stephen Gutekanst <stephen@hexops.com>
2022-03-06 02:10:07 -07:00
Stephen Gutekanst
09579e649d Revert "glfw: system_sdk: use addIncludeDir over addSystemIncludeDir"
This reverts commit 5f382f9365.

I forgot that system include dirs also silence some warnings that are
present in system headers, so we can't really do this.
2022-03-06 02:05:45 -07:00
Stephen Gutekanst
5f382f9365 glfw: system_sdk: use addIncludeDir over addSystemIncludeDir
Since we're not specifying a sysroot by default (as that prevents
making use of other libraries/headers on your system, if you wish to)
we can have conflicts with either the headers on your system or the
headers Zig itself ships (although that shouldn't happen, except for
cases like Windows where we ship more up-to-date DirectX headers.)

System include dirs are treated with the same relative priority as other
system include dirs, those actually on your system and the ones Zig
provides. But regular include dirs are given higher priority, and so
should give our headers a better chance of being included in the event
that there should be any conflict.

Signed-off-by: Stephen Gutekanst <stephen@hexops.com>
2022-03-06 01:56:45 -07:00
Stephen Gutekanst
057937a066 glfw: clone with -c core.longpaths=true for Windows
Yes, even in 2022 we're still dealing with Windows filepaths being too long.
The repository can't clone on GitHub actions Windows CI runner, currently,
because of this issue. https://stackoverflow.com/a/22575737

Signed-off-by: Stephen Gutekanst <stephen@hexops.com>
2022-03-05 03:30:33 -07:00
Stephen Gutekanst
07dbd1a18f glfw: CI: update to latest Zig master
Signed-off-by: Stephen Gutekanst <stephen@hexops.com>
2022-03-05 03:04:41 -07:00
Stephen Gutekanst
020ee37686 glfw: update system_sdk notes
Signed-off-by: Stephen Gutekanst <stephen@hexops.com>
2022-03-04 16:35:43 -07:00
Stephen Gutekanst
6cbf0508b1 glfw: system_sdk: add Windows system SDK with updated DirectX headers
This effectively provides all you need to develop & cross compile DirectX 11/12
applications with `mach/glfw` (or just Zig in general, by copying `system_sdk.zig`
into your own project.)

Helps hexops/mach#86
Helps hexops/mach#59

Signed-off-by: Stephen Gutekanst <stephen@hexops.com>
2022-03-04 16:26:58 -07:00
Stephen Gutekanst
d35957766b glfw: use lowercase shell32 for Linux
Signed-off-by: Stephen Gutekanst <stephen@hexops.com>
2022-03-04 16:10:51 -07:00
Stephen Gutekanst
16c581b2ab glfw: fix x86_64-windows-msvc compilation support
This fixes compilation for msvc ABI. This currently only works under Windows,
I believe because Zig requires the Windows SDK to be present for msvc compilation
/ does not allow cross compilation with MSVC. Still, this is nice to have.

Signed-off-by: Stephen Gutekanst <stephen@hexops.com>
2022-03-04 15:59:36 -07:00
Stephen Gutekanst
646560c834 glfw: remove alignment from packed structs / fix compilation with latest Zig
Not sure why we had these here, but alignment on a packed struct seems somewhat
nonsensical (after all, it's fields are packed as closely together as possible
so what would alignment refer to?) removing seems fine and fixes compilation with
latest Zig:

```
/Users/slimsag/Desktop/hexops/mach/gpu-dawn/libs/mach-glfw/src/hat.zig:8:20: error: unable to override alignment of packed struct fields
    up: bool align(@alignOf(u8)) = false,
                   ^
/Users/slimsag/Desktop/hexops/mach/gpu-dawn/libs/mach-glfw/src/mod.zig:10:23: error: unable to override alignment of packed struct fields
    shift: bool align(@alignOf(c_int)) = false,
```                      ^

Signed-off-by: Stephen Gutekanst <stephen@hexops.com>
2022-03-04 15:48:40 -07:00
Stephen Gutekanst
f2cde765c3 glfw: correct getCocoaWindow return type
Signed-off-by: Stephen Gutekanst <stephen@hexops.com>
2022-02-26 23:34:17 -07:00
Stephen Gutekanst
d61362d8fb glfw: expose Native BackendOptions
Signed-off-by: Stephen Gutekanst <stephen@hexops.com>
2022-02-26 23:34:17 -07:00
Stephen Gutekanst
be35c4cf85 glfw: CI: M1: skip sudo when cleaning up git submodules
Signed-off-by: Stephen Gutekanst <stephen@hexops.com>
2022-02-12 00:37:45 -07:00
Stephen Gutekanst
505909486b glfw: CI: cleanup git submodules in M1 runner
Signed-off-by: Stephen Gutekanst <stephen@hexops.com>
2022-02-11 22:51:35 -07:00
Stephen Gutekanst
e718919be5 glfw: CI: cleanup git submodules in M1 runner
Signed-off-by: Stephen Gutekanst <stephen@hexops.com>
2022-02-11 22:05:09 -07:00
Stephen Gutekanst
bca3c80504 glfw: CI: upgrade to latest Zig nightly
Signed-off-by: Stephen Gutekanst <stephen@hexops.com>
2022-02-11 17:24:32 -07:00
Lee Cannon
6f32a338c0 glfw: use comptime magic to remove InternalUserPointer and associated overhead 2022-02-11 15:13:58 -07:00
Lee Cannon
8d2a4cd8d2 glfw: glfwGetMonitors can return null to signify no monitors 2022-02-11 15:09:09 -07:00
Lee Cannon
bc8ce57e53 glfw: document why unreachable is valid 2022-02-11 15:09:09 -07:00
Stephen Gutekanst
0cdac6c68a Fix minor regressions introduced in 3e79a12
3e79a12f3d

Signed-off-by: Stephen Gutekanst <stephen@hexops.com>
2022-02-08 20:21:56 -07:00
Lee Cannon
2e9347399d glfw: dont use @errSetCast 2022-02-08 19:58:52 -07:00
Lee Cannon
3e79a12f3d glfw: dont call getError unless we need to 2022-02-08 19:57:20 -07:00
Lee Cannon
746b0dd1f0 glfw: improve setErrorCallback 2022-02-08 19:54:00 -07:00
InKryption
3d392c8c74 glfw: Use anyopaque instead of opaque {}
Update other two instances of `opaque {}`
2022-01-12 18:58:49 -07:00
InKryption
d651d25903 glfw: Use anyopaque instead of opaque{}
Using an inline `opaque{}` type forces the use of `@typeInfo` to cast to the specific type of the parameter.
2022-01-12 18:58:49 -07:00
InKryption
786da94468 glfw: Tidy up UserPointer access
This change both restricts and clarifies the mutability/nullability of the pointers, and replaces the explicitly-typed pointer usage in setUserPointer with ?*anyopaque, since it now, as of being renamed from c_void, more simply communicates the intent of taking any pointer type.
2022-01-02 18:17:27 -07:00
Ali Chraghi
1f748d1be8
glfw: repatch undefined behavior in X11 keypress handling (#150)
repatch undefined behavior in GLFW which did not land yet and was accidentally removed when updating GLFW in #136 

See glfw/glfw#1989

Fixes hexops/mach#149
2021-12-28 03:57:08 -07:00
iddev5
dc2f2b2a12 glfw: improve documentation for native.zig
- Added hidden error returns
- Improved return types
- Updated docs to glfw 3.3.6
2021-12-28 03:52:22 -07:00
Ali Chraghi
494eb81b56
glfw: expose glfwSetErrorCallback for retrieving optional error descriptions 2021-12-25 11:32:12 -07:00
Ali Chraghi
38cab2e423
add wayland cross-compilation support (#140)
* add wayland-headers include path
* add wayland protocols header to wayland target includes
* move `xkb_unicode.c` to `sources_linux.c`
* glfw: document where wayland generated sources come from
* glfw: update sdk-linux-x86_64 to include Wayland protocol sources

See https://github.com/hexops/sdk-linux-x86_64/pull/2

Co-authored-by: Stephen Gutekanst <stephen@hexops.com>
2021-12-24 01:06:51 -07:00
iddev5
cd82da72be glfw: Update function docs in Monitor and vulkan to match glfw 3.3.6 2021-12-23 13:01:45 -07:00
iddev5
a385eef8cd glfw: native.zig: Fix missing casts, incorrect return types and error
handling
2021-12-23 00:57:29 -07:00
iddev5
4f35c578a0 glfw: Add ziggified API of glfw3native.h 2021-12-23 00:57:29 -07:00
Ali Chraghi
7ec7fb7af0
glfw: Update glfw to 3.3.6 (#136)
* glfw: update glfw to 3.3.6
* glfw: make Vulkan-Headers clone faster
2021-12-22 11:15:23 -07:00
Ali Chraghi
6866fce4ee
glfw: make update-upstream.sh clone faster (#132) 2021-12-21 18:25:51 -07:00
InKryption
4a27bf25ac glfw: update CI to latest Zig master 2021-12-19 16:15:32 -07:00
InKryption
f8e14dabc6 Run zig fmt
>> Zig master changed `c_void` to `anyopaque`, and zig fmt helps to change code as appropriate
2021-12-19 16:15:32 -07:00
Stephen Gutekanst
398b289941 glfw: mention Matrix chat room
Signed-off-by: Stephen Gutekanst <stephen@hexops.com>
2021-12-14 18:16:45 -08:00
Ali Chraghi
595cf48450
glfw: replace isize, usize with i32, u32 where appropriate (#126)
Fixes hexops/mach#114
2021-12-14 09:20:14 -07:00
Stephen Gutekanst
3ec74222e6 glfw: reduce compilation units to bring iteration time down to ~90ms
This consistently shaves off about 40ms (~130ms -> ~90ms, 30% reduction) from build times when iterating.

On Windows, I suspect the result will be much greater due to slow filesystem perf there and the fact
that this reduces the # of files read.

This was originally brought to my attention as a possibility by @meshula in hexops/dawn#2, the way this
works is by reducing compilation units so that C headers only need to be read/parsed/interpreted once
rather than once per individual C source file we are compiling.

Signed-off-by: Stephen Gutekanst <stephen@hexops.com>
2021-12-10 03:52:41 -08:00
Stephen Gutekanst
77d2e8a9a3 glfw: improve consecutive build times by 4-12x
This substantially reduces consecutive build times when using mach/glfw.

`system_sdk.getSdkPath` is frequently invoked as part of the build process, and previously it was
doing some fairly involved work (ensuring the native SDK is at the right revision, needless
`git fetch` in native SDKs to check for updates, etc.)

We now do far less work in `getSdkPath`, and additionally cache the result in-memory. This improves
build times substantially, but especially so with consecutive (non-cold-cache) build times:

* For `mach/glfw`: ~2s before, ~160ms after
* For `mach/gpu`: , ~16s before, ~3.6s after

Signed-off-by: Stephen Gutekanst <stephen@hexops.com>
2021-12-10 03:40:00 -08:00