cmake: Use host wayland-scanner only (#4873)
1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 28 29 30 31 32 33 34 35 36 37 38 39 40 41 42 43 44 45 46 47 48
diff --git a/cmake/sdlchecks.cmake b/cmake/sdlchecks.cmake
index 89af6c7..47d180e 100644
--- a/cmake/sdlchecks.cmake
+++ b/cmake/sdlchecks.cmake
@@ -597,30 +597,31 @@ endmacro()
# - HAVE_SDL_LOADSO opt
macro(CheckWayland)
if(SDL_WAYLAND)
- pkg_check_modules(WAYLAND wayland-client wayland-scanner wayland-egl wayland-cursor egl "xkbcommon>=0.5.0")
- pkg_check_modules(WAYLAND_SCANNER_1_15 "wayland-scanner>=1.15")
+ pkg_check_modules(WAYLAND wayland-client wayland-egl wayland-cursor egl "xkbcommon>=0.5.0")
- if(WAYLAND_FOUND AND HAVE_OPENGL_EGL)
+ if(WAYLAND_FOUND)
+ find_program(WAYLAND_SCANNER NAMES wayland-scanner REQUIRED)
execute_process(
- COMMAND ${PKG_CONFIG_EXECUTABLE} --variable=wayland_scanner wayland-scanner
- WORKING_DIRECTORY "${CMAKE_CURRENT_BINARY_DIR}"
- RESULT_VARIABLE WAYLAND_SCANNER_RC
- OUTPUT_VARIABLE WAYLAND_SCANNER
- ERROR_QUIET
- OUTPUT_STRIP_TRAILING_WHITESPACE
+ COMMAND ${WAYLAND_SCANNER} --version
+ RESULT_VARIABLE WAYLAND_SCANNER_VERSION_RC
+ ERROR_VARIABLE WAYLAND_SCANNER_VERSION
+ ERROR_STRIP_TRAILING_WHITESPACE
)
- if(NOT WAYLAND_SCANNER_RC EQUAL 0)
+ if(NOT WAYLAND_SCANNER_VERSION_RC EQUAL 0)
+ message(FATAL "Failed to get wayland-scanner version")
set(WAYLAND_FOUND FALSE)
endif()
- endif()
+ string(REPLACE "wayland-scanner " "" WAYLAND_SCANNER_VERSION ${WAYLAND_SCANNER_VERSION})
- if(WAYLAND_FOUND)
+ string(COMPARE GREATER_EQUAL ${WAYLAND_SCANNER_VERSION} "1.15.0" WAYLAND_SCANNER_1_15_FOUND)
if(WAYLAND_SCANNER_1_15_FOUND)
set(WAYLAND_SCANNER_CODE_MODE "private-code")
else()
set(WAYLAND_SCANNER_CODE_MODE "code")
endif()
+ endif()
+ if(WAYLAND_FOUND)
target_link_directories(sdl-build-options INTERFACE "${WAYLAND_LIBRARY_DIRS}")
target_include_directories(sdl-build-options INTERFACE "${WAYLAND_INCLUDE_DIRS}")