0431e7cb3c
Import osgXR from https://github.com/amalon/osgXR master branch into 3rdparty, specifically commit b7e222775553b529018ac4b847353327c24ae5d4, which is 0.3.7 with tweaks for building as a subproject in a subdirectory. This will allow VR support to be more conveniently built if not already installed, without having to fetch yet another dependency.
79 lines
2.4 KiB
CMake
79 lines
2.4 KiB
CMake
# Top level CMakeLists.txt
|
|
cmake_minimum_required(VERSION 3.11)
|
|
|
|
set(osgXR_MAJOR_VERSION 0)
|
|
set(osgXR_MINOR_VERSION 3)
|
|
set(osgXR_PATCH_VERSION 7)
|
|
set(osgXR_SOVERSION 5)
|
|
|
|
set(osgXR_VERSION "${osgXR_MAJOR_VERSION}.${osgXR_MINOR_VERSION}.${osgXR_PATCH_VERSION}")
|
|
|
|
project(osgXR
|
|
VERSION ${osgXR_VERSION}
|
|
DESCRIPTION "OpenXR integration for OpenSceneGraph applications"
|
|
)
|
|
|
|
if(CMAKE_PROJECT_NAME STREQUAL osgXR)
|
|
# Normal top level project build, install package components
|
|
|
|
include(CMakePackageConfigHelpers)
|
|
include(GNUInstallDirs)
|
|
|
|
# Build options
|
|
option(BUILD_SHARED_LIBS "Whether to build as a shared library" ON)
|
|
option(BUILD_OSGXR_EXAMPLES "Enable to build osgXR examples" OFF)
|
|
|
|
# Source files in src/
|
|
add_subdirectory(src)
|
|
|
|
if(BUILD_OSGXR_EXAMPLES)
|
|
add_subdirectory(examples)
|
|
endif()
|
|
|
|
set(INSTALL_INCDIR "${CMAKE_INSTALL_INCLUDEDIR}")
|
|
|
|
# Preprocess pkgconfig file
|
|
configure_file(osgXR.pc.in osgXR.pc @ONLY)
|
|
|
|
# Preprocess package config
|
|
configure_package_config_file(Config.cmake.in osgXRConfig.cmake
|
|
INSTALL_DESTINATION "${CMAKE_INSTALL_LIBDIR}/cmake/osgXR"
|
|
PATH_VARS INSTALL_INCDIR
|
|
)
|
|
# Build package version file
|
|
write_basic_package_version_file(osgXRConfigVersion.cmake
|
|
VERSION "${PROJECT_VERSION}"
|
|
COMPATIBILITY SameMinorVersion
|
|
)
|
|
|
|
# Install library and headers
|
|
install(TARGETS osgXR
|
|
EXPORT osgXRTargets
|
|
LIBRARY DESTINATION "${CMAKE_INSTALL_LIBDIR}"
|
|
PUBLIC_HEADER DESTINATION "${INSTALL_INCDIR}/osgXR"
|
|
INCLUDES DESTINATION "${INSTALL_INCDIR}"
|
|
)
|
|
# Install pkgconfig file
|
|
install(FILES "${CMAKE_CURRENT_BINARY_DIR}/osgXR.pc"
|
|
DESTINATION "${CMAKE_INSTALL_DATAROOTDIR}/pkgconfig"
|
|
)
|
|
# Install export targets
|
|
install(EXPORT osgXRTargets
|
|
FILE osgXRTargets.cmake
|
|
NAMESPACE osgXR::
|
|
DESTINATION "${CMAKE_INSTALL_LIBDIR}/cmake/osgXR"
|
|
)
|
|
# Install package config and version files
|
|
install(FILES "${CMAKE_CURRENT_BINARY_DIR}/osgXRConfig.cmake"
|
|
"${CMAKE_CURRENT_BINARY_DIR}/osgXRConfigVersion.cmake"
|
|
DESTINATION "${CMAKE_INSTALL_LIBDIR}/cmake/osgXR"
|
|
)
|
|
|
|
else()
|
|
# Subproject build
|
|
|
|
# Just build src/ as a static library
|
|
set(osgXR_LIBRARY_TYPE STATIC)
|
|
add_subdirectory(src)
|
|
|
|
endif()
|