Update CMakeLists.txt
This commit is contained in:
+31
-87
@@ -18,13 +18,12 @@ set(CMAKE_POSITION_INDEPENDENT_CODE ON)
|
||||
include(FetchContent)
|
||||
include(ExternalProject)
|
||||
include(GNUInstallDirs)
|
||||
include("cmake/AutoOption.cmake")
|
||||
|
||||
option(WIVRN_USE_SYSTEM_FREETYPE "Use system FreeType" ON)
|
||||
auto_option(WIVRN_USE_SYSTEM_BOOST "Use system Boost headers" AUTO)
|
||||
auto_option(WIVRN_USE_SYSTEM_OPENXR "Use system OpenXR headers" AUTO)
|
||||
auto_option(WIVRN_USE_SYSTEMD "Use libsystemd" AUTO)
|
||||
auto_option(WIVRN_USE_LIBKTX "Use libktx" AUTO)
|
||||
option(WIVRN_USE_SYSTEM_BOOST "Use system Boost headers" ON)
|
||||
option(WIVRN_USE_SYSTEM_OPENXR "Use system OpenXR headers" ON)
|
||||
option(WIVRN_USE_SYSTEMD "Use libsystemd" ON)
|
||||
option(WIVRN_USE_LIBKTX "Use libktx" ${ANDROID})
|
||||
option(WIVRN_USE_ANDROID_VALIDATION_LAYER "Download the android version of the Vulkan validation layer" OFF)
|
||||
option(WIVRN_BUILD_CLIENT "Build WiVRn client" OFF)
|
||||
option(WIVRN_BUILD_SERVER "Build WiVRn server" ON)
|
||||
@@ -37,19 +36,19 @@ option(WIVRN_WERROR "Treat warnings as errors" OFF)
|
||||
option(WIVRN_OPTIMIZE_SHADERS "Run siprv-opt on compiled shaders" ON)
|
||||
|
||||
option(WIVRN_USE_NVENC "Enable nvenc (Nvidia) hardware encoder" ON)
|
||||
auto_option(WIVRN_USE_VAAPI "Enable vaapi (AMD/Intel) hardware encoder" AUTO)
|
||||
auto_option(WIVRN_USE_VULKAN_ENCODE "Enable vulkan video encoder" AUTO)
|
||||
auto_option(WIVRN_USE_X264 "Enable x264 software encoder" AUTO)
|
||||
option(WIVRN_USE_VAAPI "Enable vaapi (AMD/Intel) hardware encoder" ON)
|
||||
option(WIVRN_USE_VULKAN_ENCODE "Enable vulkan video encoder" ON)
|
||||
option(WIVRN_USE_X264 "Enable x264 software encoder" ON)
|
||||
|
||||
auto_option(WIVRN_USE_PIPEWIRE "Enable pipewire backend" AUTO)
|
||||
auto_option(WIVRN_USE_PULSEAUDIO "Enable pulseaudio backend" AUTO)
|
||||
option(WIVRN_USE_PIPEWIRE "Enable pipewire backend" ON)
|
||||
option(WIVRN_USE_PULSEAUDIO "Enable pulseaudio backend" OFF)
|
||||
|
||||
set(OVR_COMPAT_SEARCH_PATH "/usr/local/lib/OpenComposite:/usr/lib/OpenComposite:/opt/OpenComposite:/opt/opencomposite:/opt/xrizer"
|
||||
set(OVR_COMPAT_SEARCH_PATH "/opt/xrizer:/usr/local/lib/OpenComposite:/usr/lib/OpenComposite:/opt/OpenComposite:/opt/opencomposite"
|
||||
CACHE STRING "List of places to search for the OpenVR compatibility layer, separated by :")
|
||||
|
||||
option(WIVRN_FEATURE_DEBUG_GUI "Enable Monado debug GUI" OFF)
|
||||
option(WIVRN_FEATURE_RENDERDOC "Support renderdoc" OFF)
|
||||
option(WIVRN_FEATURE_SOLARXR "Enable SolarXR driver" OFF)
|
||||
set(WIVRN_FEATURE_SOLARXR OFF) # Will be added back when merged in upstream Monado
|
||||
option(WIVRN_FEATURE_STEAMVR_LIGHTHOUSE "Enable SteamVR Lighthouse driver" OFF)
|
||||
|
||||
option(WIVRN_CHECK_CAPSYSNICE "Check if CAP_SYS_NICE is available at startup" ON)
|
||||
@@ -66,6 +65,12 @@ endif()
|
||||
|
||||
option(ENABLE_COLOURED_OUTPUT "Always produce ANSI-coloured output (GNU/Clang only)." ON)
|
||||
|
||||
if (WIVRN_BUILD_CLIENT OR WIVRN_BUILD_SERVER OR WIVRN_BUILD_DASHBOARD OR WIVRN_BUILD_DISSECTOR)
|
||||
set(NEED_COMMON TRUE)
|
||||
else()
|
||||
set(NEED_COMMON FALSE)
|
||||
endif()
|
||||
|
||||
if(ENABLE_COLOURED_OUTPUT)
|
||||
if("${CMAKE_CXX_COMPILER_ID}" STREQUAL "GNU")
|
||||
add_compile_options(-fdiagnostics-color=always)
|
||||
@@ -77,19 +82,13 @@ endif()
|
||||
find_package(PkgConfig REQUIRED)
|
||||
find_package(Vulkan REQUIRED)
|
||||
find_package(Git)
|
||||
if (NOT ANDROID)
|
||||
if (NEED_COMMON AND NOT ANDROID)
|
||||
find_package(OpenSSL REQUIRED)
|
||||
endif()
|
||||
include(VulkanVersion)
|
||||
|
||||
if (WIVRN_USE_SYSTEM_BOOST STREQUAL "AUTO")
|
||||
if(WIVRN_BUILD_DISSECTOR)
|
||||
find_package(Boost 1.84.0 COMPONENTS locale url)
|
||||
else()
|
||||
find_package(Boost 1.75.0 COMPONENTS locale url)
|
||||
endif()
|
||||
elseif(WIVRN_USE_SYSTEM_BOOST STREQUAL "ON")
|
||||
if(WIVRN_BUILD_DISSECTOR)
|
||||
if (WIVRN_USE_SYSTEM_BOOST AND NEED_COMMON)
|
||||
if (WIVRN_BUILD_DISSECTOR)
|
||||
find_package(Boost 1.84.0 REQUIRED COMPONENTS locale url)
|
||||
else()
|
||||
find_package(Boost 1.75.0 REQUIRED COMPONENTS locale url)
|
||||
@@ -106,72 +105,30 @@ if (WIVRN_BUILD_SERVER)
|
||||
message(FATAL_ERROR "No encoder selected, use at least one of WIVRN_USE_NVENC, WIVRN_USE_VAAPI, WIVRN_USE_VULKAN_ENCODE or WIVRN_USE_X264")
|
||||
endif()
|
||||
|
||||
if (WIVRN_USE_VAAPI STREQUAL "AUTO")
|
||||
pkg_check_modules(LIBAV IMPORTED_TARGET libavcodec libavutil libswscale libavfilter)
|
||||
pkg_check_modules(LIBDRM IMPORTED_TARGET libdrm)
|
||||
if (LIBAV_FOUND AND LIBDRM_FOUND)
|
||||
set(WIVRN_USE_VAAPI ON)
|
||||
else()
|
||||
set(WIVRN_USE_VAAPI OFF)
|
||||
endif()
|
||||
elseif (WIVRN_USE_VAAPI)
|
||||
if (WIVRN_USE_VAAPI)
|
||||
pkg_check_modules(LIBAV REQUIRED IMPORTED_TARGET libavcodec libavutil libswscale libavfilter)
|
||||
pkg_check_modules(LIBDRM REQUIRED IMPORTED_TARGET libdrm)
|
||||
endif()
|
||||
|
||||
if (WIVRN_USE_VULKAN_ENCODE STREQUAL "AUTO")
|
||||
if (Vulkan_VERSION VERSION_GREATER_EQUAL 1.3.283)
|
||||
set(WIVRN_USE_VULKAN_ENCODE ON)
|
||||
else()
|
||||
set(WIVRN_USE_VULKAN_ENCODE OFF)
|
||||
endif()
|
||||
elseif(WIVRN_USE_VULKAN_ENCODE)
|
||||
if (WIVRN_USE_VULKAN_ENCODE)
|
||||
if (Vulkan_VERSION VERSION_LESS 1.3.283)
|
||||
message(FATAL_ERROR "Vulkan video encode requires 1.3.283, found ${Vulkan_VERSION}")
|
||||
endif()
|
||||
endif()
|
||||
|
||||
if (WIVRN_USE_X264 STREQUAL "AUTO")
|
||||
pkg_check_modules(X264 IMPORTED_TARGET x264)
|
||||
if (X264_FOUND)
|
||||
set(WIVRN_USE_X264 ON)
|
||||
else()
|
||||
set(WIVRN_USE_X264 OFF)
|
||||
endif()
|
||||
elseif (WIVRN_USE_X264)
|
||||
if (WIVRN_USE_X264)
|
||||
pkg_check_modules(X264 REQUIRED IMPORTED_TARGET x264)
|
||||
endif()
|
||||
|
||||
if (WIVRN_USE_SYSTEMD STREQUAL "AUTO")
|
||||
pkg_check_modules(SYSTEMD IMPORTED_TARGET libsystemd)
|
||||
if (SYSTEMD_FOUND)
|
||||
set(WIVRN_USE_SYSTEMD ON)
|
||||
else()
|
||||
set(WIVRN_USE_SYSTEMD OFF)
|
||||
endif()
|
||||
elseif (WIVRN_USE_SYSTEMD)
|
||||
if (WIVRN_USE_SYSTEMD)
|
||||
pkg_check_modules(SYSTEMD REQUIRED IMPORTED_TARGET libsystemd)
|
||||
endif()
|
||||
|
||||
if (WIVRN_USE_PIPEWIRE STREQUAL "AUTO")
|
||||
pkg_check_modules(libpipewire IMPORTED_TARGET libpipewire-0.3)
|
||||
if (libpipewire_FOUND)
|
||||
set(WIVRN_USE_PIPEWIRE ON)
|
||||
else()
|
||||
set(WIVRN_USE_PIPEWIRE OFF)
|
||||
endif()
|
||||
elseif (WIVRN_USE_PIPEWIRE)
|
||||
if (WIVRN_USE_PIPEWIRE)
|
||||
pkg_check_modules(libpipewire REQUIRED IMPORTED_TARGET libpipewire-0.3)
|
||||
endif()
|
||||
|
||||
if (WIVRN_USE_PULSEAUDIO STREQUAL "AUTO")
|
||||
pkg_check_modules(libpulse IMPORTED_TARGET libpulse)
|
||||
if (libpulse_FOUND)
|
||||
set(WIVRN_USE_PULSEAUDIO ON)
|
||||
else()
|
||||
set(WIVRN_USE_PULSEAUDIO OFF)
|
||||
endif()
|
||||
elseif (WIVRN_USE_PULSEAUDIO)
|
||||
if (WIVRN_USE_PULSEAUDIO)
|
||||
pkg_check_modules(libpulse REQUIRED IMPORTED_TARGET libpulse)
|
||||
endif()
|
||||
|
||||
@@ -187,7 +144,8 @@ endif()
|
||||
|
||||
if (WIVRN_BUILD_DASHBOARD OR WIVRN_BUILD_SERVER)
|
||||
pkg_check_modules(librsvg-2.0 REQUIRED IMPORTED_TARGET librsvg-2.0)
|
||||
find_package(PNG)
|
||||
find_package(LibArchive REQUIRED)
|
||||
find_package(PNG REQUIRED)
|
||||
endif()
|
||||
|
||||
if (WIVRN_BUILD_DASHBOARD)
|
||||
@@ -216,23 +174,11 @@ if (WIVRN_BUILD_CLIENT OR WIVRN_BUILD_DASHBOARD)
|
||||
find_package(Gettext REQUIRED)
|
||||
endif()
|
||||
|
||||
if (WIVRN_BUILD_CLIENT)
|
||||
if (WIVRN_USE_LIBKTX STREQUAL "AUTO")
|
||||
if (ANDROID)
|
||||
set(WIVRN_USE_LIBKTX ON)
|
||||
else()
|
||||
set(WIVRN_USE_LIBKTX OFF)
|
||||
endif()
|
||||
endif()
|
||||
endif()
|
||||
|
||||
if (WIVRN_BUILD_CLIENT AND NOT ANDROID)
|
||||
pkg_check_modules(LIBAV REQUIRED IMPORTED_TARGET libavcodec libavutil libswscale libavfilter)
|
||||
find_package(Fontconfig REQUIRED)
|
||||
|
||||
if (WIVRN_USE_SYSTEM_OPENXR STREQUAL "AUTO")
|
||||
find_package(OpenXR 1.1.48)
|
||||
elseif(WIVRN_USE_SYSTEM_OPENXR STREQUAL "ON")
|
||||
if (WIVRN_USE_SYSTEM_OPENXR)
|
||||
find_package(OpenXR 1.1.48 REQUIRED)
|
||||
endif()
|
||||
|
||||
@@ -246,9 +192,7 @@ if(ANDROID)
|
||||
endif()
|
||||
|
||||
if (WIVRN_BUILD_DISSECTOR)
|
||||
if (WIVRN_USE_SYSTEM_OPENXR STREQUAL "AUTO")
|
||||
find_package(OpenXR 1.1.48)
|
||||
elseif(WIVRN_USE_SYSTEM_OPENXR STREQUAL "ON")
|
||||
if (WIVRN_USE_SYSTEM_OPENXR)
|
||||
find_package(OpenXR 1.1.48 REQUIRED)
|
||||
endif()
|
||||
find_package(Wireshark REQUIRED)
|
||||
@@ -305,7 +249,7 @@ FetchContent_Declare(monado
|
||||
)
|
||||
|
||||
add_subdirectory(external)
|
||||
if (WIVRN_BUILD_CLIENT OR WIVRN_BUILD_SERVER OR WIVRN_BUILD_DASHBOARD OR WIVRN_BUILD_DISSECTOR)
|
||||
if (NEED_COMMON)
|
||||
add_subdirectory(common)
|
||||
endif()
|
||||
|
||||
|
||||
Reference in New Issue
Block a user