From a69bd596d16d3cbc370ccd1523b9835308a6c744 Mon Sep 17 00:00:00 2001 From: Patrick Nicolas Date: Fri, 25 Jul 2025 21:01:55 +0200 Subject: [PATCH] Add common-server CMake library --- CMakeLists.txt | 1 + common/CMakeLists.txt | 24 ++++++++++++++---------- dashboard/CMakeLists.txt | 1 + server/CMakeLists.txt | 1 + 4 files changed, 17 insertions(+), 10 deletions(-) diff --git a/CMakeLists.txt b/CMakeLists.txt index 8a576ba3..7ab8c54b 100644 --- a/CMakeLists.txt +++ b/CMakeLists.txt @@ -31,6 +31,7 @@ option(WIVRN_BUILD_SERVER_LIBRARY "Build OpenXR library for WiVRn server" ${WIVR option(WIVRN_BUILD_DASHBOARD "Build WiVRn dashboard" OFF) option(WIVRN_BUILD_WIVRNCTL "Build wivrnctl" ON) option(WIVRN_BUILD_DISSECTOR "Build Wireshark dissector" OFF) +option(WIVRN_BUILD_TEST "Build test binaries" OFF) option(WIVRN_WERROR "Treat warnings as errors" OFF) option(WIVRN_USE_NVENC "Enable nvenc (Nvidia) hardware encoder" ON) diff --git a/common/CMakeLists.txt b/common/CMakeLists.txt index 75e0e464..a606adda 100644 --- a/common/CMakeLists.txt +++ b/common/CMakeLists.txt @@ -23,20 +23,17 @@ endif() configure_file(wivrn_config.h.in wivrn_config.h) -add_library(wivrn-common-base STATIC - application.cpp - utils/flatpak.cpp +add_library(wivrn-common-base STATIC EXCLUDE_FROM_ALL utils/strings.cpp utils/xdg_base_directory.cpp ${CMAKE_CURRENT_BINARY_DIR}/version.cpp ) -add_library(wivrn-common STATIC +add_library(wivrn-common STATIC EXCLUDE_FROM_ALL crypto.cpp smp.cpp secrets.cpp wivrn_sockets.cpp - utils/xdg_base_directory.cpp utils/strings.cpp vk/allocation.cpp vk/error_category.cpp @@ -44,12 +41,20 @@ add_library(wivrn-common STATIC vk/vk_mem_alloc.cpp ) -if (TEST_APPS) - add_executable(list-apps - test_application.cpp +if (WIVRN_BUILD_DASHBOARD OR WIVRN_BUILD_SERVER) + add_library(wivrn-common-server STATIC EXCLUDE_FROM_ALL + utils/flatpak.cpp + application.cpp ) + target_link_libraries(wivrn-common-server PRIVATE nlohmann_json::nlohmann_json PUBLIC wivrn-common-base) - target_link_libraries(list-apps wivrn-common-base) + if (WIVRN_BUILD_TEST) + add_executable(list-apps + test_application.cpp + ) + + target_link_libraries(list-apps wivrn-common-server) + endif() endif() if(ANDROID) @@ -122,5 +127,4 @@ endif() target_include_directories(wivrn-common-base PUBLIC ${CMAKE_CURRENT_SOURCE_DIR} ${CMAKE_CURRENT_BINARY_DIR}) target_link_libraries(wivrn-common PUBLIC Boost::pfr OpenSSL::Crypto wivrn-external wivrn-common-base) -target_compile_features(wivrn-common PRIVATE cxx_std_20) target_compile_definitions(wivrn-common PUBLIC VULKAN_HPP_NO_STRUCT_CONSTRUCTORS) diff --git a/dashboard/CMakeLists.txt b/dashboard/CMakeLists.txt index 78d7e4b5..b224366e 100644 --- a/dashboard/CMakeLists.txt +++ b/dashboard/CMakeLists.txt @@ -68,6 +68,7 @@ target_link_libraries(wivrn-dashboard QCoro::Network QCoro::Qml wivrn-common-base + wivrn-common-server wivrn-external ) diff --git a/server/CMakeLists.txt b/server/CMakeLists.txt index 3a9d83e9..09fa50f6 100644 --- a/server/CMakeLists.txt +++ b/server/CMakeLists.txt @@ -218,6 +218,7 @@ if (WIVRN_BUILD_SERVER) PkgConfig::AVAHI Eigen3::Eigen wivrn-common + wivrn-common-server wivrn-external nlohmann_json::nlohmann_json )