mirror of
https://gitlab.freedesktop.org/monado/monado.git
synced 2025-01-27 17:08:36 +00:00
cmake: add MND_libmonado_path in openxr manifest
Part-of: <https://gitlab.freedesktop.org/monado/monado/-/merge_requests/2285>
This commit is contained in:
parent
8e407e9683
commit
49a2066025
|
@ -59,7 +59,7 @@ set(_KHR_MANIFEST_SCRIPT
|
|||
|
||||
function(generate_khr_manifest_buildtree)
|
||||
set(options)
|
||||
set(oneValueArgs MANIFEST_TEMPLATE TARGET OUT_FILE MANIFEST_DESCRIPTION)
|
||||
set(oneValueArgs MANIFEST_TEMPLATE TARGET OUT_FILE MANIFEST_DESCRIPTION LIBMONADO)
|
||||
set(multiValueArgs)
|
||||
cmake_parse_arguments(_genmanifest "${options}" "${oneValueArgs}"
|
||||
"${multiValueArgs}" ${ARGN})
|
||||
|
@ -76,6 +76,9 @@ function(generate_khr_manifest_buildtree)
|
|||
if(NOT _genmanifest_MANIFEST_DESCRIPTION)
|
||||
message(FATAL_ERROR "Need MANIFEST_DESCRIPTION specified!")
|
||||
endif()
|
||||
if(_genmanifest_LIBMONADO)
|
||||
set(_libmonado $<TARGET_FILE:${_genmanifest_LIBMONADO}>)
|
||||
endif()
|
||||
|
||||
# Set template values
|
||||
set(_genmanifest_INTERMEDIATE_MANIFEST
|
||||
|
@ -93,6 +96,7 @@ function(generate_khr_manifest_buildtree)
|
|||
BYPRODUCTS "${_genmanifest_OUT_FILE}"
|
||||
COMMAND
|
||||
"${CMAKE_COMMAND}" "-DOUT_FILE=${_genmanifest_OUT_FILE}"
|
||||
"-DLIBMONADO=${_libmonado}"
|
||||
"-DTARGET_PATH=$<TARGET_FILE:${_genmanifest_TARGET}>" -P
|
||||
"${_script}" DEPENDS "${_script}"
|
||||
COMMENT
|
||||
|
@ -110,7 +114,9 @@ function(generate_khr_manifest_at_install)
|
|||
TARGET_DIR_RELATIVE_TO_MANIFEST
|
||||
RELATIVE_TARGET_DIR
|
||||
MANIFEST_DESCRIPTION
|
||||
COMPONENT)
|
||||
COMPONENT
|
||||
LIBMONADO
|
||||
)
|
||||
set(multiValueArgs)
|
||||
cmake_parse_arguments(_genmanifest "${options}" "${oneValueArgs}"
|
||||
"${multiValueArgs}" ${ARGN})
|
||||
|
@ -140,6 +146,9 @@ function(generate_khr_manifest_at_install)
|
|||
set(TARGET_FILENAME
|
||||
${CMAKE_SHARED_MODULE_PREFIX}${_genmanifest_TARGET}${CMAKE_SHARED_MODULE_SUFFIX}
|
||||
)
|
||||
if(_genmanifest_LIBMONADO)
|
||||
set(LIBMONADO ${CMAKE_SHARED_MODULE_PREFIX}${_genmanifest_LIBMONADO}${CMAKE_SHARED_MODULE_SUFFIX})
|
||||
endif()
|
||||
|
||||
set(_script
|
||||
${CMAKE_CURRENT_BINARY_DIR}/make_manifest_${_genmanifest_TARGET}.cmake)
|
||||
|
|
|
@ -23,6 +23,7 @@ set(TARGET_DIR_RELATIVE_TO_MANIFEST
|
|||
@_genmanifest_TARGET_DIR_RELATIVE_TO_MANIFEST@)
|
||||
# Config option
|
||||
set(ABSOLUTE_TARGET_PATH @_genmanifest_ABSOLUTE_TARGET_PATH@)
|
||||
set(LIBMONADO @LIBMONADO@)
|
||||
|
||||
if(TARGET_PATH)
|
||||
# This is at build time, not install time
|
||||
|
@ -36,6 +37,12 @@ elseif(ABSOLUTE_TARGET_PATH)
|
|||
if(NOT IS_ABSOLUTE ${RELATIVE_TARGET_DIR})
|
||||
set(TARGET_PATH ${CMAKE_INSTALL_PREFIX}/${TARGET_PATH})
|
||||
endif()
|
||||
if(LIBMONADO)
|
||||
set(LIBMONADO ${RELATIVE_TARGET_DIR}/${LIBMONADO})
|
||||
if(NOT IS_ABSOLUTE ${RELATIVE_TARGET_DIR})
|
||||
set(LIBMONADO ${CMAKE_INSTALL_PREFIX}/${LIBMONADO})
|
||||
endif()
|
||||
endif()
|
||||
elseif(TARGET_DIR_RELATIVE_TO_MANIFEST)
|
||||
# Relative path to target.
|
||||
message(
|
||||
|
@ -43,6 +50,10 @@ elseif(TARGET_DIR_RELATIVE_TO_MANIFEST)
|
|||
"Installing ${MANIFEST_DESCRIPTION} with JSON-relative path to library"
|
||||
)
|
||||
set(TARGET_PATH ${TARGET_DIR_RELATIVE_TO_MANIFEST}/${TARGET_FILENAME})
|
||||
if(LIBMONADO)
|
||||
get_filename_component(LIBMONADO ${LIBMONADO} NAME)
|
||||
set(LIBMONADO ${TARGET_DIR_RELATIVE_TO_MANIFEST}/${LIBMONADO})
|
||||
endif()
|
||||
else()
|
||||
# Unqualified filename: requires it exist on the system shared library search path.
|
||||
message(
|
||||
|
@ -50,6 +61,13 @@ else()
|
|||
"Installing ${MANIFEST_DESCRIPTION} with unqualified library filename (uses system search path)"
|
||||
)
|
||||
set(TARGET_PATH ${TARGET_FILENAME})
|
||||
if(LIBMONADO)
|
||||
get_filename_component(LIBMONADO ${LIBMONADO} NAME)
|
||||
endif()
|
||||
endif()
|
||||
|
||||
if(LIBMONADO)
|
||||
set(extra_fields ",\n \"MND_libmonado_path\": \"${LIBMONADO}\"")
|
||||
endif()
|
||||
|
||||
if(WIN32)
|
||||
|
|
|
@ -42,6 +42,7 @@ The following functions are provided by this module:
|
|||
# runtime directory relative to the manifest directory in the installed layout
|
||||
[OUT_FILENAME <outfilename> # Optional: Alternate name of the manifest file to generate
|
||||
[MANIFEST_TEMPLATE <template>] # Optional: Specify an alternate template to use
|
||||
[LIBMONADO <path>] # Optional: path to libmonado to include in manifest
|
||||
)
|
||||
#]]
|
||||
|
||||
|
@ -57,7 +58,7 @@ set(_OXR_MANIFEST_TEMPLATE
|
|||
|
||||
function(generate_openxr_runtime_manifest_buildtree)
|
||||
set(options)
|
||||
set(oneValueArgs MANIFEST_TEMPLATE RUNTIME_TARGET OUT_FILE)
|
||||
set(oneValueArgs MANIFEST_TEMPLATE RUNTIME_TARGET OUT_FILE LIBMONADO)
|
||||
set(multiValueArgs)
|
||||
cmake_parse_arguments(_genmanifest "${options}" "${oneValueArgs}"
|
||||
"${multiValueArgs}" ${ARGN})
|
||||
|
@ -80,7 +81,10 @@ function(generate_openxr_runtime_manifest_buildtree)
|
|||
TARGET
|
||||
"${_genmanifest_RUNTIME_TARGET}"
|
||||
OUT_FILE
|
||||
"${_genmanifest_OUT_FILE}")
|
||||
"${_genmanifest_OUT_FILE}"
|
||||
LIBMONADO
|
||||
"${_genmanifest_LIBMONADO}"
|
||||
)
|
||||
|
||||
endfunction()
|
||||
|
||||
|
@ -93,7 +97,9 @@ function(generate_openxr_runtime_manifest_at_install)
|
|||
COMPONENT
|
||||
RUNTIME_TARGET
|
||||
RUNTIME_DIR_RELATIVE_TO_MANIFEST
|
||||
RELATIVE_RUNTIME_DIR)
|
||||
RELATIVE_RUNTIME_DIR
|
||||
LIBMONADO
|
||||
)
|
||||
set(multiValueArgs)
|
||||
cmake_parse_arguments(_genmanifest "${options}" "${oneValueArgs}"
|
||||
"${multiValueArgs}" ${ARGN})
|
||||
|
@ -141,5 +147,8 @@ function(generate_openxr_runtime_manifest_at_install)
|
|||
RELATIVE_TARGET_DIR
|
||||
"${_genmanifest_RELATIVE_RUNTIME_DIR}"
|
||||
OUT_FILENAME
|
||||
"${_genmanifest_OUT_FILENAME}")
|
||||
"${_genmanifest_OUT_FILENAME}"
|
||||
LIBMONADO
|
||||
"${_genmanifest_LIBMONADO}"
|
||||
)
|
||||
endfunction()
|
||||
|
|
|
@ -2,6 +2,6 @@
|
|||
"file_format_version": "1.0.0",
|
||||
"runtime": {
|
||||
"name": "Monado",
|
||||
"library_path": "@target_path@"
|
||||
"library_path": "@target_path@"@extra_fields@
|
||||
}
|
||||
}
|
||||
|
|
|
@ -7,6 +7,11 @@
|
|||
|
||||
add_subdirectory(common)
|
||||
|
||||
# Monado management library
|
||||
if(XRT_FEATURE_SERVICE AND XRT_HAVE_LINUX)
|
||||
add_subdirectory(libmonado)
|
||||
endif()
|
||||
|
||||
if(XRT_FEATURE_OPENXR)
|
||||
add_subdirectory(openxr)
|
||||
endif()
|
||||
|
@ -41,8 +46,3 @@ if(XRT_FEATURE_SERVICE
|
|||
)
|
||||
add_subdirectory(sdl_test)
|
||||
endif()
|
||||
|
||||
# Monado management library
|
||||
if(XRT_FEATURE_SERVICE AND XRT_HAVE_LINUX)
|
||||
add_subdirectory(libmonado)
|
||||
endif()
|
||||
|
|
|
@ -64,8 +64,14 @@ else()
|
|||
set(DEV_MANIFEST_OUTPUT "${CMAKE_BINARY_DIR}/${RUNTIME_TARGET}-dev.json")
|
||||
endif()
|
||||
|
||||
set(_libmonado_arg)
|
||||
if(TARGET monado)
|
||||
set(_libmonado_arg LIBMONADO monado)
|
||||
endif()
|
||||
|
||||
include(GenerateOpenXRRuntimeManifest)
|
||||
generate_openxr_runtime_manifest_buildtree(
|
||||
${_libmonado_arg}
|
||||
RUNTIME_TARGET ${RUNTIME_TARGET} #
|
||||
OUT_FILE ${DEV_MANIFEST_OUTPUT}
|
||||
)
|
||||
|
@ -118,7 +124,7 @@ elseif(NOT ANDROID)
|
|||
set(_extra_args RUNTIME_DIR_RELATIVE_TO_MANIFEST ../../../${CMAKE_INSTALL_LIBDIR})
|
||||
endif()
|
||||
generate_openxr_runtime_manifest_at_install(
|
||||
${_extra_args}
|
||||
${_extra_args} ${_libmonado_arg}
|
||||
RUNTIME_TARGET ${RUNTIME_TARGET}
|
||||
DESTINATION share/openxr/${XR_API_MAJOR}
|
||||
RELATIVE_RUNTIME_DIR ${CMAKE_INSTALL_LIBDIR}
|
||||
|
|
Loading…
Reference in a new issue