mirror of
https://gitlab.freedesktop.org/monado/monado.git
synced 2024-12-29 11:06:18 +00:00
oxr: Use an absolute path in the installed runtime manifest.
This commit is contained in:
parent
66086c1b0b
commit
fc98db1439
|
@ -74,11 +74,6 @@ if(DRIVER_LIBRARIES)
|
|||
target_link_libraries(${RUNTIME_TARGET} PRIVATE ${DRIVER_LIBRARIES})
|
||||
endif()
|
||||
|
||||
if(CMAKE_SYSTEM_NAME STREQUAL "Linux")
|
||||
install(FILES "${CMAKE_BINARY_DIR}/${RUNTIME_TARGET}.json" DESTINATION "share/openxr/${XR_API_MAJOR}/")
|
||||
elseif(CMAKE_SYSTEM_NAME STREQUAL "Windows")
|
||||
# TODO: install target on windows
|
||||
endif()
|
||||
include(GNUInstallDirs)
|
||||
|
||||
# Install the runtime itself
|
||||
|
@ -86,3 +81,21 @@ install(TARGETS ${RUNTIME_TARGET}
|
|||
LIBRARY DESTINATION ${CMAKE_INSTALL_LIBDIR}
|
||||
ARCHIVE DESTINATION ${CMAKE_INSTALL_LIBDIR}
|
||||
RUNTIME DESTINATION ${CMAKE_INSTALL_BINDIR})
|
||||
set(MANIFEST_INPUT ${CMAKE_CURRENT_SOURCE_DIR}/openxr_monado.in.json)
|
||||
###
|
||||
# Prepare the installable manifest: will be generated completely at install time,
|
||||
# by a script we generate now.
|
||||
if(CMAKE_SYSTEM_NAME STREQUAL "Linux")
|
||||
set(MANIFEST_RELATIVE_DIR share/openxr/${XR_API_MAJOR}/)
|
||||
|
||||
elseif(CMAKE_SYSTEM_NAME STREQUAL "Windows")
|
||||
# TODO: install target on windows just needs to know where to install manifest
|
||||
set(MANIFEST_RELATIVE_DIR)
|
||||
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})
|
||||
configure_file(make_manifest.cmake ${CMAKE_CURRENT_BINARY_DIR}/make_manifest.cmake @ONLY)
|
||||
install(SCRIPT ${CMAKE_CURRENT_BINARY_DIR}/make_manifest.cmake)
|
||||
endif()
|
||||
|
|
23
src/xrt/targets/openxr/make_manifest.cmake
Normal file
23
src/xrt/targets/openxr/make_manifest.cmake
Normal file
|
@ -0,0 +1,23 @@
|
|||
# SPDX-License-Identifier: BSL-1.0
|
||||
|
||||
# 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@)
|
||||
|
||||
# Remove trailing slash
|
||||
string(REGEX REPLACE "/$" "" MANIFEST_RELATIVE_DIR "${MANIFEST_RELATIVE_DIR}")
|
||||
|
||||
set(RUNTIME_PATH ${CMAKE_INSTALL_PREFIX}/${RUNTIME_RELATIVE_PATH})
|
||||
|
||||
if("x${CMAKE_INSTALL_COMPONENT}x" STREQUAL "xUnspecifiedx" OR NOT CMAKE_INSTALL_COMPONENT)
|
||||
|
||||
# Create manifest
|
||||
configure_file(${MANIFEST_INPUT} ${CMAKE_CURRENT_LIST_DIR}/@RUNTIME_TARGET@.json)
|
||||
|
||||
# Install it
|
||||
file(INSTALL
|
||||
DESTINATION "${CMAKE_INSTALL_PREFIX}/${MANIFEST_RELATIVE_DIR}"
|
||||
TYPE FILE
|
||||
FILES "${CMAKE_CURRENT_LIST_DIR}/@RUNTIME_TARGET@.json")
|
||||
endif()
|
6
src/xrt/targets/openxr/openxr_monado.in.json
Normal file
6
src/xrt/targets/openxr/openxr_monado.in.json
Normal file
|
@ -0,0 +1,6 @@
|
|||
{
|
||||
"file_format_version": "1.0.0",
|
||||
"runtime": {
|
||||
"library_path": "${RUNTIME_PATH}"
|
||||
}
|
||||
}
|
Loading…
Reference in a new issue