The open source OpenXR runtime
at main 5.6 kB view raw
1# Copyright 2019-2023, Collabora, Ltd. 2# 3# SPDX-License-Identifier: BSL-1.0 4# 5# Maintained by: 6# 2019-2023 Rylie Pavlik <rylie.pavlik@collabora.com> <rylie@ryliepavlik.com> 7 8#[[.rst: 9GenerateOpenXRRuntimeManifest 10--------------- 11 12The following functions are provided by this module: 13 14- :command:`generate_openxr_runtime_manifest_buildtree` 15- :command:`generate_openxr_runtime_manifest_at_install` 16 17 18.. command:: generate_openxr_runtime_manifest_buildtree 19 20 Generates a runtime manifest suitable for use in the build tree, 21 with absolute paths, at configure time:: 22 23 generate_openxr_runtime_manifest_buildtree( 24 RUNTIME_TARGET <target> # Name of your runtime target 25 OUT_FILE <outfile> # Name of the manifest file (with path) to generate 26 [MANIFEST_TEMPLATE <template>] # Optional: Specify an alternate template to use 27 ) 28 29 30.. command:: generate_openxr_runtime_manifest_at_install 31 32 Generates a runtime manifest at install time and installs it where desired:: 33 34 generate_openxr_runtime_manifest_buildtree( 35 RUNTIME_TARGET <target> # Name of your runtime target 36 DESTINATION <dest> # The install-prefix-relative path to install the manifest to. 37 RELATIVE_RUNTIME_DIR <dir> # The install-prefix-relative path that the runtime library is installed to. 38 [COMPONENT <comp>] # If present, the component to place the manifest in. 39 [ABSOLUTE_RUNTIME_PATH| # If present, path in generated manifest is absolute 40 RUNTIME_DIR_RELATIVE_TO_MANIFEST <dir>] 41 # If present (and ABSOLUTE_RUNTIME_PATH not present), specifies the 42 # runtime directory relative to the manifest directory in the installed layout 43 [OUT_FILENAME <outfilename> # Optional: Alternate name of the manifest file to generate 44 [MANIFEST_TEMPLATE <template>] # Optional: Specify an alternate template to use 45 [LIBMONADO <path>] # Optional: path to libmonado to include in manifest 46 ) 47#]] 48 49# This module is mostly just argument parsing, the guts are in GenerateKhrManifest 50 51get_filename_component(_OXR_MANIFEST_CMAKE_DIR "${CMAKE_CURRENT_LIST_FILE}" 52 PATH) 53include("${_OXR_MANIFEST_CMAKE_DIR}/GenerateKhrManifest.cmake") 54 55set(_OXR_MANIFEST_TEMPLATE 56 "${_OXR_MANIFEST_CMAKE_DIR}/openxr_manifest.in.json" 57 CACHE INTERNAL "" FORCE) 58 59function(generate_openxr_runtime_manifest_buildtree) 60 set(options) 61 set(oneValueArgs MANIFEST_TEMPLATE RUNTIME_TARGET OUT_FILE LIBMONADO) 62 set(multiValueArgs) 63 cmake_parse_arguments(_genmanifest "${options}" "${oneValueArgs}" 64 "${multiValueArgs}" ${ARGN}) 65 66 if(NOT _genmanifest_MANIFEST_TEMPLATE) 67 set(_genmanifest_MANIFEST_TEMPLATE "${_OXR_MANIFEST_TEMPLATE}") 68 endif() 69 if(NOT _genmanifest_RUNTIME_TARGET) 70 message(FATAL_ERROR "Need RUNTIME_TARGET specified!") 71 endif() 72 if(NOT _genmanifest_OUT_FILE) 73 message(FATAL_ERROR "Need OUT_FILE specified!") 74 endif() 75 76 generate_khr_manifest_buildtree( 77 MANIFEST_DESCRIPTION 78 "OpenXR runtime manifest" 79 MANIFEST_TEMPLATE 80 "${_genmanifest_MANIFEST_TEMPLATE}" 81 TARGET 82 "${_genmanifest_RUNTIME_TARGET}" 83 OUT_FILE 84 "${_genmanifest_OUT_FILE}" 85 LIBMONADO 86 "${_genmanifest_LIBMONADO}" 87 ) 88 89endfunction() 90 91function(generate_openxr_runtime_manifest_at_install) 92 set(options ABSOLUTE_RUNTIME_PATH) 93 set(oneValueArgs 94 MANIFEST_TEMPLATE 95 DESTINATION 96 OUT_FILENAME 97 COMPONENT 98 RUNTIME_TARGET 99 RUNTIME_DIR_RELATIVE_TO_MANIFEST 100 RELATIVE_RUNTIME_DIR 101 LIBMONADO 102 ) 103 set(multiValueArgs) 104 cmake_parse_arguments(_genmanifest "${options}" "${oneValueArgs}" 105 "${multiValueArgs}" ${ARGN}) 106 107 if(NOT _genmanifest_MANIFEST_TEMPLATE) 108 set(_genmanifest_MANIFEST_TEMPLATE "${_OXR_MANIFEST_TEMPLATE}") 109 endif() 110 if(NOT _genmanifest_RUNTIME_TARGET) 111 message(FATAL_ERROR "Need RUNTIME_TARGET specified!") 112 endif() 113 if(NOT _genmanifest_DESTINATION) 114 message(FATAL_ERROR "Need DESTINATION specified!") 115 endif() 116 if(NOT _genmanifest_RELATIVE_RUNTIME_DIR) 117 message(FATAL_ERROR "Need RELATIVE_RUNTIME_DIR specified!") 118 endif() 119 if(NOT _genmanifest_OUT_FILENAME) 120 set(_genmanifest_OUT_FILENAME "${_genmanifest_RUNTIME_TARGET}.json") 121 endif() 122 123 set(_genmanifest_fwdargs) 124 125 if(_genmanifest_ABSOLUTE_RUNTIME_PATH) 126 list(APPEND _genmanifest_fwdargs ABSOLUTE_TARGET_PATH) 127 endif() 128 129 if(_genmanifest_RUNTIME_DIR_RELATIVE_TO_MANIFEST) 130 list(APPEND _genmanifest_fwdargs TARGET_DIR_RELATIVE_TO_MANIFEST 131 "${_genmanifest_RUNTIME_DIR_RELATIVE_TO_MANIFEST}") 132 endif() 133 if(_genmanifest_COMPONENT) 134 list(APPEND _genmanifest_fwdargs COMPONENT "${_genmanifest_COMPONENT}") 135 endif() 136 137 generate_khr_manifest_at_install( 138 ${_genmanifest_fwdargs} 139 MANIFEST_DESCRIPTION 140 "OpenXR runtime manifest" 141 MANIFEST_TEMPLATE 142 "${_genmanifest_MANIFEST_TEMPLATE}" 143 TARGET 144 "${_genmanifest_RUNTIME_TARGET}" 145 DESTINATION 146 "${_genmanifest_DESTINATION}" 147 RELATIVE_TARGET_DIR 148 "${_genmanifest_RELATIVE_RUNTIME_DIR}" 149 OUT_FILENAME 150 "${_genmanifest_OUT_FILENAME}" 151 LIBMONADO 152 "${_genmanifest_LIBMONADO}" 153 ) 154endfunction()