From 5c447dd6d787591296633ac733bc2b42f13deabf Mon Sep 17 00:00:00 2001 From: Patrick Nicolas Date: Thu, 21 Dec 2023 20:28:46 +0100 Subject: [PATCH] Add systemd auto-detection --- CMakeLists.txt | 14 ++++++++++++-- 1 file changed, 12 insertions(+), 2 deletions(-) diff --git a/CMakeLists.txt b/CMakeLists.txt index 9fa11eec..d848a470 100644 --- a/CMakeLists.txt +++ b/CMakeLists.txt @@ -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()