From c718d69dae92404d7662c80a49f603d2c5ff2368 Mon Sep 17 00:00:00 2001 From: Ryan Pavlik Date: Wed, 20 Apr 2022 15:05:31 -0500 Subject: [PATCH] cmake: Put the manifest generation in a CMake module. Will make it easier to modify/customize and integrate the trampoline. --- .cmake-format.py | 25 +++- cmake/GenerateOpenXRRuntimeManifest.cmake | 120 ++++++++++++++++++ ...erateOpenXRRuntimeManifestInstall.cmake.in | 56 ++++++++ cmake/openxr_monado.in.json | 6 + cmake/openxr_monado.in.json.license | 2 + 5 files changed, 207 insertions(+), 2 deletions(-) create mode 100644 cmake/GenerateOpenXRRuntimeManifest.cmake create mode 100644 cmake/GenerateOpenXRRuntimeManifestInstall.cmake.in create mode 100644 cmake/openxr_monado.in.json create mode 100644 cmake/openxr_monado.in.json.license diff --git a/.cmake-format.py b/.cmake-format.py index 62e9c0a82..a75c5f0ef 100644 --- a/.cmake-format.py +++ b/.cmake-format.py @@ -1,6 +1,27 @@ -# SPDX-FileCopyrightText: 2021, Collabora, Ltd. +# SPDX-FileCopyrightText: 2021-2022, Collabora, Ltd. # SPDX-License-Identifier: CC0-1.0 +with section("parse"): + + # Specify structure for custom cmake functions + additional_commands = { + "generate_openxr_runtime_manifest_at_install": { + "kwargs": { + "DESTINATION": 1, + "MANIFEST_TEMPLATE": 1, + "OUT_FILENAME": 1, + "RELATIVE_RUNTIME_DIR": 1, + "RUNTIME_DIR_RELATIVE_TO_MANIFEST": 1, + "RUNTIME_TARGET": 1, + }, + "pargs": {"flags": ["ABSOLUTE_RUNTIME_PATH"], "nargs": "*"}, + }, + "generate_openxr_runtime_manifest_buildtree": { + "kwargs": {"MANIFEST_TEMPLATE": 1, "OUT_FILE": 1, "RUNTIME_TARGET": 1}, + "pargs": {"flags": [], "nargs": "*"}, + }, + } + with section("format"): line_width = 100 tab_size = 8 @@ -14,7 +35,7 @@ with section("format"): max_pargs_hwrap = 4 max_rows_cmdline = 1 - keyword_case = 'upper' + keyword_case = "upper" # Do not reflow comments diff --git a/cmake/GenerateOpenXRRuntimeManifest.cmake b/cmake/GenerateOpenXRRuntimeManifest.cmake new file mode 100644 index 000000000..a63cf34c0 --- /dev/null +++ b/cmake/GenerateOpenXRRuntimeManifest.cmake @@ -0,0 +1,120 @@ +# Copyright 2019-2022, Collabora, Ltd. +# SPDX-License-Identifier: BSL-1.0 +#[[.rst: +GenerateOpenXRRuntimeManifest +--------------- + +The following functions are provided by this module: + +- :command:`generate_openxr_runtime_manifest_buildtree` +- :command:`generate_openxr_runtime_manifest_at_install` + + +.. command:: generate_openxr_runtime_manifest_buildtree + + Generates a runtime manifest suitable for use in the build tree, + with absolute paths, at configure time:: + + generate_openxr_runtime_manifest_buildtree( + RUNTIME_TARGET # Name of your runtime target + OUT_FILE # Name of the manifest file (with path) to generate + [MANIFEST_TEMPLATE