From 3f4ba57a402b6fdf581fb07542c72b03480a00e3 Mon Sep 17 00:00:00 2001 From: James Le Cuirot Date: Sat, 30 May 2026 23:03:13 +0100 Subject: [PATCH 1/2] build(deps): libcap is mandatory on Linux now Signed-off-by: James Le Cuirot --- cmake/compile_definitions/linux.cmake | 22 ++++++++++------------ 1 file changed, 10 insertions(+), 12 deletions(-) diff --git a/cmake/compile_definitions/linux.cmake b/cmake/compile_definitions/linux.cmake index 69b202db1e2..fc9edfe691d 100644 --- a/cmake/compile_definitions/linux.cmake +++ b/cmake/compile_definitions/linux.cmake @@ -89,21 +89,19 @@ endif() if(LIBDRM_FOUND) include_directories(SYSTEM ${LIBDRM_INCLUDE_DIRS}) list(APPEND PLATFORM_LIBRARIES ${LIBDRM_LIBRARIES}) + if(${SUNSHINE_ENABLE_DRM}) + add_compile_definitions(SUNSHINE_BUILD_DRM) + list(APPEND PLATFORM_TARGET_FILES + "${CMAKE_SOURCE_DIR}/src/platform/linux/kmsgrab.cpp") + list(APPEND SUNSHINE_DEFINITIONS EGL_NO_X11=1) + endif() endif() -# drm -if(${SUNSHINE_ENABLE_DRM}) +# Capabilities +if(LINUX) find_package(LIBCAP REQUIRED) -else() - set(LIBCAP_FOUND OFF) -endif() -if(LIBDRM_FOUND AND LIBCAP_FOUND) - add_compile_definitions(SUNSHINE_BUILD_DRM) include_directories(SYSTEM ${LIBCAP_INCLUDE_DIRS}) list(APPEND PLATFORM_LIBRARIES ${LIBCAP_LIBRARIES}) - list(APPEND PLATFORM_TARGET_FILES - "${CMAKE_SOURCE_DIR}/src/platform/linux/kmsgrab.cpp") - list(APPEND SUNSHINE_DEFINITIONS EGL_NO_X11=1) endif() # evdev @@ -288,13 +286,13 @@ elseif(${SUNSHINE_ENABLE_KWIN} AND NOT WAYLAND_FOUND) endif() if(NOT ${CUDA_FOUND} - AND NOT (${LIBDRM_FOUND} AND ${LIBCAP_FOUND}) + AND NOT ${LIBDRM_FOUND} AND NOT ${LIBVA_FOUND} AND NOT ${KWIN_FOUND} AND NOT ${PORTAL_FOUND} AND NOT ${WAYLAND_FOUND} AND NOT ${X11_FOUND}) - message(FATAL_ERROR "Couldn't find either cuda, (libdrm and libcap), libva, kwin, pipewire, portal, wayland or x11") + message(FATAL_ERROR "Couldn't find either cuda, libdrm, libva, kwin, pipewire, portal, wayland or x11") endif() # These need to be set before adding the inputtino subdirectory in order for them to be picked up From a167e8339eca638b25c8570f08ba99942e26ad93 Mon Sep 17 00:00:00 2001 From: James Le Cuirot Date: Sat, 30 May 2026 23:26:18 +0100 Subject: [PATCH 2/2] build(deps): fix use of libdrm headers when DRM capture is disabled Signed-off-by: James Le Cuirot --- cmake/compile_definitions/linux.cmake | 8 +++++--- 1 file changed, 5 insertions(+), 3 deletions(-) diff --git a/cmake/compile_definitions/linux.cmake b/cmake/compile_definitions/linux.cmake index fc9edfe691d..60c90349377 100644 --- a/cmake/compile_definitions/linux.cmake +++ b/cmake/compile_definitions/linux.cmake @@ -80,16 +80,18 @@ if(CUDA_FOUND) add_compile_definitions(SUNSHINE_BUILD_CUDA) endif() -# libdrm is required for DRM (KMS), KWin ScreenCast and Wayland -if(${SUNSHINE_ENABLE_DRM} OR ${SUNSHINE_ENABLE_KWIN} OR ${SUNSHINE_ENABLE_WAYLAND}) +# libdrm is required for DRM (KMS). Only the headers are required for Wayland, +# Vulkan, and PipeWire (KWin, Portal). +if(${SUNSHINE_ENABLE_DRM} OR ${SUNSHINE_ENABLE_WAYLAND} OR ${SUNSHINE_ENABLE_VULKAN} + OR ${SUNSHINE_ENABLE_KWIN} OR ${SUNSHINE_ENABLE_PORTAL}) find_package(LIBDRM REQUIRED) else() set(LIBDRM_FOUND OFF) endif() if(LIBDRM_FOUND) include_directories(SYSTEM ${LIBDRM_INCLUDE_DIRS}) - list(APPEND PLATFORM_LIBRARIES ${LIBDRM_LIBRARIES}) if(${SUNSHINE_ENABLE_DRM}) + list(APPEND PLATFORM_LIBRARIES ${LIBDRM_LIBRARIES}) add_compile_definitions(SUNSHINE_BUILD_DRM) list(APPEND PLATFORM_TARGET_FILES "${CMAKE_SOURCE_DIR}/src/platform/linux/kmsgrab.cpp")