cmake: Remove the hard dependency on the EGL package from Wayland

Wayland has no need for EGL when building SDL without any type of OpenGL support. Only consider it to be a requirement when OpenGL and/or OpenGL ES support is enabled.

This is not to be confused with the wayland-egl package, which is a helper library that is part of libwayland, and, despite the name, doesn't have a dependency on the actual EGL library either.
This commit is contained in:
Frank Praznik committed 2026-10-24 12:53:06 -04:00
1 parent 9c31e40437
commit 3da8c67d8d
1 file changed
+7 -2
+7 -2
View File
@@ -641,14 +641,13 @@ macro(WaylandProtocolGen _SCANNER _CODE_MODE _XML _PROTL)
endmacro()
# Requires:
# - EGL
# - PkgCheckModules
# Optional:
# - SDL_WAYLAND_SHARED opt
# - HAVE_SDL_LOADSO opt
macro(CheckWayland)
if(SDL_WAYLAND)
set(WAYLAND_PKG_CONFIG_SPEC "wayland-client>=1.18" wayland-egl wayland-cursor egl "xkbcommon>=0.5.0")
set(WAYLAND_PKG_CONFIG_SPEC "wayland-client>=1.18" wayland-egl wayland-cursor "xkbcommon>=0.5.0")
if(PKG_CONFIG_FOUND)
pkg_check_modules(PC_WAYLAND IMPORTED_TARGET ${WAYLAND_PKG_CONFIG_SPEC})
else()
@@ -679,6 +678,12 @@ macro(CheckWayland)
endif()
endif()
# OpenGL presentation on Wayland requires EGL.
if ((HAVE_OPENGL OR HAVE_OPENGLES) AND NOT HAVE_OPENGL_EGL)
message(STATUS "EGL not found and is required for OpenGL presentation on Wayland; disabling")
set(WAYLAND_FOUND FALSE)
endif()
if(WAYLAND_FOUND)
set(HAVE_WAYLAND TRUE)
set(HAVE_SDL_VIDEO TRUE)