@@ -76,8 +76,8 @@ if(CUDA_FOUND)
7676 add_compile_definitions (SUNSHINE_BUILD_CUDA )
7777endif ()
7878
79- # libdrm is required for both DRM (KMS) and Wayland
80- if (${SUNSHINE_ENABLE_DRM} OR ${SUNSHINE_ENABLE_WAYLAND} )
79+ # libdrm is required for DRM (KMS), KWin ScreenCast and Wayland
80+ if (${SUNSHINE_ENABLE_DRM} OR ${SUNSHINE_ENABLE_KWIN} OR ${ SUNSHINE_ENABLE_WAYLAND} )
8181 find_package (LIBDRM REQUIRED )
8282else ()
8383 set (LIBDRM_FOUND OFF )
@@ -122,8 +122,14 @@ endif()
122122
123123# vulkan video encoding (via FFmpeg)
124124if (${SUNSHINE_ENABLE_VULKAN} )
125- # use Vulkan headers from build-deps submodule (system headers may be too old, e.g. Ubuntu 22.04)
126- set (VULKAN_HEADERS_DIR "${CMAKE_SOURCE_DIR } /third-party/build-deps/third-party/FFmpeg/Vulkan-Headers/include" )
125+ if (NOT SUNSHINE_SYSTEM_VULKAN_HEADERS)
126+ # use Vulkan headers from build-deps submodule (system headers may be too old, e.g. Ubuntu 22.04)
127+ set (VULKAN_HEADERS_DIR "${CMAKE_SOURCE_DIR} /third-party/build-deps/third-party/FFmpeg/Vulkan-Headers/include" )
128+ else ()
129+ find_package (VulkanHeaders REQUIRED )
130+ get_target_property (VULKAN_HEADERS_DIR Vulkan::Headers INTERFACE_INCLUDE_DIRECTORIES )
131+ endif ()
132+
127133 if (NOT EXISTS "${VULKAN_HEADERS_DIR} /vulkan/vulkan.h" )
128134 message (FATAL_ERROR "Vulkan headers not found in build-deps submodule" )
129135 endif ()
@@ -243,7 +249,7 @@ if(GIO_FOUND)
243249endif ()
244250
245251# Pipewire
246- if (${SUNSHINE_ENABLE_PORTAL} )
252+ if (${SUNSHINE_ENABLE_KWIN} OR ${ SUNSHINE_ENABLE_PORTAL} )
247253 pkg_check_modules (PIPEWIRE libpipewire-0.3 REQUIRED )
248254else ()
249255 set (PIPEWIRE_FOUND OFF )
@@ -264,13 +270,27 @@ if(PIPEWIRE_FOUND AND GIO_FOUND AND ${SUNSHINE_ENABLE_PORTAL})
264270 "${CMAKE_SOURCE_DIR} /src/platform/linux/portalgrab.cpp" )
265271endif ()
266272
273+ # KWin ScreenCast (direct Wayland protocol, bypasses portal)
274+ set (KWIN_FOUND OFF )
275+ if (PIPEWIRE_FOUND AND WAYLAND_FOUND AND ${SUNSHINE_ENABLE_KWIN} )
276+ set (KWIN_FOUND ON )
277+ add_compile_definitions (SUNSHINE_BUILD_KWIN )
278+ GEN_WAYLAND ("${CMAKE_SOURCE_DIR} /third-party/plasma-wayland-protocols/src/protocols" "" kde-output-order-v1 )
279+ GEN_WAYLAND ("${CMAKE_SOURCE_DIR} /third-party/plasma-wayland-protocols/src/protocols" "" zkde-screencast-unstable-v1 )
280+ list (APPEND PLATFORM_TARGET_FILES
281+ "${CMAKE_SOURCE_DIR} /src/platform/linux/kwingrab.cpp" )
282+ elseif (${SUNSHINE_ENABLE_KWIN} AND NOT WAYLAND_FOUND)
283+ message (FATAL_ERROR "SUNSHINE_ENABLE_KWIN requires SUNSHINE_ENABLE_WAYLAND — KWin capture disabled" )
284+ endif ()
285+
267286if (NOT ${CUDA_FOUND}
268- AND NOT ${WAYLAND_FOUND}
269- AND NOT ${X11_FOUND}
270- AND NOT ${PORTAL_FOUND}
271287 AND NOT (${LIBDRM_FOUND} AND ${LIBCAP_FOUND} )
272- AND NOT ${LIBVA_FOUND} )
273- message (FATAL_ERROR "Couldn't find either cuda, libva, pipewire, wayland, x11, or (libdrm and libcap)" )
288+ AND NOT ${LIBVA_FOUND}
289+ AND NOT ${KWIN_FOUND}
290+ AND NOT ${PORTAL_FOUND}
291+ AND NOT ${WAYLAND_FOUND}
292+ AND NOT ${X11_FOUND} )
293+ message (FATAL_ERROR "Couldn't find either cuda, (libdrm and libcap), libva, kwin, pipewire, portal, wayland or x11" )
274294endif ()
275295
276296# tray icon
0 commit comments