1
0
Fork 0

CMake: Fallback to built-in osgXR library

Fall back to using the new built-in osgXR library in 3rdparty/ if no
system library is provided and OpenXR is available.
This commit is contained in:
James Hogan 2022-01-12 23:25:15 +00:00
parent 0431e7cb3c
commit 595c8a2fcb
No known key found for this signature in database
GPG key ID: 35CEE4862B1023F2
3 changed files with 27 additions and 7 deletions

View file

@ -29,3 +29,7 @@ endif()
if (NOT SYSTEM_CPPUNIT)
add_subdirectory(cppunit)
endif()
if (ENABLE_OSGXR AND NOT ENABLE_SYSTEM_OSGXR)
add_subdirectory(osgXR)
endif()

View file

@ -155,6 +155,13 @@ elseif(${CMAKE_SYSTEM_NAME} MATCHES "Linux" OR
endif()
endif()
if (ENABLE_VR_DEFAULT)
find_package(osgXR 0.3.3 QUIET)
if (osgXR_FOUND)
set(SYSTEM_OSGXR_DEFAULT 1)
endif()
endif()
# FlightGear build options
option(LOGGING "Set to ON to build FlightGear with logging support (default)" ON)
option(JSBSIM_TERRAIN "Set to ON to build FlightGear with JSBSim terrain handling code" ON)
@ -169,6 +176,7 @@ option(SYSTEM_SQLITE "Set to ON to build FlightGear with the system's SQLite
option(ENABLE_IAX "Set to ON to build FlightGear with IAXClient/fgcom built-in (default)" ON)
option(USE_DBUS "Set to ON to build FlightGear with DBus screensaver interaction (default on Linux)" ${USE_DBUS_DEFAULT})
option(ENABLE_VR "Set to ON to build Flightgear with VR support" ${ENABLE_VR_DEFAULT})
option(SYSTEM_OSGXR "Set to ON to build Flightgear with the system's osgXR library" ${SYSTEM_OSGXR_DEFAULT})
option(SYSTEM_SPEEX "Set to ON to build IAXClient with the system's speex and speexdsp library" ${SYSTEM_SPEEX_DEFAULT})
option(SYSTEM_GSM "Set to ON to build IAXClient with the system's GSM library" ${SYSTEM_GSM_DEFAULT})
option(SYSTEM_FLITE "Set to ON to build Flightgear with the system's Flite library" ${SYSTEM_FLITE_DEFAULT})
@ -301,13 +309,21 @@ endif (USE_DBUS)
##############################################################################
## VR setup
if (ENABLE_VR)
find_package(osgXR 0.3.3 QUIET)
if (osgXR_FOUND)
message(STATUS "VR support enabled")
if (SYSTEM_OSGXR AND osgXR_FOUND)
message(STATUS "VR support enabled, using system osgXR library")
add_library(osgXR ALIAS osgXR::osgXR)
set(ENABLE_OSGXR 1)
set(ENABLE_SYSTEM_OSGXR 1)
else()
message(STATUS "VR support disabled, compatible osgXR library not found")
set(ENABLE_OSGXR 0)
find_package(OpenXR QUIET)
if (OpenXR_FOUND)
message(STATUS "VR support enabled, using built-in osgXR library")
set(ENABLE_OSGXR 1)
set(ENABLE_SYSTEM_OSGXR 0)
else()
message(STATUS "VR support disabled, OpenXR not found")
set(ENABLE_OSGXR 0)
endif()
endif()
else()
message(STATUS "VR support disabled")

View file

@ -24,7 +24,7 @@ function(setup_fgfs_libraries target)
endif()
if(ENABLE_OSGXR)
target_link_libraries(${target} osgXR::osgXR)
target_link_libraries(${target} osgXR)
endif()
target_link_libraries(${target} fgsqlite3 fgvoicesynth fgembeddedresources)
@ -118,7 +118,7 @@ function (setup_fgfs_library_includes target)
endif()
if(ENABLE_OSGXR)
_apply_target_includes(${target} osgXR::osgXR)
_apply_target_includes(${target} osgXR)
endif()
_apply_target_includes(${target} fgsqlite3)