oxr: Allow relative vs absolute manifest path to be selected at configure time.

This commit is contained in:
Ryan Pavlik 2019-06-18 15:09:45 -05:00 committed by Benjamin Saunders
parent 88efae1078
commit c5fea837f3
3 changed files with 13 additions and 3 deletions

View file

@ -10,6 +10,7 @@ if(POLICY CMP0072)
endif()
option(OPENXR_USE_LOADER "Application uses loader" ON)
option(OPENXR_INSTALL_ABSOLUTE_RUNTIME_PATH "Use the absolute path to the runtime in the installed manifest, rather than a relative path." OFF)
option(VULKAN_ENABLE_VALIDATION "Enable Vulkan validation for Compositor" ON)
###

View file

@ -92,7 +92,8 @@ endif()
# If we know where to install the manifest, we can set it up to be installed.
if(MANIFEST_RELATIVE_DIR)
set(RUNTIME_RELATIVE_PATH ${CMAKE_INSTALL_LIBDIR}/${CMAKE_SHARED_MODULE_PREFIX}${RUNTIME_TARGET}${CMAKE_SHARED_MODULE_SUFFIX})
set(RUNTIME_RELATIVE_DIR ${CMAKE_INSTALL_LIBDIR})
set(RUNTIME_FILENAME ${CMAKE_SHARED_MODULE_PREFIX}${RUNTIME_TARGET}${CMAKE_SHARED_MODULE_SUFFIX})
configure_file(make_manifest.cmake ${CMAKE_CURRENT_BINARY_DIR}/make_manifest.cmake @ONLY)
install(SCRIPT ${CMAKE_CURRENT_BINARY_DIR}/make_manifest.cmake)
endif()

View file

@ -3,12 +3,20 @@
# Get input from main CMake script
set(MANIFEST_INPUT @MANIFEST_INPUT@)
set(MANIFEST_RELATIVE_DIR @MANIFEST_RELATIVE_DIR@)
set(RUNTIME_RELATIVE_PATH @RUNTIME_RELATIVE_PATH@)
set(RUNTIME_RELATIVE_DIR @RUNTIME_RELATIVE_DIR@)
set(RUNTIME_FILENAME @RUNTIME_FILENAME@)
set(OPENXR_INSTALL_ABSOLUTE_RUNTIME_PATH @OPENXR_INSTALL_ABSOLUTE_RUNTIME_PATH@)
# Remove trailing slash
string(REGEX REPLACE "/$" "" MANIFEST_RELATIVE_DIR "${MANIFEST_RELATIVE_DIR}")
set(RUNTIME_PATH ${CMAKE_INSTALL_PREFIX}/${RUNTIME_RELATIVE_PATH})
if(OPENXR_INSTALL_ABSOLUTE_RUNTIME_PATH)
# Absolute path to runtime
set(RUNTIME_PATH ${CMAKE_INSTALL_PREFIX}/${RUNTIME_RELATIVE_DIR}/${RUNTIME_FILENAME})
else()
# Relative path to runtime: requires it exist on the system shared library search path.
set(RUNTIME_PATH ${RUNTIME_FILENAME})
endif()
if("x${CMAKE_INSTALL_COMPONENT}x" STREQUAL "xUnspecifiedx" OR NOT CMAKE_INSTALL_COMPONENT)