Skip to content
Open
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
26 changes: 13 additions & 13 deletions cmake/compile_definitions/linux.cmake
Original file line number Diff line number Diff line change
Expand Up @@ -80,30 +80,30 @@ 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")
list(APPEND SUNSHINE_DEFINITIONS EGL_NO_X11=1)
Comment on lines 92 to +98
Copy link
Copy Markdown
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Should all this just go right under the find_package(LIBDRM REQUIRED)? And do we need the if(${SUNSHINE_ENABLE_DRM}) condition?

Copy link
Copy Markdown
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Should all this just go right under the find_package(LIBDRM REQUIRED) ?

It could, I was just following the (IMHO slightly odd) pattern you have here already.

And do we need the if(${SUNSHINE_ENABLE_DRM}) condition?

As it says, the other cases only require the headers. Without this condition, we would be overlinking. We still need to conditionally build kmsgrab.cpp anyway.

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
Expand Down