Skip to content

Commit

Permalink
Add wayland build tag, issue #404
Browse files Browse the repository at this point in the history
  • Loading branch information
gen2brain committed Dec 3, 2024
1 parent aef24a2 commit 5df9325
Show file tree
Hide file tree
Showing 2 changed files with 10 additions and 3 deletions.
1 change: 1 addition & 0 deletions README.md
Original file line number Diff line number Diff line change
Expand Up @@ -61,6 +61,7 @@ It is also possible to build the DLL yourself. You can find more info at [raylib
* `es2` - uses OpenGL ES 2.0 backend (can be used to link against [Google's ANGLE](https://github.com/google/angle))
* `es3` - experimental support for OpenGL ES 3.0
* `x11` - force X11 compatibility mode on Wayland (PLATFORM_DESKTOP/GLFW)
* `wayland` - force Wayland only mode (PLATFORM_DESKTOP/GLFW)

### Documentation

Expand Down
12 changes: 9 additions & 3 deletions raylib/cgo_linux.go
Original file line number Diff line number Diff line change
Expand Up @@ -12,14 +12,18 @@ package rl
#include "external/glfw/src/vulkan.c"
#include "external/glfw/src/window.c"
#if defined _GLFW_WAYLAND
#include "external/glfw/src/wl_init.c"
#include "external/glfw/src/wl_monitor.c"
#include "external/glfw/src/wl_window.c"
#endif
#if defined _GLFW_X11
#include "external/glfw/src/x11_init.c"
#include "external/glfw/src/x11_monitor.c"
#include "external/glfw/src/x11_window.c"
#include "external/glfw/src/glx_context.c"
#endif
#include "external/glfw/src/linux_joystick.c"
#include "external/glfw/src/posix_module.c"
Expand All @@ -35,12 +39,14 @@ GLFWbool _glfwConnectNull(int platformID, _GLFWplatform* platform) {
}
#cgo linux CFLAGS: -Iexternal/glfw/include -DPLATFORM_DESKTOP -Wno-stringop-overflow
#cgo linux LDFLAGS: -lm -pthread -ldl -lrt -lwayland-client -lwayland-cursor -lwayland-egl -lxkbcommon
#cgo linux LDFLAGS: -lm -pthread -ldl -lrt -lxkbcommon
#cgo linux,!x11 LDFLAGS: -lwayland-client -lwayland-cursor -lwayland-egl
#cgo linux,x11 CFLAGS: -D_GLFW_X11
#cgo linux,!x11 CFLAGS: -D_GLFW_X11 -D_GLFW_WAYLAND
#cgo linux,wayland CFLAGS: -D_GLFW_WAYLAND
#cgo linux,!x11,!wayland CFLAGS: -D_GLFW_X11 -D_GLFW_WAYLAND
#cgo linux,!es2,!es3 LDFLAGS: -lGL
#cgo linux,!es2,!es3,!wayland LDFLAGS: -lGL
#cgo linux,opengl11,!es2,!es3 CFLAGS: -DGRAPHICS_API_OPENGL_11
#cgo linux,opengl21,!es2,!es3 CFLAGS: -DGRAPHICS_API_OPENGL_21
Expand Down

0 comments on commit 5df9325

Please sign in to comment.