Add systemd auto-detection

This commit is contained in:
Patrick Nicolas
2023-12-21 20:28:46 +01:00
parent 714895104c
commit 5c447dd6d7
+12 -2
View File
@@ -17,7 +17,7 @@ include(ExternalProject)
include("cmake/AutoOption.cmake")
option(WIVRN_USE_SYSTEM_FREETYPE "Use system FreeType" ON)
option(WIVRN_USE_SYSTEMD "Use systemd" ON)
auto_option(WIVRN_USE_SYSTEMD "Use libsystemd, required to show pretty hostname" AUTO)
option(WIVRN_USE_ANDROID_VALIDATION_LAYER "Download the android version of the Vulkan validation layer" OFF)
option(WIVRN_BUILD_CLIENT "Build WiVRn client" ON)
option(WIVRN_BUILD_SERVER "Build WiVRn server" ON)
@@ -77,7 +77,14 @@ if (WIVRN_BUILD_SERVER)
pkg_check_modules(X264 REQUIRED IMPORTED_TARGET x264)
endif()
if (WIVRN_USE_SYSTEMD)
if (WIVRN_USE_SYSTEMD STREQUAL "AUTO")
pkg_check_modules(SYSTEMD IMPORTED_TARGET systemd)
if (SYSTEMD_FOUND)
set(WIVRN_USE_SYSTEMD ON)
else()
set(WIVRN_USE_SYSTEMD OFF)
endif()
elseif (WIVRN_USE_SYSTEMD)
pkg_check_modules(SYSTEMD REQUIRED IMPORTED_TARGET systemd)
endif()
@@ -130,4 +137,7 @@ if (WIVRN_BUILD_SERVER)
message("\tNVENC: ${WIVRN_USE_NVENC}")
message("\tVAAPI: ${WIVRN_USE_VAAPI}")
message("\tx264: ${WIVRN_USE_X264}")
message("")
message("Optional features:")
message("\tsystemd: ${WIVRN_USE_SYSTEMD}")
endif()