mirror of
https://gitlab.freedesktop.org/monado/monado.git
synced 2024-12-28 18:46:18 +00:00
70 lines
2.5 KiB
CMake
70 lines
2.5 KiB
CMake
# Copyright 2019-2022, Collabora, Ltd.
|
|
# Copyright 2019, Benjamin Saunders <ben.e.saunders@gmail.com>
|
|
# SPDX-License-Identifier: BSL-1.0
|
|
|
|
# Get input from main CMake script
|
|
set(MANIFEST_TEMPLATE @_genmanifest_MANIFEST_TEMPLATE@)
|
|
set(DESTINATION @_genmanifest_DESTINATION@)
|
|
set(OUT_FILENAME @_genmanifest_OUT_FILENAME@)
|
|
set(CONFIGURE_OUTPUT_FILE @_genmanifest_INTERMEDIATE_MANIFEST@)
|
|
set(IS_INSTALL @_genmanifest_IS_INSTALL@)
|
|
set(RUNTIME_TARGET @_genmanifest_RUNTIME_TARGET@)
|
|
# Runtime install dir relative to install prefix
|
|
set(RELATIVE_RUNTIME_DIR @_genmanifest_RELATIVE_RUNTIME_DIR@)
|
|
# Runtime so/dll filename
|
|
set(RUNTIME_FILENAME @RUNTIME_FILENAME@)
|
|
# The relative path from the manifest dir to the runtime. Optional.
|
|
set(RUNTIME_DIR_RELATIVE_TO_MANIFEST
|
|
@_genmanifest_RUNTIME_DIR_RELATIVE_TO_MANIFEST@)
|
|
# Config option
|
|
set(ABSOLUTE_RUNTIME_PATH @_genmanifest_ABSOLUTE_RUNTIME_PATH@)
|
|
|
|
if(RUNTIME_PATH)
|
|
# This is at build time, not install time
|
|
set(CONFIGURE_OUTPUT_FILE "${OUT_FILE}")
|
|
elseif(ABSOLUTE_RUNTIME_PATH)
|
|
# Absolute path to runtime
|
|
message(
|
|
STATUS
|
|
"Installing OpenXR runtime manifest with absolute path to runtime")
|
|
set(RUNTIME_PATH ${RELATIVE_RUNTIME_DIR}/${RUNTIME_FILENAME})
|
|
if(NOT IS_ABSOLUTE ${RELATIVE_RUNTIME_DIR})
|
|
set(RUNTIME_PATH ${CMAKE_INSTALL_PREFIX}/${RUNTIME_PATH})
|
|
endif()
|
|
elseif(RUNTIME_DIR_RELATIVE_TO_MANIFEST)
|
|
# Relative path to runtime.
|
|
message(
|
|
STATUS
|
|
"Installing OpenXR runtime manifest with JSON-relative path to runtime"
|
|
)
|
|
set(RUNTIME_PATH ${RUNTIME_DIR_RELATIVE_TO_MANIFEST}/${RUNTIME_FILENAME})
|
|
else()
|
|
# Unqualified runtime filename: requires it exist on the system shared library search path.
|
|
message(
|
|
STATUS
|
|
"Installing OpenXR runtime manifest with unqualified runtime filename (uses system search path)"
|
|
)
|
|
set(RUNTIME_PATH ${RUNTIME_FILENAME})
|
|
endif()
|
|
|
|
if(WIN32)
|
|
# Windows really wants backslashes in the manifest, and they must be escaped.
|
|
string(REPLACE "/" [[\\]] RUNTIME_PATH ${RUNTIME_PATH})
|
|
endif()
|
|
|
|
set(runtime_path ${RUNTIME_PATH})
|
|
# Create manifest
|
|
configure_file("${MANIFEST_TEMPLATE}" "${CONFIGURE_OUTPUT_FILE}")
|
|
|
|
if(IS_INSTALL)
|
|
if("x${CMAKE_INSTALL_COMPONENT}x" STREQUAL "xUnspecifiedx"
|
|
OR NOT CMAKE_INSTALL_COMPONENT)
|
|
|
|
# Install it
|
|
file(
|
|
INSTALL
|
|
DESTINATION "${CMAKE_INSTALL_PREFIX}/${DESTINATION}"
|
|
TYPE FILE FILES "${CONFIGURE_OUTPUT_FILE}")
|
|
endif()
|
|
endif()
|