cmake: Update cmake modules from upstream collection.

Upstream is https://github.com/rpavlik/cmake-modules
This commit is contained in:
Rylie Pavlik 2023-11-15 11:16:49 -06:00 committed by Jakob Bornecrantz
parent e6d54689f9
commit c4e81d3b7c
27 changed files with 506 additions and 157 deletions

View file

@ -9,10 +9,12 @@
# http://academic.cleardefinition.com
# Iowa State University HCI Graduate Program/VRAC
#
# Copyright Iowa State University 2009-2010.
# Copyright 2009-2010, Iowa State University.
#
# Distributed under the Boost Software License, Version 1.0.
# (See accompanying file LICENSE_1_0.txt or copy at
# http://www.boost.org/LICENSE_1_0.txt)
#
# SPDX-License-Identifier: BSL-1.0
if(__clean_directory_list)

View file

@ -33,6 +33,10 @@
# Since pre-1.0.0.
# SPDX-License-Identifier: BSD-3-Clause
#
# Note: This module is originally from the KDE "Extra CMake Modules" repo,
# adapted to work standalone. Original source:
# https://github.com/KDE/extra-cmake-modules/blob/3b0bf71a72789eb2b79310b4f67602115e347f56/find-modules/FindEGL.cmake
#=============================================================================
# Copyright 2014 Alex Merry <alex.merry@kde.org>
# Copyright 2014 Martin Gräßlin <mgraesslin@kde.org>

View file

@ -40,12 +40,14 @@
# ``HIDAPI_LIBRARIES``
#
# Original Author:
# 2009-2010, 2019, 2021 Ryan Pavlik <ryan.pavlik@collabora.com> <abiryan@ryand.net>
# 2009-2021 Ryan Pavlik <ryan.pavlik@collabora.com> <abiryan@ryand.net>
# http://academic.cleardefinition.com
#
# Copyright Iowa State University 2009-2010.
# Copyright Collabora, Ltd. 2019, 2021.
# Copyright 2009-2010, Iowa State University
# Copyright 2019-2021, Collabora, Ltd.
#
# SPDX-License-Identifier: BSL-1.0
#
# Distributed under the Boost Software License, Version 1.0.
# (See accompanying file LICENSE_1_0.txt or copy at
# http://www.boost.org/LICENSE_1_0.txt)

View file

@ -1,5 +1,7 @@
# Copyright 2019-2021, Collabora, Ltd.
#
# SPDX-License-Identifier: BSL-1.0
#
# Distributed under the Boost Software License, Version 1.0.
# (See accompanying file LICENSE_1_0.txt or copy at
# http://www.boost.org/LICENSE_1_0.txt)

View file

@ -1,11 +1,13 @@
# Copyright 2019, 2021 Collabora, Ltd.
# Copyright 2019-2021 Collabora, Ltd.
#
# SPDX-License-Identifier: BSL-1.0
#
# Distributed under the Boost Software License, Version 1.0.
# (See accompanying file LICENSE_1_0.txt or copy at
# http://www.boost.org/LICENSE_1_0.txt)
#
# Original Author:
# 2019, 2021 Ryan Pavlik <ryan.pavlik@collabora.com>
# 2019-2021 Ryan Pavlik <ryan.pavlik@collabora.com>
#.rst:
# FindCheck

View file

@ -14,12 +14,14 @@
# FindPackageHandleStandardArgs (known included with CMake >=2.6.2)
#
# Original Author:
# 2009-2010, 2021 Ryan Pavlik <ryanpavlik@gmail.com> <abiryan@ryand.net>
# 2009-2021 Ryan Pavlik <ryanpavlik@gmail.com> <abiryan@ryand.net>
# http://academic.cleardefinition.com
#
# Copyright Iowa State University 2009-2010.
# Copyright Collabora, Ltd 2021.
# Copyright 2009-2010, Iowa State University
# Copyright 2021, Collabora, Ltd.
#
# SPDX-License-Identifier: BSL-1.0
#
# Distributed under the Boost Software License, Version 1.0.
# (See accompanying file LICENSE_1_0.txt or copy at
# http://www.boost.org/LICENSE_1_0.txt)

View file

@ -1,5 +1,7 @@
# Copyright 2021, Collabora, Ltd.
# Copyright 2021-2022, Collabora, Ltd.
#
# SPDX-License-Identifier: BSL-1.0
#
# Distributed under the Boost Software License, Version 1.0.
# (See accompanying file LICENSE_1_0.txt or copy at
# http://www.boost.org/LICENSE_1_0.txt)

View file

@ -1,11 +1,13 @@
# Copyright 2020-2021 Collabora, Ltd.
# Copyright 2020-2021, Collabora, Ltd.
#
# SPDX-License-Identifier: BSL-1.0
#
# Distributed under the Boost Software License, Version 1.0.
# (See accompanying file LICENSE_1_0.txt or copy at
# http://www.boost.org/LICENSE_1_0.txt)
#
# Original Author:
# 2020-2021 Ryan Pavlik <ryan.pavlik@collabora.com>
# 2020-2021, Ryan Pavlik <ryan.pavlik@collabora.com> <abiryan@ryand.net>
#[[.rst:
FindOpenGLES

View file

@ -1,11 +1,13 @@
# Copyright 2019, 2021 Collabora, Ltd.
# Copyright 2019-2021 Collabora, Ltd.
#
# SPDX-License-Identifier: BSL-1.0
#
# Distributed under the Boost Software License, Version 1.0.
# (See accompanying file LICENSE_1_0.txt or copy at
# http://www.boost.org/LICENSE_1_0.txt)
#
# Original Author:
# 2019, 2021 Ryan Pavlik <ryan.pavlik@collabora.com>
# 2019-2021 Ryan Pavlik <ryan.pavlik@collabora.com> <abiryan@ryand.net>
#.rst:
# FindOpenHMD

View file

@ -1,11 +1,13 @@
# Copyright 2021-2022, Collabora, Ltd.
#
# SPDX-License-Identifier: BSL-1.0
#
# Distributed under the Boost Software License, Version 1.0.
# (See accompanying file LICENSE_1_0.txt or copy at
# http://www.boost.org/LICENSE_1_0.txt)
#
# Original Author:
# 2021-2022 Ryan Pavlik <ryan.pavlik@collabora.com>
# 2021-2022 Ryan Pavlik <ryan.pavlik@collabora.com> <ryan.pavlik@gmail.com>
#[[.rst:
FindPercetto

View file

@ -1,5 +1,7 @@
# Copyright 2022, Collabora, Ltd.
#
# SPDX-License-Identifier: BSL-1.0
#
# Distributed under the Boost Software License, Version 1.0.
# (See accompanying file LICENSE_1_0.txt or copy at
# http://www.boost.org/LICENSE_1_0.txt)

View file

@ -1,11 +1,13 @@
# Copyright 2019-2020, Collabora, Ltd.
# Copyright 2019-2022, Collabora, Ltd.
#
# SPDX-License-Identifier: BSL-1.0
#
# Distributed under the Boost Software License, Version 1.0.
# (See accompanying file LICENSE_1_0.txt or copy at
# http://www.boost.org/LICENSE_1_0.txt)
#
# Original Author:
# 2019-2020 Ryan Pavlik <ryan.pavlik@collabora.com>
# 2019-2022 Ryan Pavlik <ryan.pavlik@collabora.com>
#.rst:
# FindcJSON

View file

@ -14,8 +14,8 @@
# FindPackageHandleStandardArgs (known included with CMake >=2.6.2)
#
# Original Authors:
# 2014 Kevin M. Godby <kevin@godby.org>
# 2021 Ryan Pavlik <ryan.pavlik@collabora.com>
# 2014, Kevin M. Godby <kevin@godby.org>
# 2021, Ryan Pavlik <ryan.pavlik@collabora.com> <abiryan@ryand.net>
#
# Copyright 2014, Kevin M. Godby <kevin@godby.org>
# Copyright 2021, Collabora, Ltd.

View file

@ -0,0 +1,148 @@
# Copyright 2019-2022, Collabora, Ltd.
#
# SPDX-License-Identifier: BSL-1.0
#
# Maintained by:
# 2019-2022 Ryan Pavlik <ryan.pavlik@collabora.com> <ryan.pavlik@gmail.com>
#[[.rst:
GenerateKhrManifest
-------------------
This is a utility module, usually wrapped by more usage-specific modules.
The general goal is to be able to generate a (JSON) manifest describing targets
with some absolute, relative, or unspecified path, such as required by the OpenXR
and Vulkan loaders for runtimes and API layers.
The following functions are provided by this module:
- :command:`generate_khr_manifest_buildtree`
- :command:`generate_khr_manifest_at_install`
.. command:: generate_khr_manifest_buildtree
Generates a manifest suitable for use in the build tree,
with absolute paths, at configure time::
generate_khr_manifest_buildtree(
MANIFEST_TEMPLATE <template> # The template for your manifest file
TARGET <target> # Name of your target (layer, runtime, etc)
OUT_FILE <outfile> # Name of the manifest file (with path) to generate
MANIFEST_DESCRIPTION "<desc>" # A brief description of the thing we're generating (e.g. "Vulkan API layer manifest")
)
.. command:: generate_khr_manifest_at_install
Generates a manifest at install time and installs it where desired::
generate_khr_manifest_at_install(
MANIFEST_TEMPLATE <template> # The template for your manifest file
TARGET <target> # Name of your target (layer, runtime, etc)
DESTINATION <dest> # The install-prefix-relative path to install the manifest to.
RELATIVE_TARGET_DIR <dir> # The install-prefix-relative path that the target library is installed to.
MANIFEST_DESCRIPTION "<desc>" # A brief description of the thing we're generating (e.g. "Vulkan API layer manifest")
[COMPONENT <comp>] # If present, the component to place the manifest in.
[ABSOLUTE_TARGET_PATH| # If present, path in generated manifest is absolute
TARGET_DIR_RELATIVE_TO_MANIFEST <dir>]
# If present (and ABSOLUTE_TARGET_PATH not present), specifies the
# target directory relative to the manifest directory in the installed layout
[OUT_FILENAME <outfilename> # Optional: Alternate name of the manifest file to generate (defaults to target name + .json)
)
#]]
get_filename_component(_KHR_MANIFEST_CMAKE_DIR "${CMAKE_CURRENT_LIST_FILE}"
PATH)
set(_KHR_MANIFEST_SCRIPT
"${_KHR_MANIFEST_CMAKE_DIR}/GenerateKhrManifestInternals.cmake.in"
CACHE INTERNAL "" FORCE)
function(generate_khr_manifest_buildtree)
set(options)
set(oneValueArgs MANIFEST_TEMPLATE TARGET OUT_FILE MANIFEST_DESCRIPTION)
set(multiValueArgs)
cmake_parse_arguments(_genmanifest "${options}" "${oneValueArgs}"
"${multiValueArgs}" ${ARGN})
if(NOT _genmanifest_MANIFEST_TEMPLATE)
message(FATAL_ERROR "Need MANIFEST_TEMPLATE specified!")
endif()
if(NOT _genmanifest_TARGET)
message(FATAL_ERROR "Need TARGET specified!")
endif()
if(NOT _genmanifest_OUT_FILE)
message(FATAL_ERROR "Need OUT_FILE specified!")
endif()
if(NOT _genmanifest_MANIFEST_DESCRIPTION)
message(FATAL_ERROR "Need MANIFEST_DESCRIPTION specified!")
endif()
# Set template values
set(_genmanifest_INTERMEDIATE_MANIFEST
${CMAKE_CURRENT_BINARY_DIR}/intermediate_manifest_buildtree_${_genmanifest_TARGET}.json
)
set(_genmanifest_IS_INSTALL OFF)
set(_script
${CMAKE_CURRENT_BINARY_DIR}/make_build_manifest_${_genmanifest_TARGET}.cmake
)
configure_file("${_KHR_MANIFEST_SCRIPT}" "${_script}" @ONLY)
add_custom_command(
TARGET ${_genmanifest_TARGET}
POST_BUILD
BYPRODUCTS "${_genmanifest_OUT_FILE}"
COMMAND
"${CMAKE_COMMAND}" "-DOUT_FILE=${_genmanifest_OUT_FILE}"
"-DTARGET_PATH=$<TARGET_FILE:${_genmanifest_TARGET}>" -P
"${_script}" DEPENDS "${_script}"
COMMENT
"Generating ${_genmanifest_MANIFEST_DESCRIPTION} named ${_genmanifest_OUT_FILE} for build tree usage"
)
endfunction()
function(generate_khr_manifest_at_install)
set(options ABSOLUTE_TARGET_PATH)
set(oneValueArgs
MANIFEST_TEMPLATE
TARGET
DESTINATION
OUT_FILENAME
TARGET_DIR_RELATIVE_TO_MANIFEST
RELATIVE_TARGET_DIR
MANIFEST_DESCRIPTION
COMPONENT)
set(multiValueArgs)
cmake_parse_arguments(_genmanifest "${options}" "${oneValueArgs}"
"${multiValueArgs}" ${ARGN})
if(NOT _genmanifest_MANIFEST_TEMPLATE)
message(FATAL_ERROR "Need MANIFEST_TEMPLATE specified!")
endif()
if(NOT _genmanifest_TARGET)
message(FATAL_ERROR "Need TARGET specified!")
endif()
if(NOT _genmanifest_DESTINATION)
message(FATAL_ERROR "Need DESTINATION specified!")
endif()
if(NOT _genmanifest_RELATIVE_TARGET_DIR)
message(FATAL_ERROR "Need RELATIVE_TARGET_DIR specified!")
endif()
if(NOT _genmanifest_OUT_FILENAME)
set(_genmanifest_OUT_FILENAME "${_genmanifest_TARGET}.json")
endif()
if(NOT _genmanifest_COMPONENT)
set(_genmanifest_COMPONENT Unspecified)
endif()
set(_genmanifest_INTERMEDIATE_MANIFEST
"${CMAKE_CURRENT_BINARY_DIR}/${_genmanifest_OUT_FILENAME}")
set(_genmanifest_IS_INSTALL ON)
# Template value
set(TARGET_FILENAME
${CMAKE_SHARED_MODULE_PREFIX}${_genmanifest_TARGET}${CMAKE_SHARED_MODULE_SUFFIX}
)
set(_script
${CMAKE_CURRENT_BINARY_DIR}/make_manifest_${_genmanifest_TARGET}.cmake)
configure_file("${_KHR_MANIFEST_SCRIPT}" "${_script}" @ONLY)
install(SCRIPT "${_script}" COMPONENT ${_genmanifest_COMPONENT})
endfunction()

View file

@ -0,0 +1,70 @@
# Copyright 2019-2022, Collabora, Ltd.
# Copyright 2019, Benjamin Saunders <ben.e.saunders@gmail.com>
#
# SPDX-License-Identifier: BSL-1.0
#
# Maintained by:
# 2019-2022 Ryan Pavlik <ryan.pavlik@collabora.com> <ryan.pavlik@gmail.com>
# 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(MANIFEST_DESCRIPTION "@_genmanifest_MANIFEST_DESCRIPTION@")
set(TARGET @_genmanifest_TARGET@)
# Target install dir relative to install prefix
set(RELATIVE_TARGET_DIR @_genmanifest_RELATIVE_TARGET_DIR@)
# Target so/dll filename
set(TARGET_FILENAME @TARGET_FILENAME@)
# The relative path from the manifest dir to the library. Optional.
set(TARGET_DIR_RELATIVE_TO_MANIFEST
@_genmanifest_TARGET_DIR_RELATIVE_TO_MANIFEST@)
# Config option
set(ABSOLUTE_TARGET_PATH @_genmanifest_ABSOLUTE_TARGET_PATH@)
if(TARGET_PATH)
# This is at build time, not install time
set(CONFIGURE_OUTPUT_FILE "${OUT_FILE}")
elseif(ABSOLUTE_TARGET_PATH)
# Absolute path to TARGET
message(
STATUS
"Installing ${MANIFEST_DESCRIPTION} with absolute path to library")
set(TARGET_PATH ${RELATIVE_TARGET_DIR}/${TARGET_FILENAME})
if(NOT IS_ABSOLUTE ${RELATIVE_TARGET_DIR})
set(TARGET_PATH ${CMAKE_INSTALL_PREFIX}/${TARGET_PATH})
endif()
elseif(TARGET_DIR_RELATIVE_TO_MANIFEST)
# Relative path to target.
message(
STATUS
"Installing ${MANIFEST_DESCRIPTION} with JSON-relative path to library"
)
set(TARGET_PATH ${TARGET_DIR_RELATIVE_TO_MANIFEST}/${TARGET_FILENAME})
else()
# Unqualified filename: requires it exist on the system shared library search path.
message(
STATUS
"Installing ${MANIFEST_DESCRIPTION} with unqualified library filename (uses system search path)"
)
set(TARGET_PATH ${TARGET_FILENAME})
endif()
if(WIN32)
# Windows really wants backslashes in the manifest, and they must be escaped.
string(REPLACE "/" [[\\]] TARGET_PATH ${TARGET_PATH})
endif()
set(target_path ${TARGET_PATH})
# Create manifest
configure_file("${MANIFEST_TEMPLATE}" "${CONFIGURE_OUTPUT_FILE}")
if(IS_INSTALL)
# Install it
file(
INSTALL
DESTINATION "${CMAKE_INSTALL_PREFIX}/${DESTINATION}"
TYPE FILE FILES "${CONFIGURE_OUTPUT_FILE}")
endif()

View file

@ -1,5 +1,10 @@
# Copyright 2019-2022, Collabora, Ltd.
# Copyright 2019-2023, Collabora, Ltd.
#
# SPDX-License-Identifier: BSL-1.0
#
# Maintained by:
# 2019-2023 Ryan Pavlik <ryan.pavlik@collabora.com> <ryan.pavlik@gmail.com>
#[[.rst:
GenerateOpenXRRuntimeManifest
---------------
@ -30,6 +35,7 @@ The following functions are provided by this module:
RUNTIME_TARGET <target> # Name of your runtime target
DESTINATION <dest> # The install-prefix-relative path to install the manifest to.
RELATIVE_RUNTIME_DIR <dir> # The install-prefix-relative path that the runtime library is installed to.
[COMPONENT <comp>] # If present, the component to place the manifest in.
[ABSOLUTE_RUNTIME_PATH| # If present, path in generated manifest is absolute
RUNTIME_DIR_RELATIVE_TO_MANIFEST <dir>]
# If present (and ABSOLUTE_RUNTIME_PATH not present), specifies the
@ -38,63 +44,63 @@ The following functions are provided by this module:
[MANIFEST_TEMPLATE <template>] # Optional: Specify an alternate template to use
)
#]]
get_filename_component(_OXR_CMAKE_DIR "${CMAKE_CURRENT_LIST_FILE}" PATH)
set(_OXR_MANIFEST_SCRIPT
"${_OXR_CMAKE_DIR}/GenerateOpenXRRuntimeManifestInstall.cmake.in"
CACHE INTERNAL "" FORCE)
# This module is mostly just argument parsing, the guts are in GenerateKhrManifest
get_filename_component(_OXR_MANIFEST_CMAKE_DIR "${CMAKE_CURRENT_LIST_FILE}"
PATH)
include("${_OXR_MANIFEST_CMAKE_DIR}/GenerateKhrManifest.cmake")
set(_OXR_MANIFEST_TEMPLATE
"${_OXR_CMAKE_DIR}/openxr_monado.in.json"
"${_OXR_MANIFEST_CMAKE_DIR}/openxr_manifest.in.json"
CACHE INTERNAL "" FORCE)
function(generate_openxr_runtime_manifest_buildtree)
set(options)
set(oneValueArgs RUNTIME_TARGET OUT_FILE MANIFEST_TEMPLATE)
set(oneValueArgs MANIFEST_TEMPLATE RUNTIME_TARGET OUT_FILE)
set(multiValueArgs)
cmake_parse_arguments(_genmanifest "${options}" "${oneValueArgs}"
"${multiValueArgs}" ${ARGN})
if(NOT _genmanifest_MANIFEST_TEMPLATE)
set(_genmanifest_MANIFEST_TEMPLATE "${_OXR_MANIFEST_TEMPLATE}")
endif()
if(NOT _genmanifest_RUNTIME_TARGET)
message(FATAL_ERROR "Need RUNTIME_TARGET specified!")
endif()
if(NOT _genmanifest_OUT_FILE)
message(FATAL_ERROR "Need OUT_FILE specified!")
endif()
if(NOT _genmanifest_MANIFEST_TEMPLATE)
set(_genmanifest_MANIFEST_TEMPLATE "${_OXR_MANIFEST_TEMPLATE}")
endif()
# Set template values
set(_genmanifest_INTERMEDIATE_MANIFEST
${CMAKE_CURRENT_BINARY_DIR}/intermediate_manifest_buildtree_${_genmanifest_RUNTIME_TARGET}.json
)
set(_genmanifest_IS_INSTALL OFF)
generate_khr_manifest_buildtree(
MANIFEST_DESCRIPTION
"OpenXR runtime manifest"
MANIFEST_TEMPLATE
"${_genmanifest_MANIFEST_TEMPLATE}"
TARGET
"${_genmanifest_RUNTIME_TARGET}"
OUT_FILE
"${_genmanifest_OUT_FILE}")
set(_script
${CMAKE_CURRENT_BINARY_DIR}/make_build_manifest_${_genmanifest_RUNTIME_TARGET}.cmake
)
configure_file("${_OXR_MANIFEST_SCRIPT}" "${_script}" @ONLY)
add_custom_command(
TARGET ${_genmanifest_RUNTIME_TARGET}
POST_BUILD
BYPRODUCTS "${_genmanifest_OUT_FILE}"
# "${_genmanifest_INTERMEDIATE_MANIFEST}"
COMMAND
"${CMAKE_COMMAND}"
"-DOUT_FILE=${_genmanifest_OUT_FILE}"
"-DRUNTIME_PATH=$<TARGET_FILE:${_genmanifest_RUNTIME_TARGET}>" -P
"${_script}" DEPENDS "${_script}")
endfunction()
function(generate_openxr_runtime_manifest_at_install)
set(options ABSOLUTE_RUNTIME_PATH)
set(oneValueArgs
RUNTIME_TARGET DESTINATION OUT_FILENAME
RUNTIME_DIR_RELATIVE_TO_MANIFEST RELATIVE_RUNTIME_DIR MANIFEST_TEMPLATE)
MANIFEST_TEMPLATE
DESTINATION
OUT_FILENAME
COMPONENT
RUNTIME_TARGET
RUNTIME_DIR_RELATIVE_TO_MANIFEST
RELATIVE_RUNTIME_DIR)
set(multiValueArgs)
cmake_parse_arguments(_genmanifest "${options}" "${oneValueArgs}"
"${multiValueArgs}" ${ARGN})
if(NOT _genmanifest_MANIFEST_TEMPLATE)
set(_genmanifest_MANIFEST_TEMPLATE "${_OXR_MANIFEST_TEMPLATE}")
endif()
if(NOT _genmanifest_RUNTIME_TARGET)
message(FATAL_ERROR "Need RUNTIME_TARGET specified!")
endif()
@ -107,20 +113,33 @@ function(generate_openxr_runtime_manifest_at_install)
if(NOT _genmanifest_OUT_FILENAME)
set(_genmanifest_OUT_FILENAME "${_genmanifest_RUNTIME_TARGET}.json")
endif()
if(NOT _genmanifest_MANIFEST_TEMPLATE)
set(_genmanifest_MANIFEST_TEMPLATE "${_OXR_MANIFEST_TEMPLATE}")
endif()
set(_genmanifest_INTERMEDIATE_MANIFEST
"${CMAKE_CURRENT_BINARY_DIR}/${_genmanifest_OUT_FILENAME}")
set(_genmanifest_IS_INSTALL ON)
# Template value
set(RUNTIME_FILENAME
${CMAKE_SHARED_MODULE_PREFIX}${_genmanifest_RUNTIME_TARGET}${CMAKE_SHARED_MODULE_SUFFIX}
)
set(_script
${CMAKE_CURRENT_BINARY_DIR}/make_manifest_${_genmanifest_RUNTIME_TARGET}.cmake
)
configure_file("${_OXR_MANIFEST_SCRIPT}" "${_script}" @ONLY)
install(SCRIPT "${_script}")
set(_genmanifest_fwdargs)
if(_genmanifest_ABSOLUTE_RUNTIME_PATH)
list(APPEND _genmanifest_fwdargs ABSOLUTE_TARGET_PATH)
endif()
if(_genmanifest_RUNTIME_DIR_RELATIVE_TO_MANIFEST)
list(APPEND _genmanifest_fwdargs TARGET_DIR_RELATIVE_TO_MANIFEST
"${_genmanifest_RUNTIME_DIR_RELATIVE_TO_MANIFEST}")
endif()
if(_genmanifest_COMPONENT)
list(APPEND _genmanifest_fwdargs COMPONENT "${_genmanifest_COMPONENT}")
endif()
generate_khr_manifest_at_install(
${_genmanifest_fwdargs}
MANIFEST_DESCRIPTION
"OpenXR runtime manifest"
MANIFEST_TEMPLATE
"${_genmanifest_MANIFEST_TEMPLATE}"
TARGET
"${_genmanifest_RUNTIME_TARGET}"
DESTINATION
"${_genmanifest_DESTINATION}"
RELATIVE_TARGET_DIR
"${_genmanifest_RELATIVE_RUNTIME_DIR}"
OUT_FILENAME
"${_genmanifest_OUT_FILENAME}")
endfunction()

View file

@ -1,69 +0,0 @@
# 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()

View file

@ -0,0 +1,140 @@
# Copyright 2019-2023, Collabora, Ltd.
#
# SPDX-License-Identifier: BSL-1.0
#
# Maintained by:
# 2019-2023 Ryan Pavlik <ryan.pavlik@collabora.com> <ryan.pavlik@gmail.com>
#[[.rst:
GenerateVulkanApiLayerManifest
---------------
The following functions are provided by this module:
- :command:`generate_vulkan_api_layer_manifest_buildtree`
- :command:`generate_vulkan_api_layer_manifest_at_install`
.. command:: generate_vulkan_api_layer_manifest_buildtree
Generates a layer manifest suitable for use in the build tree,
with absolute paths, at configure time::
generate_vulkan_api_layer_manifest_buildtree(
MANIFEST_TEMPLATE <template> # The template for your manifest file
LAYER_TARGET <target> # Name of your layer target
OUT_FILE <outfile> # Name of the manifest file (with path) to generate
)
.. command:: generate_vulkan_api_layer_manifest_at_install
Generates a layer manifest at install time and installs it where desired::
generate_vulkan_api_layer_manifest_at_install(
MANIFEST_TEMPLATE <template> # The template for your manifest file
LAYER_TARGET <target> # Name of your layer target
DESTINATION <dest> # The install-prefix-relative path to install the manifest to.
RELATIVE_LAYER_DIR <dir> # The install-prefix-relative path that the layer library is installed to.
[COMPONENT <comp>] # If present, the component to place the manifest in.
[ABSOLUTE_LAYER_PATH| # If present, path in generated manifest is absolute
LAYER_DIR_RELATIVE_TO_MANIFEST <dir>]
# If present (and ABSOLUTE_LAYER_PATH not present), specifies the
# layer directory relative to the manifest directory in the installed layout
[OUT_FILENAME <outfilename> # Optional: Alternate name of the manifest file to generate
)
#]]
# This module is mostly just argument parsing, the guts are in GenerateKhrManifest
get_filename_component(_VK_MANIFEST_CMAKE_DIR "${CMAKE_CURRENT_LIST_FILE}" PATH)
include("${_VK_MANIFEST_CMAKE_DIR}/GenerateKhrManifest.cmake")
function(generate_vulkan_api_layer_manifest_buildtree)
set(options)
set(oneValueArgs MANIFEST_TEMPLATE LAYER_TARGET OUT_FILE)
set(multiValueArgs)
cmake_parse_arguments(_genmanifest "${options}" "${oneValueArgs}"
"${multiValueArgs}" ${ARGN})
if(NOT _genmanifest_MANIFEST_TEMPLATE)
message(FATAL_ERROR "Need MANIFEST_TEMPLATE specified!")
endif()
if(NOT _genmanifest_LAYER_TARGET)
message(FATAL_ERROR "Need LAYER_TARGET specified!")
endif()
if(NOT _genmanifest_OUT_FILE)
message(FATAL_ERROR "Need OUT_FILE specified!")
endif()
generate_khr_manifest_buildtree(
MANIFEST_DESCRIPTION
"Vulkan API layer manifest"
MANIFEST_TEMPLATE
"${_genmanifest_MANIFEST_TEMPLATE}"
TARGET
"${_genmanifest_LAYER_TARGET}"
OUT_FILE
"${_genmanifest_OUT_FILE}")
endfunction()
function(generate_vulkan_api_layer_manifest_at_install)
set(options ABSOLUTE_LAYER_PATH)
set(oneValueArgs
MANIFEST_TEMPLATE
DESTINATION
OUT_FILENAME
COMPONENT
LAYER_TARGET
LAYER_DIR_RELATIVE_TO_MANIFEST
RELATIVE_LAYER_DIR)
set(multiValueArgs)
cmake_parse_arguments(_genmanifest "${options}" "${oneValueArgs}"
"${multiValueArgs}" ${ARGN})
if(NOT _genmanifest_MANIFEST_TEMPLATE)
message(FATAL_ERROR "Need MANIFEST_TEMPLATE specified!")
endif()
if(NOT _genmanifest_LAYER_TARGET)
message(FATAL_ERROR "Need LAYER_TARGET specified!")
endif()
if(NOT _genmanifest_DESTINATION)
message(FATAL_ERROR "Need DESTINATION specified!")
endif()
if(NOT _genmanifest_RELATIVE_LAYER_DIR)
message(FATAL_ERROR "Need RELATIVE_LAYER_DIR specified!")
endif()
if(NOT _genmanifest_OUT_FILENAME)
set(_genmanifest_OUT_FILENAME "${_genmanifest_LAYER_TARGET}.json")
endif()
set(_genmanifest_fwdargs)
if(_genmanifest_ABSOLUTE_LAYER_PATH)
list(APPEND _genmanifest_fwdargs ABSOLUTE_TARGET_PATH)
endif()
if(_genmanifest_LAYER_DIR_RELATIVE_TO_MANIFEST)
list(APPEND _genmanifest_fwdargs TARGET_DIR_RELATIVE_TO_MANIFEST
"${_genmanifest_LAYER_DIR_RELATIVE_TO_MANIFEST}")
endif()
if(_genmanifest_COMPONENT)
list(APPEND _genmanifest_fwdargs COMPONENT "${_genmanifest_COMPONENT}")
endif()
generate_khr_manifest_at_install(
${_genmanifest_fwdargs}
MANIFEST_DESCRIPTION
"Vulkan API layer manifest"
MANIFEST_TEMPLATE
"${_genmanifest_MANIFEST_TEMPLATE}"
TARGET
"${_genmanifest_LAYER_TARGET}"
DESTINATION
"${_genmanifest_DESTINATION}"
RELATIVE_TARGET_DIR
"${_genmanifest_RELATIVE_LAYER_DIR}"
OUT_FILENAME
"${_genmanifest_OUT_FILENAME}")
endfunction()

View file

@ -38,7 +38,9 @@
# Copyright 2009-2013, Iowa State University.
# Copyright 2013-2020, Ryan Pavlik
# Copyright 2013-2020, Contributors
#
# SPDX-License-Identifier: BSL-1.0
#
# Distributed under the Boost Software License, Version 1.0.
# (See accompanying file LICENSE_1_0.txt or copy at
# http://www.boost.org/LICENSE_1_0.txt)
@ -94,7 +96,8 @@ function(get_git_head_revision _refspecvar _hashvar)
if(NOT "${GIT_DIR}" STREQUAL "")
file(RELATIVE_PATH _relative_to_source_dir "${CMAKE_SOURCE_DIR}"
"${GIT_DIR}")
if("${_relative_to_source_dir}" MATCHES "[.][.]" AND NOT ALLOW_LOOKING_ABOVE_CMAKE_SOURCE_DIR)
if("${_relative_to_source_dir}" MATCHES "[.][.]"
AND NOT ALLOW_LOOKING_ABOVE_CMAKE_SOURCE_DIR)
# We've gone above the CMake root dir.
set(GIT_DIR "")
endif()

View file

@ -4,14 +4,17 @@
# Requires CMake 2.6 or newer (uses the 'function' command)
#
# Original Author:
# 2009-2010 Ryan Pavlik <rpavlik@iastate.edu> <abiryan@ryand.net>
# 2009-2023 Ryan Pavlik <rpavlik@iastate.edu> <abiryan@ryand.net>
# http://academic.cleardefinition.com
# Iowa State University HCI Graduate Program/VRAC
#
# Copyright Iowa State University 2009-2010.
# Copyright 2009-2012, Iowa State University
# Copyright 2011-2023, Contributors
#
# Distributed under the Boost Software License, Version 1.0.
# (See accompanying file LICENSE_1_0.txt or copy at
# http://www.boost.org/LICENSE_1_0.txt)
#
# SPDX-License-Identifier: BSL-1.0
set(HEAD_HASH)
@ -20,23 +23,26 @@ file(READ "@HEAD_FILE@" HEAD_CONTENTS LIMIT 1024)
string(STRIP "${HEAD_CONTENTS}" HEAD_CONTENTS)
if(HEAD_CONTENTS MATCHES "ref")
# named branch
string(REPLACE "ref: " "" HEAD_REF "${HEAD_CONTENTS}")
if(EXISTS "@GIT_DIR@/${HEAD_REF}")
configure_file("@GIT_DIR@/${HEAD_REF}" "@GIT_DATA@/head-ref" COPYONLY)
else()
configure_file("@GIT_DIR@/packed-refs" "@GIT_DATA@/packed-refs" COPYONLY)
file(READ "@GIT_DATA@/packed-refs" PACKED_REFS)
if(${PACKED_REFS} MATCHES "([0-9a-z]*) ${HEAD_REF}")
set(HEAD_HASH "${CMAKE_MATCH_1}")
endif()
endif()
# named branch
string(REPLACE "ref: " "" HEAD_REF "${HEAD_CONTENTS}")
if(EXISTS "@GIT_DIR@/${HEAD_REF}")
configure_file("@GIT_DIR@/${HEAD_REF}" "@GIT_DATA@/head-ref" COPYONLY)
else()
if(EXISTS "@GIT_DIR@/packed-refs")
configure_file("@GIT_DIR@/packed-refs" "@GIT_DATA@/packed-refs"
COPYONLY)
file(READ "@GIT_DATA@/packed-refs" PACKED_REFS)
if(${PACKED_REFS} MATCHES "([0-9a-z]*) ${HEAD_REF}")
set(HEAD_HASH "${CMAKE_MATCH_1}")
endif()
endif()
endif()
else()
# detached HEAD
configure_file("@GIT_DIR@/HEAD" "@GIT_DATA@/head-ref" COPYONLY)
# detached HEAD
configure_file("@GIT_DIR@/HEAD" "@GIT_DATA@/head-ref" COPYONLY)
endif()
if(NOT HEAD_HASH)
file(READ "@GIT_DATA@/head-ref" HEAD_HASH LIMIT 1024)
string(STRIP "${HEAD_HASH}" HEAD_HASH)
file(READ "@GIT_DATA@/head-ref" HEAD_HASH LIMIT 1024)
string(STRIP "${HEAD_HASH}" HEAD_HASH)
endif()

View file

@ -1,5 +1,5 @@
# Copyright 2022, Collabora, Ltd.
# Copyright 2000-2022 Kitware, Inc., Insight Software Consortium
# Copyright 2000-2022, Kitware, Inc., Insight Software Consortium
#
# SPDX-License-Identifier: BSD-3-Clause
#

View file

@ -6,10 +6,12 @@
# http://academic.cleardefinition.com
# Iowa State University HCI Graduate Program/VRAC
#
# Copyright Iowa State University 2009-2010.
# Copyright 2009-2010, Iowa State University
#
# Distributed under the Boost Software License, Version 1.0.
# (See accompanying file LICENSE_1_0.txt or copy at
# http://www.boost.org/LICENSE_1_0.txt)
#
# SPDX-License-Identifier: BSL-1.0
if(__prefix_list_glob)

View file

@ -9,10 +9,12 @@
# http://academic.cleardefinition.com
# Iowa State University HCI Graduate Program/VRAC
#
# Copyright Iowa State University 2009-2010.
# Copyright 2009-2010, Iowa State University
#
# Distributed under the Boost Software License, Version 1.0.
# (See accompanying file LICENSE_1_0.txt or copy at
# http://www.boost.org/LICENSE_1_0.txt)
#
# SPDX-License-Identifier: BSL-1.0
include(PrefixListGlob)

View file

@ -1,4 +1,5 @@
# Copyright 2019, Collabora, Ltd.
#
# SPDX-License-Identifier: BSL-1.0
find_program(GLSLANGVALIDATOR_COMMAND

View file

@ -0,0 +1,3 @@
Copyright 2018-2020, Collabora, Ltd.
SPDX-License-Identifier: BSL-1.0

View file

@ -1,2 +0,0 @@
Copyright 2018-2023, Collabora, Ltd.
SPDX-License-Identifier: BSL-1.0