Added warning if only one of libcap or libdrm has been found

This commit is contained in:
Loki 2021-09-04 20:15:08 +02:00
parent 81c6ca5915
commit 7fbe9ba34f
2 changed files with 9 additions and 3 deletions

View File

@ -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

View File

@ -1,10 +1,10 @@
#include <drm_fourcc.h>
#include <errno.h>
#include <fcntl.h>
#include <sys/capability.h>
#include <unistd.h>
#include <xf86drm.h>
#include <xf86drmMode.h>
#include <sys/capability.h>
#include <filesystem>
@ -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";