From 7fbe9ba34f31f2271b27abfdfceaab4983d3c740 Mon Sep 17 00:00:00 2001 From: Loki Date: Sat, 4 Sep 2021 20:15:08 +0200 Subject: [PATCH] Added warning if only one of libcap or libdrm has been found --- CMakeLists.txt | 9 +++++++-- sunshine/platform/linux/kmsgrab.cpp | 3 ++- 2 files changed, 9 insertions(+), 3 deletions(-) diff --git a/CMakeLists.txt b/CMakeLists.txt index 07bf8ea6..8ff42e7a 100644 --- a/CMakeLists.txt +++ b/CMakeLists.txt @@ -137,7 +137,12 @@ else() list(APPEND PLATFORM_LIBRARIES ${LIBDRM_LIBRARIES} ${LIBCAP_LIBRARIES}) list(APPEND PLATFORM_TARGET_FILES sunshine/platform/linux/kmsgrab.cpp) list(APPEND SUNSHINE_DEFINITIONS EGL_NO_X11=1) + elseif(LIBDRM_FOUND) + message(WARNING "Found libdrm, yet there is no libcap") + elseif(LIBDRM_FOUND) + message(WARNING "Found libcap, yet there is no libdrm") endif() + if(WAYLAND_FOUND) add_compile_definitions(SUNSHINE_BUILD_WAYLAND) macro(genWayland FILENAME) @@ -175,8 +180,8 @@ else() sunshine/platform/linux/wlgrab.cpp sunshine/platform/linux/wayland.cpp) endif() - if(NOT ${X11_FOUND} AND NOT ${LIBDRM_FOUND} AND NOT ${WAYLAND_FOUND}) - message(FATAL_ERROR "Couldn't find either x11, wayland or libdrm") + if(NOT ${X11_FOUND} AND NOT (${LIBDRM_FOUND} AND ${LIBCAP_FOUND}) AND NOT ${WAYLAND_FOUND}) + message(FATAL_ERROR "Couldn't find either x11, wayland or (libdrm and libcap)") endif() list(APPEND PLATFORM_TARGET_FILES diff --git a/sunshine/platform/linux/kmsgrab.cpp b/sunshine/platform/linux/kmsgrab.cpp index fab989a7..08668c92 100644 --- a/sunshine/platform/linux/kmsgrab.cpp +++ b/sunshine/platform/linux/kmsgrab.cpp @@ -1,10 +1,10 @@ #include #include #include +#include #include #include #include -#include #include @@ -30,6 +30,7 @@ class cap_sys_admin { public: cap_sys_admin() { caps = cap_get_proc(); + cap_value_t sys_admin = CAP_SYS_ADMIN; if(cap_set_flag(caps, CAP_EFFECTIVE, 1, &sys_admin, CAP_SET) || cap_set_proc(caps)) { BOOST_LOG(error) << "Failed to gain CAP_SYS_ADMIN";