From 8d14e7c6f15a3dd5d29f99268bf0fdd4982da753 Mon Sep 17 00:00:00 2001 From: James Le Cuirot Date: Mon, 1 Jan 2024 16:49:00 +0000 Subject: [PATCH] Optionally allow the system installation of wayland-protocols to be used (#1966) --- cmake/compile_definitions/linux.cmake | 11 +++++++++-- cmake/macros/linux.cmake | 8 ++++---- cmake/prep/options.cmake | 1 + 3 files changed, 14 insertions(+), 6 deletions(-) diff --git a/cmake/compile_definitions/linux.cmake b/cmake/compile_definitions/linux.cmake index c4950809..af35a09d 100644 --- a/cmake/compile_definitions/linux.cmake +++ b/cmake/compile_definitions/linux.cmake @@ -129,8 +129,15 @@ endif() if(WAYLAND_FOUND) add_compile_definitions(SUNSHINE_BUILD_WAYLAND) - GEN_WAYLAND("wayland-protocols" "unstable/xdg-output" xdg-output-unstable-v1) - GEN_WAYLAND("wlr-protocols" "unstable" wlr-export-dmabuf-unstable-v1) + if(NOT SUNSHINE_SYSTEM_WAYLAND_PROTOCOLS) + set(WAYLAND_PROTOCOLS_DIR "${CMAKE_SOURCE_DIR}/third-party/wayland-protocols") + else() + pkg_get_variable(WAYLAND_PROTOCOLS_DIR wayland-protocols pkgdatadir) + pkg_check_modules(WAYLAND_PROTOCOLS wayland-protocols REQUIRED) + endif() + + GEN_WAYLAND("${WAYLAND_PROTOCOLS_DIR}" "unstable/xdg-output" xdg-output-unstable-v1) + GEN_WAYLAND("${CMAKE_SOURCE_DIR}/third-party/wlr-protocols" "unstable" wlr-export-dmabuf-unstable-v1) include_directories( SYSTEM diff --git a/cmake/macros/linux.cmake b/cmake/macros/linux.cmake index d84d0452..0bb5e043 100644 --- a/cmake/macros/linux.cmake +++ b/cmake/macros/linux.cmake @@ -5,17 +5,17 @@ macro(GEN_WAYLAND wayland_directory subdirectory filename) file(MAKE_DIRECTORY ${CMAKE_BINARY_DIR}/generated-src) message("wayland-scanner private-code \ -${CMAKE_SOURCE_DIR}/third-party/${wayland_directory}/${subdirectory}/${filename}.xml \ +${wayland_directory}/${subdirectory}/${filename}.xml \ ${CMAKE_BINARY_DIR}/generated-src/${filename}.c") message("wayland-scanner client-header \ -${CMAKE_SOURCE_DIR}/third-party/${wayland_directory}/${subdirectory}/${filename}.xml \ +${wayland_directory}/${subdirectory}/${filename}.xml \ ${CMAKE_BINARY_DIR}/generated-src/${filename}.h") execute_process( COMMAND wayland-scanner private-code - ${CMAKE_SOURCE_DIR}/third-party/${wayland_directory}/${subdirectory}/${filename}.xml + ${wayland_directory}/${subdirectory}/${filename}.xml ${CMAKE_BINARY_DIR}/generated-src/${filename}.c COMMAND wayland-scanner client-header - ${CMAKE_SOURCE_DIR}/third-party/${wayland_directory}/${subdirectory}/${filename}.xml + ${wayland_directory}/${subdirectory}/${filename}.xml ${CMAKE_BINARY_DIR}/generated-src/${filename}.h RESULT_VARIABLE EXIT_INT diff --git a/cmake/prep/options.cmake b/cmake/prep/options.cmake index cb264618..dc6b5f6e 100644 --- a/cmake/prep/options.cmake +++ b/cmake/prep/options.cmake @@ -5,6 +5,7 @@ option(SUNSHINE_ENABLE_TRAY "Enable system tray icon. This option will be ignore option(SUNSHINE_REQUIRE_TRAY "Require system tray icon. Fail the build if tray requirements are not met." ON) option(SUNSHINE_SYSTEM_MINIUPNP "Use system installation of MiniUPnP rather than the submodule." OFF) +option(SUNSHINE_SYSTEM_WAYLAND_PROTOCOLS "Use system installation of wayland-protocols rather than the submodule." OFF) if(APPLE) option(SUNSHINE_CONFIGURE_PORTFILE