Skip to content

fix(xmake): compile GLFW Wayland backend on Linux - #66

Merged
sudoevolve merged 1 commit into
sudoevolve:devfrom
Tenire:dev
Sep 3, 2026
Merged

fix(xmake): compile GLFW Wayland backend on Linux#66
sudoevolve merged 1 commit into
sudoevolve:devfrom
Tenire:dev

Conversation

@Tenire

@Tenire Tenire commented Sep 3, 2026

Copy link
Copy Markdown
Contributor

What

  • Hook wayland-scanner protocol code generation and compile Wayland backend sources (wl_init.c, wl_monitor.c, wl_window.c) into eui_glfw on Linux.
  • Maintain dual-backend support (_GLFW_WAYLAND + _GLFW_X11) with graceful fallback to X11-only if Wayland development packages are absent.

Why

  • The vendored GLFW xmake target previously only compiled X11 sources (x11_*.c) with _GLFW_X11, preventing applications from running natively under Wayland compositors and forcing them into XWayland.

How

  • In eui_glfw's on_load, probe for wayland-scanner, wayland-client, and xkbcommon.
  • If found, generate protocol headers and code from 3rd/glfw/deps/wayland/*.xml into target:autogendir(), add _GLFW_WAYLAND, append Wayland source files, and link client libraries.
  • If not found, retain the default X11-only build.

Rationale & Reference

  • Upstream GLFW 3.4 CMake parity: Matches 3rd/glfw/src/CMakeLists.txt (lines 66–107), which generates protocol headers from 3rd/glfw/deps/wayland/*.xml using wayland-scanner (client-header and private-code) and enables both Wayland and X11 by default.
  • Self-contained in tree: The 9 protocol XML files are already bundled in 3rd/glfw/deps/wayland/.
  • Runtime multi-backend selection: GLFW 3.4 dynamically detects WAYLAND_DISPLAY at glfwInit() and prefers native Wayland while dynamically loading client libraries via dlopen.
  • Zero regression on non-Wayland setups: When wayland-scanner or Wayland packages are missing, the target silently falls back to pure X11 without failing configuration or compilation.

What: run wayland-scanner and compile Wayland sources for eui_glfw with X11 fallback.

Why: eui_glfw was configured with X11 sources only on Linux, losing Wayland auto-detection.
@sudoevolve
sudoevolve merged commit 364c5f7 into sudoevolve:dev Sep 3, 2026
8 checks passed
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

2 participants