From dcdda1044a9f4e71625a963dce827e765bb05142 Mon Sep 17 00:00:00 2001 From: James Hogan Date: Sat, 17 Jul 2021 23:19:14 +0100 Subject: [PATCH] VR: Find the osgXR library Allow the osgXR[1] library to be found and linked against. We'll use this to implement VR in FlightGear. [1] https://github.com/amalon/osgXR --- CMakeLists.txt | 6 ++++++ CMakeModules/SetupFGFSIncludes.cmake | 4 ++++ CMakeModules/SetupFGFSLibraries.cmake | 4 ++++ src/Include/config_cmake.h.in | 2 ++ 4 files changed, 16 insertions(+) diff --git a/CMakeLists.txt b/CMakeLists.txt index 220c3e557..671f83980 100644 --- a/CMakeLists.txt +++ b/CMakeLists.txt @@ -151,6 +151,11 @@ elseif(${CMAKE_SYSTEM_NAME} MATCHES "Linux" OR if(HTS_ENGINE_FOUND) set(SYSTEM_HTS_ENGINE_DEFAULT 1) endif() + + find_package(osgXR 0.3) + if (osgXR_FOUND) + set(ENABLE_OSGXR_DEFAULT 1) + endif() endif() # FlightGear build options @@ -171,6 +176,7 @@ option(SYSTEM_GSM "Set to ON to build IAXClient with the system's GSM lib option(SYSTEM_FLITE "Set to ON to build Flightgear with the system's Flite library" ${SYSTEM_FLITE_DEFAULT}) option(SYSTEM_HTS_ENGINE "Set to ON to build Flightgear with the system's HTS Engine library" ${SYSTEM_HTS_ENGINE_DEFAULT}) option(SYSTEM_CPPUNIT "Set to ON to build Flightgear with the system's CppUnit library") +option(ENABLE_OSGXR "Set to ON to build Flightgear with OpenXR support via the osgXR library" ${ENABLE_OSGXR_DEFAULT}) # additional utilities option(ENABLE_FGELEV "Set to ON to build the fgelev application (default)" ON) diff --git a/CMakeModules/SetupFGFSIncludes.cmake b/CMakeModules/SetupFGFSIncludes.cmake index d0d625352..d47db41a3 100644 --- a/CMakeModules/SetupFGFSIncludes.cmake +++ b/CMakeModules/SetupFGFSIncludes.cmake @@ -4,6 +4,10 @@ function(setup_fgfs_includes target) target_include_directories(${target} PRIVATE ${PROJECT_SOURCE_DIR}/src/FDM/JSBSim) endif() + if(ENABLE_OSGXR) + target_include_directories(${target} PRIVATE ${osgXR_INCLUDE_DIR}) + endif() + target_include_directories(${target} PRIVATE ${PLIB_INCLUDE_DIR}) target_include_directories(${target} PRIVATE ${PROJECT_SOURCE_DIR}/3rdparty/cjson) # only actually needed for httpd.cxx diff --git a/CMakeModules/SetupFGFSLibraries.cmake b/CMakeModules/SetupFGFSLibraries.cmake index ae6396946..ad5a23332 100644 --- a/CMakeModules/SetupFGFSLibraries.cmake +++ b/CMakeModules/SetupFGFSLibraries.cmake @@ -23,6 +23,10 @@ function(setup_fgfs_libraries target) target_link_libraries(${target} ${X11_LIBRARIES}) endif() + if(ENABLE_OSGXR) + target_link_libraries(${target} osgXR::osgXR) + endif() + target_link_libraries(${target} fgsqlite3 fgvoicesynth fgembeddedresources) target_link_libraries(${target} diff --git a/src/Include/config_cmake.h.in b/src/Include/config_cmake.h.in index bd69ade93..db44de3b1 100644 --- a/src/Include/config_cmake.h.in +++ b/src/Include/config_cmake.h.in @@ -75,3 +75,5 @@ #cmakedefine HAVE_SENTRY #define SENTRY_API_KEY "@sentry_api_key@" + +#cmakedefine ENABLE_OSGXR