mirror of
https://github.com/Kitware/CMake.git
synced 2026-11-07 13:56:44 +00:00
Help: Generate presets JSON schema, documentation
Replace the CMake presets schema.json with a YAML document, from which both the JSON schema and (most of) the reST documentation are generated. This achieves three main goals. First, the YAML document is much closer to being human-readable than the JSON schema. Second, the JSON and reST prose (when the latter differs) are contained in the same file, in most cases adjacent (and at worst, still nearby) rather than in separate files, which should greatly facilitate keeping the two in sync. Third, changes are monumentally easier, as changes merely need to annotate the version(s) to which variants apply, rather than creating entirely separate schema trees for each variant. Since requiring Python as part of the build process is not desired, the outputs are kept in the source repository. This is consistent with other areas which are seldom updated and require special tools, such as the lexer. While this does not represent any functional change for users, some grammatical edits and other such editorial improvements have been made in the process of transferring everything to the new YAML. However, these are mainly incidental rather than representative of an attempt at a thorough editorial pass. Finally, for clarity, monkey-patch `sphing.domains.changesets` and add additional 'version modified' directives with slightly tweaked text to identify changes to the presets schema. These are nearly identical to the built-in directives, but use the text 'in presets version N' rather than 'in version N[.N]'.
This commit is contained in:
1 parent
b96826bc08
commit
f26e9fcbae
31 files changed
+8081
-3237
No files matched your search
+103
-1144
File diff suppressed because it is too large.
Load diff
@@ -0,0 +1,27 @@
|
||||
.. This file was generated by Utilities/Scripts/regenerate-presets.py
|
||||
from Help/manual/presets/schema.yaml. Do not edit.
|
||||
|
||||
.. _`CMakePresets.configurePresets.architecture.value`:
|
||||
|
||||
``value``
|
||||
An optional string representing the value.
|
||||
|
||||
.. _`CMakePresets.configurePresets.architecture.strategy`:
|
||||
|
||||
``strategy``
|
||||
An optional string telling CMake how to handle the field.
|
||||
Valid values are:
|
||||
|
||||
``"set"``
|
||||
Set the respective value. This will result in an error for generators
|
||||
that do not support the respective field.
|
||||
|
||||
``"external"``
|
||||
Do not set the value, even if the generator supports it. This is
|
||||
useful if, for example, a preset uses the Ninja generator, and an IDE
|
||||
knows how to set up the Visual C++ environment from the architecture
|
||||
and toolset fields. In that case, CMake will ignore the field, but
|
||||
the IDE can use them to set up the environment before invoking CMake.
|
||||
|
||||
If no ``strategy`` field is given, or if the field uses the string form
|
||||
rather than the object form, the behavior is the same as ``"set"``.
|
||||
@@ -0,0 +1,213 @@
|
||||
.. This file was generated by Utilities/Scripts/regenerate-presets.py
|
||||
from Help/manual/presets/schema.yaml. Do not edit.
|
||||
|
||||
.. _`CMakePresets.buildPresets.name`:
|
||||
|
||||
``name``
|
||||
A required string representing the machine-friendly name of the
|
||||
preset. This identifier is used in the
|
||||
:option:`cmake --build --preset <cmake--build --preset>` option.
|
||||
There must not be two build presets in the union of
|
||||
``CMakePresets.json`` and ``CMakeUserPresets.json`` in the same
|
||||
directory with the same name. However, a build preset may have the
|
||||
same name as a configure, test, package, or workflow preset.
|
||||
|
||||
.. _`CMakePresets.buildPresets.hidden`:
|
||||
|
||||
``hidden``
|
||||
An optional boolean specifying whether or not a preset should be
|
||||
hidden. If a preset is hidden, it cannot be used in the
|
||||
:cmake-build-option:`--preset` argument and does not have to have a
|
||||
valid ``configurePreset``, even from inheritance. ``hidden``
|
||||
presets are intended to be used as a base for other presets to
|
||||
inherit via the ``inherits`` field.
|
||||
|
||||
.. _`CMakePresets.buildPresets.inherits`:
|
||||
|
||||
``inherits``
|
||||
An optional array of strings representing the names of presets from which
|
||||
to inherit. This field can also be a string, which is equivalent to an
|
||||
array containing one string.
|
||||
|
||||
The preset will inherit all of the fields from the ``inherits`` presets
|
||||
by default (except ``name``, ``hidden``, ``inherits``, ``description``,
|
||||
and ``displayName``), but can override them as desired. If multiple
|
||||
``inherits`` presets provide conflicting values for the same field, the
|
||||
earlier preset in the ``inherits`` array will be preferred.
|
||||
|
||||
A preset can only inherit from another preset that is defined in the same
|
||||
file or in one of the files it includes (directly or indirectly). Presets
|
||||
in ``CMakePresets.json`` may not inherit from presets in
|
||||
``CMakeUserPresets.json``.
|
||||
|
||||
.. _`CMakePresets.buildPresets.condition`:
|
||||
|
||||
``condition``
|
||||
.. presets-versionadded:: 3
|
||||
|
||||
An optional `Condition`_ object.
|
||||
|
||||
.. _`CMakePresets.buildPresets.vendor`:
|
||||
|
||||
``vendor``
|
||||
An optional map containing vendor-specific information. CMake does not
|
||||
interpret the contents of this field except to verify that it is a map if
|
||||
it does exist. However, it should follow the same conventions as the
|
||||
root-level ``vendor`` field. If vendors use their own per-preset
|
||||
``vendor`` field, they should implement inheritance in a sensible manner
|
||||
when appropriate.
|
||||
|
||||
.. _`CMakePresets.buildPresets.displayName`:
|
||||
|
||||
``displayName``
|
||||
An optional string with a human-friendly name of the preset.
|
||||
|
||||
.. _`CMakePresets.buildPresets.description`:
|
||||
|
||||
``description``
|
||||
An optional string with a human-friendly description of the preset.
|
||||
|
||||
.. _`CMakePresets.buildPresets.environment`:
|
||||
|
||||
``environment``
|
||||
An optional map of environment variables. The key is the variable name
|
||||
(which may not be an empty string), and the value is either ``null`` or a
|
||||
string representing the value of the variable. Each variable is set
|
||||
regardless of whether or not a value was given to it by the process's
|
||||
environment.
|
||||
|
||||
This field supports `macro expansion`_, and environment variables in this
|
||||
map may reference each other, and may be listed in any order, as long as
|
||||
such references do not cause a cycle (for example, if ``ENV_1`` is
|
||||
``$env{ENV_2}``, ``ENV_2`` may not be ``$env{ENV_1}``). ``$penv{NAME}``
|
||||
allows one to prepend or append values to existing environment variables
|
||||
by accessing only values from the parent environment.
|
||||
|
||||
Environment variables are inherited through the ``inherits`` field, and
|
||||
the preset's environment will be the union of its own ``environment`` and
|
||||
the ``environment`` from all its parents. If multiple presets in this
|
||||
union define the same variable, the standard rules of ``inherits`` are
|
||||
applied. Setting a variable to ``null`` causes it to not be set, even if
|
||||
a value was inherited from another preset.
|
||||
|
||||
.. note::
|
||||
|
||||
For a CMake project using :module:`ExternalProject` with a
|
||||
configuration preset having environment variables needed in the
|
||||
ExternalProject, use a build preset that inherits that
|
||||
configuration preset or the ExternalProject will not have the
|
||||
environment variables set in the configuration preset. Example:
|
||||
suppose the host defaults to one compiler (say Clang) and the user
|
||||
wishes to use another compiler (say GCC). Set configuration preset
|
||||
environment variables :envvar:`CC` and :envvar:`CXX` and use a
|
||||
build preset that inherits that configuration preset. Otherwise the
|
||||
ExternalProject may use a different (system default) compiler than
|
||||
the top-level CMake project.
|
||||
|
||||
|
||||
.. _`CMakePresets.buildPresets.configurePreset`:
|
||||
|
||||
``configurePreset``
|
||||
An optional string specifying the name of a configure preset to
|
||||
associate with this build preset. If ``configurePreset`` is not
|
||||
specified, it must be inherited from the inherits preset (unless
|
||||
this preset is hidden). The build directory is inferred from the
|
||||
configure preset, so the build will take place in the same
|
||||
``binaryDir`` that the configuration did.
|
||||
|
||||
.. _`CMakePresets.buildPresets.inheritConfigureEnvironment`:
|
||||
|
||||
``inheritConfigureEnvironment``
|
||||
An optional boolean that defaults to ``true``. If ``true``, the
|
||||
environment variables from the associated configure preset are
|
||||
inherited after all inherited build preset environments, but before
|
||||
environment variables explicitly specified in this build preset.
|
||||
|
||||
.. _`CMakePresets.buildPresets.jobs`:
|
||||
|
||||
``jobs``
|
||||
An optional integer. Equivalent to passing
|
||||
:cmake-build-option:`--parallel` or ``-j`` on the command line.
|
||||
If the value is ``0``, it is equivalent to passing ``--parallel``
|
||||
with ``<jobs>`` omitted; alternatively, one can define the
|
||||
environment variable :envvar:`CMAKE_BUILD_PARALLEL_LEVEL` as an
|
||||
empty string using the ``environment`` field.
|
||||
|
||||
.. versionchanged:: 4.3
|
||||
|
||||
This field does not accept negative integer values, regardless of
|
||||
the version in the preset file.
|
||||
|
||||
.. _`CMakePresets.buildPresets.targets`:
|
||||
|
||||
``targets``
|
||||
An optional string or array of strings. Equivalent to passing
|
||||
:cmake-build-option:`--target` or ``-t`` on the command line.
|
||||
Vendors may ignore the targets property or hide build presets that
|
||||
explicitly specify targets. This field supports `macro expansion`_.
|
||||
|
||||
.. _`CMakePresets.buildPresets.configuration`:
|
||||
|
||||
``configuration``
|
||||
An optional string. Equivalent to passing
|
||||
:cmake-build-option:`--config` on the command line.
|
||||
|
||||
.. _`CMakePresets.buildPresets.cleanFirst`:
|
||||
|
||||
``cleanFirst``
|
||||
An optional bool. If ``true``, equivalent to passing
|
||||
:cmake-build-option:`--clean-first` on the command line.
|
||||
|
||||
.. _`CMakePresets.buildPresets.resolvePackageReferences`:
|
||||
|
||||
``resolvePackageReferences``
|
||||
.. presets-versionadded:: 4
|
||||
|
||||
An optional string that specifies the package resolve mode.
|
||||
|
||||
Package references are used to define dependencies to packages from
|
||||
external package managers. Currently only NuGet in combination with
|
||||
the :ref:`Visual Studio generators` is supported. If there are no
|
||||
targets that define package references, this option does nothing.
|
||||
Valid values are:
|
||||
|
||||
``on``
|
||||
Causes package references to be resolved before attempting a
|
||||
build.
|
||||
|
||||
``off``
|
||||
Package references will not be resolved. Note that this may cause
|
||||
errors in some build environments, such as .NET SDK style
|
||||
projects.
|
||||
|
||||
``only``
|
||||
Only resolve package references, but do not perform a build.
|
||||
|
||||
.. note::
|
||||
|
||||
The command line parameter
|
||||
:cmake-build-option:`--resolve-package-references`
|
||||
will take priority over this setting. If the command line
|
||||
parameter is not provided and this setting is not specified, an
|
||||
environment-specific cache variable will be evaluated to decide,
|
||||
if package restoration should be performed.
|
||||
|
||||
When using the :ref:`Visual Studio generators`,
|
||||
package references are defined using the
|
||||
:prop_tgt:`VS_PACKAGE_REFERENCES` property. Package references
|
||||
are restored using NuGet. It can be disabled by setting the
|
||||
:variable:`CMAKE_VS_NUGET_PACKAGE_RESTORE` variable to ``OFF``.
|
||||
This can also be done from within a configure preset.
|
||||
|
||||
.. _`CMakePresets.buildPresets.verbose`:
|
||||
|
||||
``verbose``
|
||||
An optional boolean. If ``true``, equivalent to passing
|
||||
:cmake-build-option:`--verbose` on the command line.
|
||||
|
||||
.. _`CMakePresets.buildPresets.nativeToolOptions`:
|
||||
|
||||
``nativeToolOptions``
|
||||
An optional array of strings. Equivalent to passing options after
|
||||
:cmake-build-option:`--` on the command line. The array values
|
||||
support `macro expansion`_.
|
||||
@@ -0,0 +1,7 @@
|
||||
.. This file was generated by Utilities/Scripts/regenerate-presets.py
|
||||
from Help/manual/presets/schema.yaml. Do not edit.
|
||||
|
||||
.. _`CMakePresets.configurePresets.cacheVariables.type`:
|
||||
|
||||
``type``
|
||||
An optional string representing the type of the variable. It should be BOOL, FILEPATH, PATH, STRING, or INTERNAL.
|
||||
@@ -0,0 +1,17 @@
|
||||
.. This file was generated by Utilities/Scripts/regenerate-presets.py
|
||||
from Help/manual/presets/schema.yaml. Do not edit.
|
||||
|
||||
.. _`CMakePresets.cmakeMinimumRequired.major`:
|
||||
|
||||
``major``
|
||||
An optional integer representing the major version.
|
||||
|
||||
.. _`CMakePresets.cmakeMinimumRequired.minor`:
|
||||
|
||||
``minor``
|
||||
An optional integer representing the minor version.
|
||||
|
||||
.. _`CMakePresets.cmakeMinimumRequired.patch`:
|
||||
|
||||
``patch``
|
||||
An optional integer representing the patch version.
|
||||
@@ -0,0 +1,251 @@
|
||||
.. This file was generated by Utilities/Scripts/regenerate-presets.py
|
||||
from Help/manual/presets/schema.yaml. Do not edit.
|
||||
|
||||
.. _`CMakePresets.configurePresets.name`:
|
||||
|
||||
``name``
|
||||
A required string representing the machine-friendly name of the
|
||||
preset. This identifier is used in the :option:`cmake --preset`
|
||||
option. There must not be two configure presets in the union of
|
||||
``CMakePresets.json`` and ``CMakeUserPresets.json`` in the same
|
||||
directory with the same name. However, a configure preset may have
|
||||
the same name as a build, test, package, or workflow preset.
|
||||
|
||||
.. _`CMakePresets.configurePresets.hidden`:
|
||||
|
||||
``hidden``
|
||||
An optional boolean specifying whether or not a preset should be
|
||||
hidden. If a preset is hidden, it cannot be used in the
|
||||
:cmake-option:`--preset` argument, will not show up in the
|
||||
:manual:`CMake GUI <cmake-gui(1)>`, and does not have to have a
|
||||
valid ``generator`` or ``binaryDir``, even from inheritance.
|
||||
``hidden`` presets are intended to be used as a base for other
|
||||
presets to inherit via the ``inherits`` field.
|
||||
|
||||
.. _`CMakePresets.configurePresets.inherits`:
|
||||
|
||||
``inherits``
|
||||
An optional array of strings representing the names of presets from which
|
||||
to inherit. This field can also be a string, which is equivalent to an
|
||||
array containing one string.
|
||||
|
||||
The preset will inherit all of the fields from the ``inherits`` presets
|
||||
by default (except ``name``, ``hidden``, ``inherits``, ``description``,
|
||||
and ``displayName``), but can override them as desired. If multiple
|
||||
``inherits`` presets provide conflicting values for the same field, the
|
||||
earlier preset in the ``inherits`` array will be preferred.
|
||||
|
||||
A preset can only inherit from another preset that is defined in the same
|
||||
file or in one of the files it includes (directly or indirectly). Presets
|
||||
in ``CMakePresets.json`` may not inherit from presets in
|
||||
``CMakeUserPresets.json``.
|
||||
|
||||
.. _`CMakePresets.configurePresets.condition`:
|
||||
|
||||
``condition``
|
||||
.. presets-versionadded:: 3
|
||||
|
||||
An optional `Condition`_ object.
|
||||
|
||||
.. _`CMakePresets.configurePresets.vendor`:
|
||||
|
||||
``vendor``
|
||||
An optional map containing vendor-specific information. CMake does not
|
||||
interpret the contents of this field except to verify that it is a map if
|
||||
it does exist. However, it should follow the same conventions as the
|
||||
root-level ``vendor`` field. If vendors use their own per-preset
|
||||
``vendor`` field, they should implement inheritance in a sensible manner
|
||||
when appropriate.
|
||||
|
||||
.. _`CMakePresets.configurePresets.displayName`:
|
||||
|
||||
``displayName``
|
||||
An optional string with a human-friendly name of the preset.
|
||||
|
||||
.. _`CMakePresets.configurePresets.description`:
|
||||
|
||||
``description``
|
||||
An optional string with a human-friendly description of the preset.
|
||||
|
||||
.. _`CMakePresets.configurePresets.generator`:
|
||||
|
||||
``generator``
|
||||
An optional string representing the
|
||||
:manual:`generator <cmake-generators(7)>` to use for the preset.
|
||||
|
||||
.. presets-versionchanged:: 3
|
||||
|
||||
If omitted, CMake will fall back to regular generator discovery
|
||||
procedure. In previous versions, if not specified, this field
|
||||
must be inherited from the ``inherits`` preset (unless this
|
||||
preset is ``hidden``).
|
||||
|
||||
Note that for :ref:`Visual Studio generators`, unlike in the
|
||||
command line :cmake-option:`-G` argument, you cannot include the
|
||||
platform name in the generator name. Use the ``architecture``
|
||||
field instead.
|
||||
|
||||
.. _`CMakePresets.configurePresets.architecture`:
|
||||
|
||||
``architecture``
|
||||
Optional field representing the platform for
|
||||
:manual:`generators <cmake-generators(7)>` that support it.
|
||||
|
||||
See :option:`cmake -A` for possible values.
|
||||
|
||||
``architecture`` may be either a string or an object with the
|
||||
following fields:
|
||||
|
||||
.. include:: presets/architecture-properties.rst
|
||||
|
||||
.. _`CMakePresets.configurePresets.toolset`:
|
||||
|
||||
``toolset``
|
||||
Optional field representing the toolset for
|
||||
:manual:`generators <cmake-generators(7)>` that support it.
|
||||
|
||||
See :option:`cmake -T` for possible values.
|
||||
|
||||
``toolset`` may be either a string or an object with the following
|
||||
fields:
|
||||
|
||||
.. include:: presets/toolset-properties.rst
|
||||
|
||||
.. _`CMakePresets.configurePresets.toolchainFile`:
|
||||
|
||||
``toolchainFile``
|
||||
.. presets-versionadded:: 3
|
||||
|
||||
An optional string representing the path to the toolchain file.
|
||||
This field supports `macro expansion`_. If a relative path is
|
||||
specified, it is calculated relative to the build directory, and if
|
||||
not found, relative to the source directory. This field takes
|
||||
precedence over any :variable:`CMAKE_TOOLCHAIN_FILE` value.
|
||||
|
||||
.. _`CMakePresets.configurePresets.graphviz`:
|
||||
|
||||
``graphviz``
|
||||
.. presets-versionadded:: 10
|
||||
|
||||
An optional string representing the path to the graphviz input
|
||||
file, that will contain all the library and executable dependencies
|
||||
in the project. See the documentation for
|
||||
:option:`cmake --graphviz` for more details.
|
||||
|
||||
This field supports `macro expansion`_. If a relative path is
|
||||
specified, it is calculated relative to the current working
|
||||
directory.
|
||||
|
||||
.. _`CMakePresets.configurePresets.binaryDir`:
|
||||
|
||||
``binaryDir``
|
||||
An optional string representing the path to the output binary
|
||||
directory. This field supports `macro expansion`_. If a relative
|
||||
path is specified, it is calculated relative to the source
|
||||
directory.
|
||||
|
||||
.. presets-versionchanged:: 3
|
||||
|
||||
If omitted, CMake will calculate the path using regular methods.
|
||||
In previous versions, if not specified, this field must be
|
||||
inherited from the ``inherits`` preset (unless this preset is
|
||||
``hidden``).
|
||||
|
||||
.. _`CMakePresets.configurePresets.installDir`:
|
||||
|
||||
``installDir``
|
||||
.. presets-versionadded:: 3
|
||||
|
||||
An optional string representing the path to the installation
|
||||
directory, which will be used as the
|
||||
:variable:`CMAKE_INSTALL_PREFIX` variable. This field supports
|
||||
`macro expansion`_. If a relative path is specified, it is
|
||||
calculated relative to the source directory.
|
||||
|
||||
.. _`CMakePresets.configurePresets.cmakeExecutable`:
|
||||
|
||||
``cmakeExecutable``
|
||||
An optional string representing the path to the CMake executable to use for this preset. This is reserved for use by IDEs, and is not used by CMake itself. IDEs that use this field should expand any macros in it.
|
||||
|
||||
.. _`CMakePresets.configurePresets.cacheVariables`:
|
||||
|
||||
``cacheVariables``
|
||||
An optional map of cache variables. The key is the variable name
|
||||
(which may not be an empty string), and the value is either
|
||||
``null``, a boolean (which is equivalent to a value of ``"TRUE"``
|
||||
or ``"FALSE"`` and a type of ``BOOL``), a string representing the
|
||||
value of the variable (which supports `macro expansion`_), or an
|
||||
object with the following fields:
|
||||
|
||||
``type``
|
||||
An optional string representing the type of the variable.
|
||||
|
||||
``value``
|
||||
A required string or boolean representing the value of the
|
||||
variable. A boolean is equivalent to ``"TRUE"`` or ``"FALSE"``.
|
||||
This field supports `macro expansion`_.
|
||||
|
||||
Cache variables are inherited through the ``inherits`` field, and
|
||||
the preset's variables will be the union of its own
|
||||
``cacheVariables`` and the ``cacheVariables`` from all its parents.
|
||||
If multiple presets in this union define the same variable, the
|
||||
standard rules of ``inherits`` are applied. Setting a variable to
|
||||
``null`` causes it to not be set, even if a value was inherited
|
||||
from another preset.
|
||||
|
||||
.. _`CMakePresets.configurePresets.environment`:
|
||||
|
||||
``environment``
|
||||
An optional map of environment variables. The key is the variable name
|
||||
(which may not be an empty string), and the value is either ``null`` or a
|
||||
string representing the value of the variable. Each variable is set
|
||||
regardless of whether or not a value was given to it by the process's
|
||||
environment.
|
||||
|
||||
This field supports `macro expansion`_, and environment variables in this
|
||||
map may reference each other, and may be listed in any order, as long as
|
||||
such references do not cause a cycle (for example, if ``ENV_1`` is
|
||||
``$env{ENV_2}``, ``ENV_2`` may not be ``$env{ENV_1}``). ``$penv{NAME}``
|
||||
allows one to prepend or append values to existing environment variables
|
||||
by accessing only values from the parent environment.
|
||||
|
||||
Environment variables are inherited through the ``inherits`` field, and
|
||||
the preset's environment will be the union of its own ``environment`` and
|
||||
the ``environment`` from all its parents. If multiple presets in this
|
||||
union define the same variable, the standard rules of ``inherits`` are
|
||||
applied. Setting a variable to ``null`` causes it to not be set, even if
|
||||
a value was inherited from another preset.
|
||||
|
||||
.. _`CMakePresets.configurePresets.warnings`:
|
||||
|
||||
``warnings``
|
||||
An optional object specifying the warnings to enable.
|
||||
The object may contain the following fields:
|
||||
|
||||
.. include:: presets/warnings-properties.rst
|
||||
|
||||
.. _`CMakePresets.configurePresets.errors`:
|
||||
|
||||
``errors``
|
||||
An optional object specifying the errors to enable.
|
||||
The object may contain the following fields:
|
||||
|
||||
.. include:: presets/errors-properties.rst
|
||||
|
||||
.. _`CMakePresets.configurePresets.debug`:
|
||||
|
||||
``debug``
|
||||
An optional object specifying debug options.
|
||||
The object may contain the following fields:
|
||||
|
||||
.. include:: presets/debug-properties.rst
|
||||
|
||||
.. _`CMakePresets.configurePresets.trace`:
|
||||
|
||||
``trace``
|
||||
.. presets-versionadded:: 7
|
||||
|
||||
An optional object specifying trace options.
|
||||
The object may contain the following fields:
|
||||
|
||||
.. include:: presets/trace-properties.rst
|
||||
@@ -0,0 +1,20 @@
|
||||
.. This file was generated by Utilities/Scripts/regenerate-presets.py
|
||||
from Help/manual/presets/schema.yaml. Do not edit.
|
||||
|
||||
.. _`CMakePresets.configurePresets.debug.output`:
|
||||
|
||||
``output``
|
||||
An optional boolean. Setting this to ``true`` is equivalent to
|
||||
passing :cmake-option:`--debug-output` on the command line.
|
||||
|
||||
.. _`CMakePresets.configurePresets.debug.tryCompile`:
|
||||
|
||||
``tryCompile``
|
||||
An optional boolean. Setting this to ``true`` is equivalent to
|
||||
passing :cmake-option:`--debug-trycompile` on the command line.
|
||||
|
||||
.. _`CMakePresets.configurePresets.debug.find`:
|
||||
|
||||
``find``
|
||||
An optional boolean. Setting this to ``true`` is equivalent to
|
||||
passing :cmake-option:`--debug-find` on the command line.
|
||||
@@ -0,0 +1,22 @@
|
||||
.. This file was generated by Utilities/Scripts/regenerate-presets.py
|
||||
from Help/manual/presets/schema.yaml. Do not edit.
|
||||
|
||||
.. _`CMakePresets.configurePresets.errors.deprecated`:
|
||||
|
||||
``deprecated``
|
||||
An optional boolean. Equivalent to passing
|
||||
:cmake-option:`-Werror=deprecated` or
|
||||
:cmake-option:`-Wno-error=deprecated`
|
||||
on the command line.
|
||||
This may not be set to ``true``
|
||||
if ``warnings.deprecated`` is set to ``false``.
|
||||
|
||||
.. _`CMakePresets.configurePresets.errors.dev`:
|
||||
|
||||
``dev``
|
||||
An optional boolean. Equivalent to passing
|
||||
:cmake-option:`-Werror=dev` or
|
||||
:cmake-option:`-Wno-error=dev`
|
||||
on the command line.
|
||||
This may not be set to ``true``
|
||||
if ``warnings.dev`` is set to ``false``.
|
||||
@@ -0,0 +1,25 @@
|
||||
.. This file was generated by Utilities/Scripts/regenerate-presets.py
|
||||
from Help/manual/presets/schema.yaml. Do not edit.
|
||||
|
||||
.. _`CMakePresets.testPresets.filter.exclude.name`:
|
||||
|
||||
``name``
|
||||
An optional string specifying a regex for test names.
|
||||
Equivalent to passing :ctest-option:`--exclude-regex` on
|
||||
the command line. This field supports `macro expansion`_.
|
||||
|
||||
.. _`CMakePresets.testPresets.filter.exclude.label`:
|
||||
|
||||
``label``
|
||||
An optional string specifying a regex for test labels.
|
||||
Equivalent to passing :ctest-option:`--label-exclude` on
|
||||
the command line. This field supports `macro expansion`_.
|
||||
|
||||
.. _`CMakePresets.testPresets.filter.exclude.fixtures`:
|
||||
|
||||
``fixtures``
|
||||
An optional object specifying which fixtures to exclude
|
||||
from adding tests. The object may contain the following
|
||||
fields:
|
||||
|
||||
.. include:: presets/fixtures-properties.rst
|
||||
@@ -0,0 +1,115 @@
|
||||
.. This file was generated by Utilities/Scripts/regenerate-presets.py
|
||||
from Help/manual/presets/schema.yaml. Do not edit.
|
||||
|
||||
.. _`CMakePresets.testPresets.execution.stopOnFailure`:
|
||||
|
||||
``stopOnFailure``
|
||||
An optional bool. If ``true``, equivalent to passing
|
||||
:ctest-option:`--stop-on-failure` on the command line.
|
||||
|
||||
.. _`CMakePresets.testPresets.execution.enableFailover`:
|
||||
|
||||
``enableFailover``
|
||||
An optional bool. If ``true``, equivalent to passing
|
||||
:ctest-option:`-F` on the command line.
|
||||
|
||||
.. _`CMakePresets.testPresets.execution.jobs`:
|
||||
|
||||
``jobs``
|
||||
An optional integer. Equivalent to passing
|
||||
:ctest-option:`--parallel` on the command line. If the value is
|
||||
``0``, it is equivalent to unbounded parallelism.
|
||||
|
||||
.. presets-versionchanged:: 11
|
||||
|
||||
This field can also be a string, in which case it must be
|
||||
empty, and is equivalent to passing ``--parallel`` with
|
||||
``<jobs>`` omitted.
|
||||
|
||||
.. versionchanged:: 4.3
|
||||
|
||||
This field does not accept negative integer values,
|
||||
regardless of the version in the preset file.
|
||||
|
||||
.. _`CMakePresets.testPresets.execution.resourceSpecFile`:
|
||||
|
||||
``resourceSpecFile``
|
||||
An optional string. Equivalent to passing
|
||||
:ctest-option:`--resource-spec-file` on the command line. This
|
||||
field supports `macro expansion`_.
|
||||
|
||||
.. _`CMakePresets.testPresets.execution.testLoad`:
|
||||
|
||||
``testLoad``
|
||||
An optional integer. Equivalent to passing
|
||||
:ctest-option:`--test-load` on the command line.
|
||||
|
||||
.. _`CMakePresets.testPresets.execution.showOnly`:
|
||||
|
||||
``showOnly``
|
||||
An optional string. Equivalent to passing
|
||||
:ctest-option:`--show-only` on the command line. The string
|
||||
must be one of the following values:
|
||||
|
||||
* ``human``
|
||||
|
||||
* ``json-v1``
|
||||
|
||||
.. _`CMakePresets.testPresets.execution.repeat`:
|
||||
|
||||
``repeat``
|
||||
An optional object specifying how to repeat tests. Equivalent
|
||||
to passing :ctest-option:`--repeat` on the command line.
|
||||
The object must have the following fields:
|
||||
|
||||
.. include:: presets/repeat-properties.rst
|
||||
|
||||
.. _`CMakePresets.testPresets.execution.interactiveDebugging`:
|
||||
|
||||
``interactiveDebugging``
|
||||
An optional bool. If ``true``, equivalent to passing
|
||||
:ctest-option:`--interactive-debug-mode 1` on the command line.
|
||||
If ``false``, equivalent to passing
|
||||
:ctest-option:`--interactive-debug-mode 0` on the command line.
|
||||
|
||||
.. _`CMakePresets.testPresets.execution.scheduleRandom`:
|
||||
|
||||
``scheduleRandom``
|
||||
An optional bool. If ``true``, equivalent to passing
|
||||
:ctest-option:`--schedule-random` on the command line.
|
||||
|
||||
.. _`CMakePresets.testPresets.execution.timeout`:
|
||||
|
||||
``timeout``
|
||||
An optional integer. Equivalent to passing
|
||||
:ctest-option:`--timeout` on the command line.
|
||||
|
||||
.. _`CMakePresets.testPresets.execution.noTestsAction`:
|
||||
|
||||
``noTestsAction``
|
||||
An optional string specifying the behavior if no tests are
|
||||
found. Must be one of the following values:
|
||||
|
||||
``default``
|
||||
Equivalent to not passing any value on the command line.
|
||||
|
||||
``error``
|
||||
Equivalent to passing :ctest-option:`--no-tests=error`
|
||||
on the command line.
|
||||
|
||||
``ignore``
|
||||
Equivalent to passing :ctest-option:`--no-tests=ignore`
|
||||
on the command line.
|
||||
|
||||
.. _`CMakePresets.testPresets.execution.testPassthroughArguments`:
|
||||
|
||||
``testPassthroughArguments``
|
||||
.. presets-versionadded:: 12
|
||||
|
||||
An optional array of strings. Each element is forwarded as an
|
||||
argument to every test executable, equivalent to passing
|
||||
arguments after :option:`ctest --` on the command line.
|
||||
|
||||
When both preset and command-line passthrough arguments are
|
||||
specified, preset arguments appear first, followed by
|
||||
command-line arguments.
|
||||
@@ -0,0 +1,18 @@
|
||||
.. This file was generated by Utilities/Scripts/regenerate-presets.py
|
||||
from Help/manual/presets/schema.yaml. Do not edit.
|
||||
|
||||
.. _`CMakePresets.testPresets.filter.include`:
|
||||
|
||||
``include``
|
||||
An optional object specifying which tests to include.
|
||||
The object may contain the following fields:
|
||||
|
||||
.. include:: presets/include-properties.rst
|
||||
|
||||
.. _`CMakePresets.testPresets.filter.exclude`:
|
||||
|
||||
``exclude``
|
||||
An optional object specifying which tests to exclude.
|
||||
The object may contain the following fields:
|
||||
|
||||
.. include:: presets/exclude-properties.rst
|
||||
@@ -0,0 +1,27 @@
|
||||
.. This file was generated by Utilities/Scripts/regenerate-presets.py
|
||||
from Help/manual/presets/schema.yaml. Do not edit.
|
||||
|
||||
.. _`CMakePresets.testPresets.filter.exclude.fixtures.any`:
|
||||
|
||||
``any``
|
||||
An optional string specifying a regex for text fixtures
|
||||
to exclude from adding any tests. Equivalent to passing
|
||||
:ctest-option:`--fixture-exclude-any` on the command
|
||||
line. This field supports `macro expansion`_.
|
||||
|
||||
.. _`CMakePresets.testPresets.filter.exclude.fixtures.setup`:
|
||||
|
||||
``setup``
|
||||
An optional string specifying a regex for text fixtures
|
||||
to exclude from adding setup tests. Equivalent to
|
||||
passing :ctest-option:`--fixture-exclude-setup` on the
|
||||
command line. This field supports `macro expansion`_.
|
||||
|
||||
.. _`CMakePresets.testPresets.filter.exclude.fixtures.cleanup`:
|
||||
|
||||
``cleanup``
|
||||
An optional string specifying a regex for text fixtures
|
||||
to exclude from adding cleanup tests. Equivalent to
|
||||
passing :ctest-option:`--fixture-exclude-cleanup` on
|
||||
the command line.
|
||||
This field supports `macro expansion`_.
|
||||
@@ -0,0 +1,37 @@
|
||||
.. This file was generated by Utilities/Scripts/regenerate-presets.py
|
||||
from Help/manual/presets/schema.yaml. Do not edit.
|
||||
|
||||
.. _`CMakePresets.testPresets.filter.include.name`:
|
||||
|
||||
``name``
|
||||
An optional string specifying a regex for test names.
|
||||
Equivalent to passing :ctest-option:`--tests-regex` on the
|
||||
command line. This field supports `macro expansion`_.
|
||||
|
||||
CMake regex syntax is described under
|
||||
:ref:`string(REGEX) <Regex Specification>`.
|
||||
|
||||
.. _`CMakePresets.testPresets.filter.include.label`:
|
||||
|
||||
``label``
|
||||
An optional string specifying a regex for test labels.
|
||||
Equivalent to passing :ctest-option:`--label-regex` on the
|
||||
command line. This field supports `macro expansion`_.
|
||||
|
||||
.. _`CMakePresets.testPresets.filter.include.useUnion`:
|
||||
|
||||
``useUnion``
|
||||
An optional bool. Equivalent to passing
|
||||
:ctest-option:`--union` on the command line.
|
||||
|
||||
.. _`CMakePresets.testPresets.filter.include.index`:
|
||||
|
||||
``index``
|
||||
An optional object specifying tests to include by test
|
||||
index. The object may contain the following fields. Can
|
||||
also be an optional string specifying a file with the
|
||||
command line syntax for
|
||||
:ctest-option:`--tests-information`. If specified as a
|
||||
string, this field supports `macro expansion`_.
|
||||
|
||||
.. include:: presets/index-properties.rst
|
||||
@@ -0,0 +1,22 @@
|
||||
.. This file was generated by Utilities/Scripts/regenerate-presets.py
|
||||
from Help/manual/presets/schema.yaml. Do not edit.
|
||||
|
||||
.. _`CMakePresets.testPresets.filter.include.index.start`:
|
||||
|
||||
``start``
|
||||
An optional integer specifying a test index at which to start testing.
|
||||
|
||||
.. _`CMakePresets.testPresets.filter.include.index.end`:
|
||||
|
||||
``end``
|
||||
An optional integer specifying a test index at which to stop testing.
|
||||
|
||||
.. _`CMakePresets.testPresets.filter.include.index.stride`:
|
||||
|
||||
``stride``
|
||||
An optional integer specifying the increment.
|
||||
|
||||
.. _`CMakePresets.testPresets.filter.include.index.specificTests`:
|
||||
|
||||
``specificTests``
|
||||
An optional array of integers specifying specific test indices to run.
|
||||
@@ -0,0 +1,16 @@
|
||||
.. This file was generated by Utilities/Scripts/regenerate-presets.py
|
||||
from Help/manual/presets/schema.yaml. Do not edit.
|
||||
|
||||
.. _`CMakePresets.packagePresets.output.debug`:
|
||||
|
||||
``debug``
|
||||
An optional boolean specifying whether or not to print debug
|
||||
information. A value of ``true`` is equivalent to passing
|
||||
:cpack-option:`--debug` on the command line.
|
||||
|
||||
.. _`CMakePresets.packagePresets.output.verbose`:
|
||||
|
||||
``verbose``
|
||||
An optional boolean specifying whether or not to print
|
||||
verbosely. A value of ``true`` is equivalent to passing
|
||||
:cpack-option:`--verbose` on the command line.
|
||||
@@ -0,0 +1,174 @@
|
||||
.. This file was generated by Utilities/Scripts/regenerate-presets.py
|
||||
from Help/manual/presets/schema.yaml. Do not edit.
|
||||
|
||||
.. _`CMakePresets.packagePresets.name`:
|
||||
|
||||
``name``
|
||||
A required string representing the machine-friendly name of the
|
||||
preset. This identifier is used in the :option:`cpack --preset`
|
||||
option. There must not be two package presets in the union of
|
||||
``CMakePresets.json`` and ``CMakeUserPresets.json`` in the same
|
||||
directory with the same name. However, a package preset may have
|
||||
the same name as a configure, build, test, or workflow preset.
|
||||
|
||||
.. _`CMakePresets.packagePresets.hidden`:
|
||||
|
||||
``hidden``
|
||||
An optional boolean specifying whether or not a preset should be
|
||||
hidden. If a preset is hidden, it cannot be used in the
|
||||
:cpack-option:`--preset` argument and does not have to have a valid
|
||||
``configurePreset``, even from inheritance. ``hidden`` presets are
|
||||
intended to be used as a base for other presets to inherit via the
|
||||
``inherits`` field.
|
||||
|
||||
.. _`CMakePresets.packagePresets.inherits`:
|
||||
|
||||
``inherits``
|
||||
An optional array of strings representing the names of presets from which
|
||||
to inherit. This field can also be a string, which is equivalent to an
|
||||
array containing one string.
|
||||
|
||||
The preset will inherit all of the fields from the ``inherits`` presets
|
||||
by default (except ``name``, ``hidden``, ``inherits``, ``description``,
|
||||
and ``displayName``), but can override them as desired. If multiple
|
||||
``inherits`` presets provide conflicting values for the same field, the
|
||||
earlier preset in the ``inherits`` array will be preferred.
|
||||
|
||||
A preset can only inherit from another preset that is defined in the same
|
||||
file or in one of the files it includes (directly or indirectly). Presets
|
||||
in ``CMakePresets.json`` may not inherit from presets in
|
||||
``CMakeUserPresets.json``.
|
||||
|
||||
.. _`CMakePresets.packagePresets.condition`:
|
||||
|
||||
``condition``
|
||||
An optional `Condition`_ object.
|
||||
|
||||
.. _`CMakePresets.packagePresets.vendor`:
|
||||
|
||||
``vendor``
|
||||
An optional map containing vendor-specific information. CMake does not
|
||||
interpret the contents of this field except to verify that it is a map if
|
||||
it does exist. However, it should follow the same conventions as the
|
||||
root-level ``vendor`` field. If vendors use their own per-preset
|
||||
``vendor`` field, they should implement inheritance in a sensible manner
|
||||
when appropriate.
|
||||
|
||||
.. _`CMakePresets.packagePresets.displayName`:
|
||||
|
||||
``displayName``
|
||||
An optional string with a human-friendly name of the preset.
|
||||
|
||||
.. _`CMakePresets.packagePresets.description`:
|
||||
|
||||
``description``
|
||||
An optional string with a human-friendly description of the preset.
|
||||
|
||||
.. _`CMakePresets.packagePresets.environment`:
|
||||
|
||||
``environment``
|
||||
An optional map of environment variables. The key is the variable name
|
||||
(which may not be an empty string), and the value is either ``null`` or a
|
||||
string representing the value of the variable. Each variable is set
|
||||
regardless of whether or not a value was given to it by the process's
|
||||
environment.
|
||||
|
||||
This field supports `macro expansion`_, and environment variables in this
|
||||
map may reference each other, and may be listed in any order, as long as
|
||||
such references do not cause a cycle (for example, if ``ENV_1`` is
|
||||
``$env{ENV_2}``, ``ENV_2`` may not be ``$env{ENV_1}``). ``$penv{NAME}``
|
||||
allows one to prepend or append values to existing environment variables
|
||||
by accessing only values from the parent environment.
|
||||
|
||||
Environment variables are inherited through the ``inherits`` field, and
|
||||
the preset's environment will be the union of its own ``environment`` and
|
||||
the ``environment`` from all its parents. If multiple presets in this
|
||||
union define the same variable, the standard rules of ``inherits`` are
|
||||
applied. Setting a variable to ``null`` causes it to not be set, even if
|
||||
a value was inherited from another preset.
|
||||
|
||||
.. _`CMakePresets.packagePresets.configurePreset`:
|
||||
|
||||
``configurePreset``
|
||||
An optional string specifying the name of a configure preset to
|
||||
associate with this package preset. If ``configurePreset`` is not
|
||||
specified, it must be inherited from the inherits preset (unless
|
||||
this preset is hidden). The build directory is inferred from the
|
||||
configure preset, so packaging will run in the same ``binaryDir``
|
||||
that the configuration did and build did.
|
||||
|
||||
.. _`CMakePresets.packagePresets.inheritConfigureEnvironment`:
|
||||
|
||||
``inheritConfigureEnvironment``
|
||||
An optional boolean that defaults to ``true``. If ``true``, the
|
||||
environment variables from the associated configure preset are
|
||||
inherited after all inherited package preset environments, but
|
||||
before environment variables explicitly specified in this package
|
||||
preset.
|
||||
|
||||
.. _`CMakePresets.packagePresets.generators`:
|
||||
|
||||
``generators``
|
||||
An optional array of strings representing generators for CPack to use.
|
||||
|
||||
.. _`CMakePresets.packagePresets.configurations`:
|
||||
|
||||
``configurations``
|
||||
An optional array of strings representing build configurations for CPack to package.
|
||||
|
||||
.. _`CMakePresets.packagePresets.variables`:
|
||||
|
||||
``variables``
|
||||
An optional map of variables to pass to CPack, equivalent to
|
||||
:cpack-option:`-D` arguments. Each key is the name of a variable,
|
||||
and the value is the string to assign to that variable.
|
||||
|
||||
.. _`CMakePresets.packagePresets.configFile`:
|
||||
|
||||
``configFile``
|
||||
An optional string representing the config file for CPack to use.
|
||||
|
||||
.. _`CMakePresets.packagePresets.output`:
|
||||
|
||||
``output``
|
||||
An optional object specifying output options. Valid keys are:
|
||||
|
||||
.. include:: presets/packageOutput-properties.rst
|
||||
|
||||
.. _`CMakePresets.packagePresets.packageName`:
|
||||
|
||||
``packageName``
|
||||
An optional string representing the package name.
|
||||
|
||||
.. note::
|
||||
|
||||
Due to problems with the implementation, this field does not affect
|
||||
the name of the final package file produced. However, other aspects
|
||||
of the package may use the value, leading to inconsistencies. A
|
||||
future CMake release may address this problem, but until then, it
|
||||
is recommended that this field not be used.
|
||||
|
||||
|
||||
.. _`CMakePresets.packagePresets.packageVersion`:
|
||||
|
||||
``packageVersion``
|
||||
An optional string representing the package version.
|
||||
|
||||
.. note::
|
||||
|
||||
Due to problems with the implementation, this field does not affect
|
||||
the name of the final package file produced. However, other aspects
|
||||
of the package may use the value, leading to inconsistencies. A
|
||||
future CMake release may address this problem, but until then, it
|
||||
is recommended that this field not be used.
|
||||
|
||||
|
||||
.. _`CMakePresets.packagePresets.packageDirectory`:
|
||||
|
||||
``packageDirectory``
|
||||
An optional string representing the directory in which to place the package.
|
||||
|
||||
.. _`CMakePresets.packagePresets.vendorName`:
|
||||
|
||||
``vendorName``
|
||||
An optional string representing the vendor name.
|
||||
@@ -0,0 +1,18 @@
|
||||
.. This file was generated by Utilities/Scripts/regenerate-presets.py
|
||||
from Help/manual/presets/schema.yaml. Do not edit.
|
||||
|
||||
.. _`CMakePresets.testPresets.execution.repeat.mode`:
|
||||
|
||||
``mode``
|
||||
A required string. Must be one of the following values:
|
||||
|
||||
* ``until-fail``
|
||||
|
||||
* ``until-pass``
|
||||
|
||||
* ``after-timeout``
|
||||
|
||||
.. _`CMakePresets.testPresets.execution.repeat.count`:
|
||||
|
||||
``count``
|
||||
A required integer.
|
||||
@@ -0,0 +1,78 @@
|
||||
.. This file was generated by Utilities/Scripts/regenerate-presets.py
|
||||
from Help/manual/presets/schema.yaml. Do not edit.
|
||||
|
||||
.. _`CMakePresets.$schema`:
|
||||
|
||||
``$schema``
|
||||
.. presets-versionadded:: 8
|
||||
|
||||
An optional string that provides a URI to the JSON schema that describes the structure of this JSON document. This field is used for validation and autocompletion in editors that support JSON schema. It doesn't affect the behavior of the document itself. If this field is not specified, the JSON document will still be valid, but tools that use JSON schema for validation and autocompletion may not function correctly.
|
||||
|
||||
.. _`CMakePresets.version`:
|
||||
|
||||
``version``
|
||||
A required integer representing the version of the JSON schema. See
|
||||
`Versions`_ for discussion of the supported versions and the
|
||||
corresponding version of CMake in which they were added.
|
||||
|
||||
.. _`CMakePresets.cmakeMinimumRequired`:
|
||||
|
||||
``cmakeMinimumRequired``
|
||||
An optional object representing the minimum version of CMake
|
||||
needed to build this project. This object consists of the following
|
||||
fields:
|
||||
|
||||
.. include:: presets/cmakeMinimumRequired-properties.rst
|
||||
|
||||
.. _`CMakePresets.include`:
|
||||
|
||||
``include``
|
||||
.. presets-versionadded:: 4
|
||||
|
||||
An optional array of strings representing files to include. If the
|
||||
filenames are not absolute, they are considered relative to the current
|
||||
file. See `Includes`_ for discussion of the constraints on included
|
||||
files.
|
||||
|
||||
.. _`CMakePresets.vendor`:
|
||||
|
||||
``vendor``
|
||||
An optional map containing vendor-specific information. CMake does not
|
||||
interpret the contents of this field except to verify that it is a map if
|
||||
it does exist. However, the keys should be a vendor-specific domain name
|
||||
followed by a ``/``-separated path. For example, the Example IDE 1.0
|
||||
could use ``example.com/ExampleIDE/1.0``. The value of each field can be
|
||||
anything desired by the vendor, though will typically be a map.
|
||||
|
||||
.. _`CMakePresets.configurePresets`:
|
||||
|
||||
``configurePresets``
|
||||
An optional array of `Configure Preset`_ objects.
|
||||
|
||||
.. _`CMakePresets.buildPresets`:
|
||||
|
||||
``buildPresets``
|
||||
.. presets-versionadded:: 2
|
||||
|
||||
An optional array of `Build Preset`_ objects.
|
||||
|
||||
.. _`CMakePresets.testPresets`:
|
||||
|
||||
``testPresets``
|
||||
.. presets-versionadded:: 2
|
||||
|
||||
An optional array of `Test Preset`_ objects.
|
||||
|
||||
.. _`CMakePresets.packagePresets`:
|
||||
|
||||
``packagePresets``
|
||||
.. presets-versionadded:: 6
|
||||
|
||||
An optional array of `Package Preset`_ objects.
|
||||
|
||||
.. _`CMakePresets.workflowPresets`:
|
||||
|
||||
``workflowPresets``
|
||||
.. presets-versionadded:: 6
|
||||
|
||||
An optional array of `Workflow Preset`_ objects.
|
||||
+3758
-2090
File diff suppressed because it is too large.
Load diff
File diff suppressed because it is too large.
Load diff
@@ -0,0 +1,14 @@
|
||||
.. This file was generated by Utilities/Scripts/regenerate-presets.py
|
||||
from Help/manual/presets/schema.yaml. Do not edit.
|
||||
|
||||
.. _`CMakePresets.workflowPresets.steps.type`:
|
||||
|
||||
``type``
|
||||
A required string. The first step must be ``configure``.
|
||||
Subsequent steps must be either ``build``, ``test``, or
|
||||
``package``.
|
||||
|
||||
.. _`CMakePresets.workflowPresets.steps.name`:
|
||||
|
||||
``name``
|
||||
A required string representing the name of the configure, build, test, or package preset to run as this workflow step.
|
||||
@@ -0,0 +1,107 @@
|
||||
.. This file was generated by Utilities/Scripts/regenerate-presets.py
|
||||
from Help/manual/presets/schema.yaml. Do not edit.
|
||||
|
||||
.. _`CMakePresets.testPresets.output.shortProgress`:
|
||||
|
||||
``shortProgress``
|
||||
An optional bool. If ``true``, equivalent to passing
|
||||
:ctest-option:`--progress` on the command line.
|
||||
|
||||
.. _`CMakePresets.testPresets.output.verbosity`:
|
||||
|
||||
``verbosity``
|
||||
An optional string specifying verbosity level. Must be one of
|
||||
the following:
|
||||
|
||||
``default``
|
||||
Equivalent to passing no verbosity flags on the command line.
|
||||
|
||||
``verbose``
|
||||
Equivalent to passing :ctest-option:`--verbose` on the
|
||||
command line.
|
||||
|
||||
``extra``
|
||||
Equivalent to passing :ctest-option:`--extra-verbose` on the
|
||||
command line.
|
||||
|
||||
.. _`CMakePresets.testPresets.output.debug`:
|
||||
|
||||
``debug``
|
||||
An optional bool. If ``true``, equivalent to passing
|
||||
:ctest-option:`--debug` on the command line.
|
||||
|
||||
.. _`CMakePresets.testPresets.output.outputOnFailure`:
|
||||
|
||||
``outputOnFailure``
|
||||
An optional bool. If ``true``, equivalent to passing
|
||||
:ctest-option:`--output-on-failure` on the command line.
|
||||
|
||||
.. _`CMakePresets.testPresets.output.quiet`:
|
||||
|
||||
``quiet``
|
||||
An optional bool. If ``true``, equivalent to passing
|
||||
:ctest-option:`--quiet` on the command line.
|
||||
|
||||
.. _`CMakePresets.testPresets.output.outputLogFile`:
|
||||
|
||||
``outputLogFile``
|
||||
An optional string specifying a path to a log file. Equivalent
|
||||
to passing :ctest-option:`--output-log` on the command line.
|
||||
This field supports `macro expansion`_.
|
||||
|
||||
.. _`CMakePresets.testPresets.output.outputJUnitFile`:
|
||||
|
||||
``outputJUnitFile``
|
||||
.. presets-versionadded:: 6
|
||||
|
||||
An optional string specifying a path to a JUnit file.
|
||||
Equivalent to passing :ctest-option:`--output-junit` on the
|
||||
command line. This field supports `macro expansion`_.
|
||||
|
||||
.. _`CMakePresets.testPresets.output.labelSummary`:
|
||||
|
||||
``labelSummary``
|
||||
An optional bool. If ``false``, equivalent to passing
|
||||
:ctest-option:`--no-label-summary` on the command line.
|
||||
|
||||
.. _`CMakePresets.testPresets.output.subprojectSummary`:
|
||||
|
||||
``subprojectSummary``
|
||||
An optional bool. If ``false``, equivalent to passing
|
||||
:ctest-option:`--no-subproject-summary` on the command line.
|
||||
|
||||
.. _`CMakePresets.testPresets.output.maxPassedTestOutputSize`:
|
||||
|
||||
``maxPassedTestOutputSize``
|
||||
An optional integer specifying the maximum output for passed
|
||||
tests in bytes. Equivalent to passing
|
||||
:ctest-option:`--test-output-size-passed` on the command line.
|
||||
|
||||
.. _`CMakePresets.testPresets.output.maxFailedTestOutputSize`:
|
||||
|
||||
``maxFailedTestOutputSize``
|
||||
An optional integer specifying the maximum output for failed
|
||||
tests in bytes. Equivalent to passing
|
||||
:ctest-option:`--test-output-size-failed` on the command line.
|
||||
|
||||
.. _`CMakePresets.testPresets.output.testOutputTruncation`:
|
||||
|
||||
``testOutputTruncation``
|
||||
.. presets-versionadded:: 5
|
||||
|
||||
An optional string specifying the test output truncation mode.
|
||||
Equivalent to passing :ctest-option:`--test-output-truncation`
|
||||
on the command line. Must be one of the following values:
|
||||
|
||||
* ``tail``
|
||||
|
||||
* ``middle``
|
||||
|
||||
* ``head``
|
||||
|
||||
.. _`CMakePresets.testPresets.output.maxTestNameWidth`:
|
||||
|
||||
``maxTestNameWidth``
|
||||
An optional integer specifying the maximum width of a test name
|
||||
to output. Equivalent to passing :ctest-option:`--max-width` on
|
||||
the command line.
|
||||
@@ -0,0 +1,146 @@
|
||||
.. This file was generated by Utilities/Scripts/regenerate-presets.py
|
||||
from Help/manual/presets/schema.yaml. Do not edit.
|
||||
|
||||
.. _`CMakePresets.testPresets.name`:
|
||||
|
||||
``name``
|
||||
A required string representing the machine-friendly name of the
|
||||
preset. This identifier is used in the :option:`ctest --preset`
|
||||
option. There must not be two test presets in the union of
|
||||
``CMakePresets.json`` and ``CMakeUserPresets.json`` in the same
|
||||
directory with the same name. However, a test preset may have the
|
||||
same name as a configure, build, package, or workflow preset.
|
||||
|
||||
.. _`CMakePresets.testPresets.hidden`:
|
||||
|
||||
``hidden``
|
||||
An optional boolean specifying whether or not a preset should be
|
||||
hidden. If a preset is hidden, it cannot be used in the
|
||||
:ctest-option:`--preset` argument and does not have to have a valid
|
||||
``configurePreset``, even from inheritance. ``hidden`` presets are
|
||||
intended to be used as a base for other presets to inherit via the
|
||||
``inherits`` field.
|
||||
|
||||
.. _`CMakePresets.testPresets.inherits`:
|
||||
|
||||
``inherits``
|
||||
An optional array of strings representing the names of presets from which
|
||||
to inherit. This field can also be a string, which is equivalent to an
|
||||
array containing one string.
|
||||
|
||||
The preset will inherit all of the fields from the ``inherits`` presets
|
||||
by default (except ``name``, ``hidden``, ``inherits``, ``description``,
|
||||
and ``displayName``), but can override them as desired. If multiple
|
||||
``inherits`` presets provide conflicting values for the same field, the
|
||||
earlier preset in the ``inherits`` array will be preferred.
|
||||
|
||||
A preset can only inherit from another preset that is defined in the same
|
||||
file or in one of the files it includes (directly or indirectly). Presets
|
||||
in ``CMakePresets.json`` may not inherit from presets in
|
||||
``CMakeUserPresets.json``.
|
||||
|
||||
.. _`CMakePresets.testPresets.condition`:
|
||||
|
||||
``condition``
|
||||
.. presets-versionadded:: 3
|
||||
|
||||
An optional `Condition`_ object.
|
||||
|
||||
.. _`CMakePresets.testPresets.vendor`:
|
||||
|
||||
``vendor``
|
||||
An optional map containing vendor-specific information. CMake does not
|
||||
interpret the contents of this field except to verify that it is a map if
|
||||
it does exist. However, it should follow the same conventions as the
|
||||
root-level ``vendor`` field. If vendors use their own per-preset
|
||||
``vendor`` field, they should implement inheritance in a sensible manner
|
||||
when appropriate.
|
||||
|
||||
.. _`CMakePresets.testPresets.displayName`:
|
||||
|
||||
``displayName``
|
||||
An optional string with a human-friendly name of the preset.
|
||||
|
||||
.. _`CMakePresets.testPresets.description`:
|
||||
|
||||
``description``
|
||||
An optional string with a human-friendly description of the preset.
|
||||
|
||||
.. _`CMakePresets.testPresets.environment`:
|
||||
|
||||
``environment``
|
||||
An optional map of environment variables. The key is the variable name
|
||||
(which may not be an empty string), and the value is either ``null`` or a
|
||||
string representing the value of the variable. Each variable is set
|
||||
regardless of whether or not a value was given to it by the process's
|
||||
environment.
|
||||
|
||||
This field supports `macro expansion`_, and environment variables in this
|
||||
map may reference each other, and may be listed in any order, as long as
|
||||
such references do not cause a cycle (for example, if ``ENV_1`` is
|
||||
``$env{ENV_2}``, ``ENV_2`` may not be ``$env{ENV_1}``). ``$penv{NAME}``
|
||||
allows one to prepend or append values to existing environment variables
|
||||
by accessing only values from the parent environment.
|
||||
|
||||
Environment variables are inherited through the ``inherits`` field, and
|
||||
the preset's environment will be the union of its own ``environment`` and
|
||||
the ``environment`` from all its parents. If multiple presets in this
|
||||
union define the same variable, the standard rules of ``inherits`` are
|
||||
applied. Setting a variable to ``null`` causes it to not be set, even if
|
||||
a value was inherited from another preset.
|
||||
|
||||
.. _`CMakePresets.testPresets.configurePreset`:
|
||||
|
||||
``configurePreset``
|
||||
An optional string specifying the name of a configure preset to
|
||||
associate with this test preset. If ``configurePreset`` is not
|
||||
specified, it must be inherited from the inherits preset (unless
|
||||
this preset is hidden). The build directory is inferred from the
|
||||
configure preset, so tests will run in the same ``binaryDir`` that
|
||||
the configuration and build used.
|
||||
|
||||
.. _`CMakePresets.testPresets.inheritConfigureEnvironment`:
|
||||
|
||||
``inheritConfigureEnvironment``
|
||||
An optional boolean that defaults to ``true``. If ``true``, the
|
||||
environment variables from the associated configure preset are
|
||||
inherited after all inherited test preset environments, but before
|
||||
environment variables explicitly specified in this test preset.
|
||||
|
||||
.. _`CMakePresets.testPresets.configuration`:
|
||||
|
||||
``configuration``
|
||||
An optional string. Equivalent to passing
|
||||
:ctest-option:`--build-config` on the command line.
|
||||
|
||||
.. _`CMakePresets.testPresets.overwriteConfigurationFile`:
|
||||
|
||||
``overwriteConfigurationFile``
|
||||
An optional array of configuration options to overwrite options
|
||||
specified in the CTest configuration file. Equivalent to passing
|
||||
:ctest-option:`--overwrite` for each value in the array. The array
|
||||
values support `macro expansion`_.
|
||||
|
||||
.. _`CMakePresets.testPresets.output`:
|
||||
|
||||
``output``
|
||||
An optional object specifying output options.
|
||||
The object may contain the following fields:
|
||||
|
||||
.. include:: presets/testOutput-properties.rst
|
||||
|
||||
.. _`CMakePresets.testPresets.filter`:
|
||||
|
||||
``filter``
|
||||
An optional object specifying how to filter the tests to run.
|
||||
The object may contain the following fields:
|
||||
|
||||
.. include:: presets/filter-properties.rst
|
||||
|
||||
.. _`CMakePresets.testPresets.execution`:
|
||||
|
||||
``execution``
|
||||
An optional object specifying options for test execution.
|
||||
The object may contain the following fields:
|
||||
|
||||
.. include:: presets/execution-properties.rst
|
||||
@@ -0,0 +1,27 @@
|
||||
.. This file was generated by Utilities/Scripts/regenerate-presets.py
|
||||
from Help/manual/presets/schema.yaml. Do not edit.
|
||||
|
||||
.. _`CMakePresets.configurePresets.toolset.value`:
|
||||
|
||||
``value``
|
||||
An optional string representing the value.
|
||||
|
||||
.. _`CMakePresets.configurePresets.toolset.strategy`:
|
||||
|
||||
``strategy``
|
||||
An optional string telling CMake how to handle the field.
|
||||
Valid values are:
|
||||
|
||||
``"set"``
|
||||
Set the respective value. This will result in an error for generators
|
||||
that do not support the respective field.
|
||||
|
||||
``"external"``
|
||||
Do not set the value, even if the generator supports it. This is
|
||||
useful if, for example, a preset uses the Ninja generator, and an IDE
|
||||
knows how to set up the Visual C++ environment from the architecture
|
||||
and toolset fields. In that case, CMake will ignore the field, but
|
||||
the IDE can use them to set up the environment before invoking CMake.
|
||||
|
||||
If no ``strategy`` field is given, or if the field uses the string form
|
||||
rather than the object form, the behavior is the same as ``"set"``.
|
||||
@@ -0,0 +1,53 @@
|
||||
.. This file was generated by Utilities/Scripts/regenerate-presets.py
|
||||
from Help/manual/presets/schema.yaml. Do not edit.
|
||||
|
||||
.. _`CMakePresets.configurePresets.trace.mode`:
|
||||
|
||||
``mode``
|
||||
An optional string that specifies the trace mode.
|
||||
Valid values are:
|
||||
|
||||
``on``
|
||||
Causes a trace of all calls made and from where to be
|
||||
printed. Equivalent to passing :cmake-option:`--trace`
|
||||
on the command line.
|
||||
|
||||
``off``
|
||||
A trace of all calls will not be printed.
|
||||
|
||||
``expand``
|
||||
Causes a trace with variables expanded of all calls made
|
||||
and from where to be printed. Equivalent to passing
|
||||
:cmake-option:`--trace-expand` on the command line.
|
||||
|
||||
.. _`CMakePresets.configurePresets.trace.format`:
|
||||
|
||||
``format``
|
||||
An optional string that specifies the format output of the
|
||||
trace. Valid values are:
|
||||
|
||||
``human``
|
||||
Prints each trace line in a human-readable format.
|
||||
This is the default format. Equivalent to passing
|
||||
:cmake-option:`--trace-format=human`
|
||||
on the command line.
|
||||
|
||||
``json-v1``
|
||||
Prints each line as a separate JSON document. Equivalent
|
||||
to passing :cmake-option:`--trace-format=json-v1`
|
||||
on the command line.
|
||||
|
||||
.. _`CMakePresets.configurePresets.trace.source`:
|
||||
|
||||
``source``
|
||||
An optional array of strings representing the paths of source
|
||||
files to be traced. This field can also be a string, which is
|
||||
equivalent to an array containing one string. Equivalent to
|
||||
passing :cmake-option:`--trace-source` on the command line.
|
||||
|
||||
.. _`CMakePresets.configurePresets.trace.redirect`:
|
||||
|
||||
``redirect``
|
||||
An optional string specifying a path to a trace output file.
|
||||
Equivalent to passing :cmake-option:`--trace-redirect` on the
|
||||
command line.
|
||||
@@ -0,0 +1,43 @@
|
||||
.. This file was generated by Utilities/Scripts/regenerate-presets.py
|
||||
from Help/manual/presets/schema.yaml. Do not edit.
|
||||
|
||||
.. _`CMakePresets.configurePresets.warnings.deprecated`:
|
||||
|
||||
``deprecated``
|
||||
An optional boolean. Equivalent to passing
|
||||
:cmake-option:`-Wdeprecated` or
|
||||
:cmake-option:`-Wno-deprecated`
|
||||
on the command line.
|
||||
This may not be set to ``false``
|
||||
if ``errors.deprecated`` is set to ``true``.
|
||||
|
||||
.. _`CMakePresets.configurePresets.warnings.dev`:
|
||||
|
||||
``dev``
|
||||
An optional boolean. Equivalent to passing
|
||||
:cmake-option:`-Wdev` or
|
||||
:cmake-option:`-Wno-dev`
|
||||
on the command line.
|
||||
This may not be set to ``false``
|
||||
if ``errors.dev`` is set to ``true``.
|
||||
|
||||
.. _`CMakePresets.configurePresets.warnings.uninitialized`:
|
||||
|
||||
``uninitialized``
|
||||
An optional boolean. Setting this to ``true`` is equivalent to
|
||||
passing :cmake-option:`--warn-uninitialized` on the command
|
||||
line.
|
||||
|
||||
.. _`CMakePresets.configurePresets.warnings.unusedCli`:
|
||||
|
||||
``unusedCli``
|
||||
An optional boolean. Setting this to ``false`` is equivalent to
|
||||
passing :cmake-option:`--no-warn-unused-cli` on the command
|
||||
line.
|
||||
|
||||
.. _`CMakePresets.configurePresets.warnings.systemVars`:
|
||||
|
||||
``systemVars``
|
||||
An optional boolean. Setting this to ``true`` is equivalent to
|
||||
passing :cmake-option:`--check-system-vars` on the command
|
||||
line.
|
||||
@@ -0,0 +1,44 @@
|
||||
.. This file was generated by Utilities/Scripts/regenerate-presets.py
|
||||
from Help/manual/presets/schema.yaml. Do not edit.
|
||||
|
||||
.. _`CMakePresets.workflowPresets.name`:
|
||||
|
||||
``name``
|
||||
A required string representing the machine-friendly name of the
|
||||
preset. This identifier is used in the
|
||||
:option:`cmake --workflow --preset <cmake--workflow --preset>`
|
||||
option. There must not be two workflow presets in the union of
|
||||
``CMakePresets.json`` and ``CMakeUserPresets.json`` in the same
|
||||
directory with the same name. However, a workflow preset may have
|
||||
the same name as a configure, build, test, or package preset.
|
||||
|
||||
.. _`CMakePresets.workflowPresets.vendor`:
|
||||
|
||||
``vendor``
|
||||
An optional map containing vendor-specific information. CMake does not
|
||||
interpret the contents of this field except to verify that it is a map if
|
||||
it does exist. However, it should follow the same conventions as the
|
||||
root-level ``vendor`` field. If vendors use their own per-preset
|
||||
``vendor`` field, they should implement inheritance in a sensible manner
|
||||
when appropriate.
|
||||
|
||||
.. _`CMakePresets.workflowPresets.displayName`:
|
||||
|
||||
``displayName``
|
||||
An optional string with a human-friendly name of the preset.
|
||||
|
||||
.. _`CMakePresets.workflowPresets.description`:
|
||||
|
||||
``description``
|
||||
An optional string with a human-friendly description of the preset.
|
||||
|
||||
.. _`CMakePresets.workflowPresets.steps`:
|
||||
|
||||
``steps``
|
||||
A required array of objects describing the steps of the workflow.
|
||||
The first step must be a configure preset, and all subsequent steps
|
||||
must be non-configure presets whose ``configurePreset`` field
|
||||
matches the starting configure preset. Each object may contain the
|
||||
following fields:
|
||||
|
||||
.. include:: presets/steps-properties.rst
|
||||
@@ -60,6 +60,6 @@ See Also
|
||||
|
||||
* The :option:`--install-prefix <cmake --install-prefix>` option.
|
||||
* The :genex:`$<INSTALL_PREFIX>` generator expression.
|
||||
* The :ref:`installDir <CMakePresets installDir>` field in CMake configure
|
||||
presets.
|
||||
* The :ref:`installDir <CMakePresets.configurePresets.installDir>` field in
|
||||
CMake configure presets.
|
||||
* The :variable:`CPACK_PACKAGING_INSTALL_PREFIX` variable.
|
||||
Executable
+686
@@ -0,0 +1,686 @@
|
||||
#!/usr/bin/env python3
|
||||
"""Generate CMake presets documentation (reST) and JSON schema.
|
||||
|
||||
The documentation and JSON schema for CMake presets are both generated from
|
||||
Help/manual/presets/schema.yaml, which describes the schema in a way that
|
||||
allows both documentation forms to be combined in a single file, and also makes
|
||||
it much easier to manage version revisions (compared to editing the JSON schema
|
||||
'by hand').
|
||||
|
||||
All input and output files are expected to be in known locations relative to
|
||||
this script.
|
||||
|
||||
Usage: python3 regenerate-presets.py
|
||||
"""
|
||||
|
||||
import json
|
||||
from copy import deepcopy
|
||||
from pathlib import Path
|
||||
from typing import Any, Self
|
||||
|
||||
import yaml
|
||||
|
||||
LATEST = 1
|
||||
TYPES = {}
|
||||
REFS = {}
|
||||
|
||||
PRESETS_REL = 'Help/manual/presets'
|
||||
SCHEMA_YAML_FILENAME = 'schema.yaml'
|
||||
SCHEMA_JSON_FILENAME = 'schema.json'
|
||||
|
||||
WORKSPACE = Path(__file__).parent.parent.parent.absolute()
|
||||
PRESETS = WORKSPACE / PRESETS_REL
|
||||
|
||||
RST_BANNER = f"""\
|
||||
.. This file was generated by {Path(__file__).relative_to(WORKSPACE)}
|
||||
from {PRESETS_REL}/{SCHEMA_YAML_FILENAME}. Do not edit.
|
||||
"""
|
||||
|
||||
|
||||
# =============================================================================
|
||||
class Value:
|
||||
|
||||
# -------------------------------------------------------------------------
|
||||
def __init__(self, data: list[dict[str, Any]]):
|
||||
self.data = data
|
||||
self.spans = None
|
||||
|
||||
# -------------------------------------------------------------------------
|
||||
@property
|
||||
def objects(self) -> dict[str, 'Object']:
|
||||
return {}
|
||||
|
||||
# -------------------------------------------------------------------------
|
||||
def updateSpans(self, since: int, until: int) -> None:
|
||||
self.spans = [(since, until)]
|
||||
|
||||
# -------------------------------------------------------------------------
|
||||
def updateRefs(self, objects: dict[str, 'Object']) -> None:
|
||||
pass
|
||||
|
||||
# -------------------------------------------------------------------------
|
||||
def defs(self) -> dict[str, Any]:
|
||||
return {}
|
||||
|
||||
# -------------------------------------------------------------------------
|
||||
def schema(self, version: int) -> dict[str, Any]:
|
||||
return deepcopy(self.data)
|
||||
|
||||
|
||||
# =============================================================================
|
||||
class Object(Value):
|
||||
|
||||
# -------------------------------------------------------------------------
|
||||
def __init__(self, data: dict[str, Any], name: str,
|
||||
label: str | None = None):
|
||||
# Prevent data sharing from modifying unrelated parts of the schema as
|
||||
# we pick apart our section.
|
||||
data = deepcopy(data)
|
||||
|
||||
self.name = data.pop('id', name)
|
||||
self.label = label
|
||||
|
||||
self.properties = {}
|
||||
for n, p in data.pop('properties').items():
|
||||
pl = '.'.join([label, n]) if label is not None else n
|
||||
self.properties[n] = Property(p, n, pl)
|
||||
if len(self.properties):
|
||||
self.properties[CommentProperty.name] = CommentProperty()
|
||||
|
||||
ap = data.pop('additionalProperties', None)
|
||||
if ap is not None:
|
||||
self.additionalProperties = buildValue(ap, self.name, self.label)
|
||||
else:
|
||||
self.additionalProperties = None
|
||||
|
||||
super().__init__(data)
|
||||
|
||||
# -------------------------------------------------------------------------
|
||||
@property
|
||||
def objects(self) -> dict[str, Self]:
|
||||
out = {self.name: self}
|
||||
for p in self.properties.values():
|
||||
out.update(p.objects)
|
||||
if self.additionalProperties is not None:
|
||||
out.update(self.additionalProperties.objects)
|
||||
return out
|
||||
|
||||
# -------------------------------------------------------------------------
|
||||
def updateSpans(self, since: int, until: int) -> None:
|
||||
spans = [[(since, until)]]
|
||||
for p in self.properties.values():
|
||||
p.updateSpans(since, until)
|
||||
spans.append(p.spans)
|
||||
if self.additionalProperties is not None:
|
||||
self.additionalProperties.updateSpans(since, until)
|
||||
spans.append(self.additionalProperties.spans)
|
||||
self.spans = combineSpans(*spans)
|
||||
|
||||
# -------------------------------------------------------------------------
|
||||
def updateRefs(self, objects: dict[str, 'Object']) -> None:
|
||||
for p in self.properties.values():
|
||||
p.updateRefs(objects)
|
||||
if self.additionalProperties is not None:
|
||||
self.additionalProperties.updateRefs(objects)
|
||||
|
||||
# -------------------------------------------------------------------------
|
||||
def doc(self, since: int, until: int) -> str | None:
|
||||
since = max(since, self.spans[0][0])
|
||||
until = min(until, self.spans[-1][1])
|
||||
|
||||
out = []
|
||||
for _, p in self.properties.items():
|
||||
content = p.doc(since, until)
|
||||
if not content:
|
||||
continue
|
||||
out.append(content)
|
||||
|
||||
return '\n\n'.join(out) if len(out) else None
|
||||
|
||||
# -------------------------------------------------------------------------
|
||||
def defs(self, exclude: set[str] = {}) -> dict[str, Any]:
|
||||
out = {}
|
||||
for n, p in self.properties.items():
|
||||
if n in exclude:
|
||||
continue
|
||||
for s in p.spans:
|
||||
r = f'{p.label}@{spanRef(*s)}'
|
||||
out[r] = p.schema(s[0])
|
||||
out.update(p.defs())
|
||||
if self.additionalProperties is not None:
|
||||
out.update(self.additionalProperties.defs())
|
||||
return out
|
||||
|
||||
# -------------------------------------------------------------------------
|
||||
def schema(self, version: int, inline: set[str] = {}) -> dict[str, Any]:
|
||||
out = deepcopy(self.data)
|
||||
|
||||
props = {}
|
||||
required = []
|
||||
for n, p in self.properties.items():
|
||||
if n in inline:
|
||||
props[n] = p.schema(version)
|
||||
else:
|
||||
r = p.ref(version)
|
||||
if r is not None:
|
||||
props[n] = r
|
||||
if p.required:
|
||||
required.append(n)
|
||||
|
||||
out['properties'] = props
|
||||
if len(required):
|
||||
out['required'] = required
|
||||
|
||||
if self.additionalProperties is not None:
|
||||
ap = self.additionalProperties.schema(version)
|
||||
out['additionalProperties'] = ap
|
||||
return out
|
||||
|
||||
|
||||
# =============================================================================
|
||||
class Ref(Value):
|
||||
|
||||
# -------------------------------------------------------------------------
|
||||
def __init__(self, data: list[dict[str, Any]]):
|
||||
self.target = data.pop('target')
|
||||
self.targetSpans = None
|
||||
super().__init__(data)
|
||||
|
||||
# -------------------------------------------------------------------------
|
||||
def updateSpans(self, since: int, until: int) -> None:
|
||||
if self.spans is None:
|
||||
super().updateSpans(since, until)
|
||||
self.spans = trimSpans(self.spans, since, until)
|
||||
|
||||
# -------------------------------------------------------------------------
|
||||
def updateRefs(self, objects: dict[str, 'Object']) -> None:
|
||||
global REFS
|
||||
|
||||
t = objects.get(self.target)
|
||||
if t is not None:
|
||||
since = self.spans[0][0]
|
||||
until = self.spans[-1][1]
|
||||
self.spans = trimSpans(t.spans, since, until)
|
||||
self.targetSpans = t.spans
|
||||
|
||||
rs = REFS.get(self.target, (since, until))
|
||||
REFS[self.target] = (min(since, rs[0]), max(until, rs[1]))
|
||||
|
||||
# -------------------------------------------------------------------------
|
||||
def schema(self, version: int) -> dict[str, Any]:
|
||||
ts = trimSpans(self.targetSpans, *REFS[self.target])
|
||||
s = findSpan(ts, version)
|
||||
if s is not None:
|
||||
return {
|
||||
'$ref': f'#/definitions/{self.target}@{spanRef(*s)}',
|
||||
}
|
||||
return {}
|
||||
|
||||
|
||||
# =============================================================================
|
||||
class Array(Value):
|
||||
|
||||
# -------------------------------------------------------------------------
|
||||
def __init__(self, data: dict[str, Any], name: str, label: str):
|
||||
item = data.pop('items')
|
||||
self.value = buildValue(item, name, label)
|
||||
|
||||
super().__init__(data)
|
||||
|
||||
# -------------------------------------------------------------------------
|
||||
@property
|
||||
def objects(self) -> dict[str, Object]:
|
||||
return self.value.objects
|
||||
|
||||
# -------------------------------------------------------------------------
|
||||
def updateSpans(self, since: int, until: int) -> None:
|
||||
self.value.updateSpans(since, until)
|
||||
self.spans = self.value.spans
|
||||
|
||||
# -------------------------------------------------------------------------
|
||||
def updateRefs(self, objects: dict[str, 'Object']) -> None:
|
||||
self.value.updateRefs(objects)
|
||||
|
||||
# -------------------------------------------------------------------------
|
||||
def defs(self) -> dict[str, Any]:
|
||||
return self.value.defs()
|
||||
|
||||
# -------------------------------------------------------------------------
|
||||
def schema(self, version: int) -> dict[str, Any]:
|
||||
out = deepcopy(self.data)
|
||||
out['items'] = self.value.schema(version)
|
||||
return out
|
||||
|
||||
|
||||
# =============================================================================
|
||||
class Union(Value):
|
||||
|
||||
# -------------------------------------------------------------------------
|
||||
def __init__(self, data: list[dict[str, Any]], name: str, label: str):
|
||||
self.items = []
|
||||
for i, d in enumerate(data):
|
||||
self.items.append(buildValue(d, name, self.itemLabel(label, i)))
|
||||
|
||||
super().__init__({})
|
||||
|
||||
# -------------------------------------------------------------------------
|
||||
def itemLabel(self, label: str, index: int) -> str:
|
||||
return label
|
||||
|
||||
# -------------------------------------------------------------------------
|
||||
@property
|
||||
def objects(self) -> dict[str, Object]:
|
||||
out = {}
|
||||
for v in self.items:
|
||||
out.update(v.objects)
|
||||
return out
|
||||
|
||||
# -------------------------------------------------------------------------
|
||||
def updateSpans(self, since: int, until: int) -> None:
|
||||
spans = [[(since, until)]]
|
||||
for i in self.items:
|
||||
i.updateSpans(since, until)
|
||||
spans.append(i.spans)
|
||||
self.spans = combineSpans(*spans)
|
||||
|
||||
# -------------------------------------------------------------------------
|
||||
def updateRefs(self, objects: dict[str, 'Object']) -> None:
|
||||
for i in self.items:
|
||||
i.updateRefs(objects)
|
||||
|
||||
# -------------------------------------------------------------------------
|
||||
def defs(self) -> dict[str, Any]:
|
||||
out = {}
|
||||
for v in self.items:
|
||||
out.update(v.defs())
|
||||
return out
|
||||
|
||||
# -------------------------------------------------------------------------
|
||||
def schema(self, version: int) -> dict[str, Any]:
|
||||
out = []
|
||||
for i in self.items:
|
||||
out.append(i.schema(version))
|
||||
return {'anyOf': out}
|
||||
|
||||
|
||||
# =============================================================================
|
||||
class Variant(Union):
|
||||
|
||||
# -------------------------------------------------------------------------
|
||||
def __init__(self, data: list[dict[str, Any]], name: str, label: str):
|
||||
self.identifier = data.pop('id', None)
|
||||
|
||||
if self.identifier is not None:
|
||||
name = self.identifier
|
||||
label = self.identifier
|
||||
|
||||
super().__init__(data.pop('items'), name, label)
|
||||
|
||||
# -------------------------------------------------------------------------
|
||||
def itemLabel(self, label: str, index: int) -> str:
|
||||
return f'{label}[{index}]'
|
||||
|
||||
# -------------------------------------------------------------------------
|
||||
@property
|
||||
def objects(self) -> dict[str, Object]:
|
||||
out = super().objects
|
||||
if self.identifier is not None:
|
||||
out[self.identifier] = self
|
||||
return out
|
||||
|
||||
# -------------------------------------------------------------------------
|
||||
def doc(self, since: int, until: int) -> None:
|
||||
return None
|
||||
|
||||
# -------------------------------------------------------------------------
|
||||
def defs(self) -> dict[str, Any]:
|
||||
out = super().defs()
|
||||
|
||||
if self.identifier is not None:
|
||||
for s in self.spans:
|
||||
n = f'{self.identifier}@{spanRef(*s)}'
|
||||
out[n] = super().schema(s[0])
|
||||
|
||||
return out
|
||||
|
||||
# -------------------------------------------------------------------------
|
||||
def schema(self, version: int) -> dict[str, Any]:
|
||||
if self.identifier is not None:
|
||||
s = findSpan(self.spans, version)
|
||||
if s is not None:
|
||||
return {
|
||||
'$ref': f'#/definitions/{self.identifier}@{spanRef(*s)}',
|
||||
}
|
||||
return {}
|
||||
|
||||
return super().schema(version)
|
||||
|
||||
|
||||
# =============================================================================
|
||||
class Property:
|
||||
|
||||
# -------------------------------------------------------------------------
|
||||
def __init__(self, data: dict[str, Any], name: str, label: str):
|
||||
self.name = name
|
||||
self.label = label
|
||||
self.since = data.pop('since', 1)
|
||||
self.until = data.pop('until', LATEST + 1)
|
||||
self.required = data.pop('required', False)
|
||||
self.content = data.pop('sphinxDescription', data.get('description'))
|
||||
|
||||
note = data.pop('sphinxNote', None)
|
||||
if note is not None:
|
||||
self.content += f'\n\n.. note::\n\n{indent(note)}'
|
||||
|
||||
self._revisions = []
|
||||
for rev in data.pop('revisions', []):
|
||||
rd = deepcopy(data)
|
||||
rd.update(rev)
|
||||
self._revisions.append(Property(rd, self.name, self.label))
|
||||
|
||||
if len(self._revisions):
|
||||
self.since = max(self.since,
|
||||
min([r.since for r in self._revisions]))
|
||||
self.until = min(self.until,
|
||||
max([r.until for r in self._revisions]))
|
||||
self.value = None
|
||||
else:
|
||||
self.value = buildValue(data, self.name, self.label)
|
||||
|
||||
self.spans = None
|
||||
|
||||
# -------------------------------------------------------------------------
|
||||
@property
|
||||
def objects(self) -> dict[str, Object]:
|
||||
if len(self._revisions):
|
||||
out = {}
|
||||
for r in self._revisions:
|
||||
out.update(r.objects)
|
||||
return out
|
||||
|
||||
return self.value.objects
|
||||
|
||||
# -------------------------------------------------------------------------
|
||||
def updateSpans(self, since: int, until: int) -> None:
|
||||
since = max(since, self.since)
|
||||
until = min(until, self.until)
|
||||
|
||||
if len(self._revisions):
|
||||
spans = [[(since, until)]]
|
||||
for r in self._revisions:
|
||||
r.updateSpans(since, until)
|
||||
spans.append(r.spans)
|
||||
self.spans = combineSpans(*spans)
|
||||
else:
|
||||
self.value.updateSpans(since, until)
|
||||
self.spans = self.value.spans
|
||||
|
||||
# -------------------------------------------------------------------------
|
||||
def updateRefs(self, objects: dict[str, 'Object']) -> None:
|
||||
if len(self._revisions):
|
||||
for r in self._revisions:
|
||||
r.updateRefs(objects)
|
||||
else:
|
||||
self.value.updateRefs(objects)
|
||||
|
||||
# -------------------------------------------------------------------------
|
||||
def ref(self, version: int) -> dict[str, str] | None:
|
||||
s = findSpan(self.spans, version)
|
||||
if s is not None:
|
||||
return {
|
||||
'$ref': f'#/definitions/{self.label}@{spanRef(*s)}',
|
||||
}
|
||||
return None
|
||||
|
||||
# -------------------------------------------------------------------------
|
||||
def doc(self, since: int, until: int) -> str | None:
|
||||
if self.content is None:
|
||||
return None
|
||||
|
||||
out = f'.. _`CMakePresets.{self.label}`:\n\n``{self.name}``\n'
|
||||
if self.since > since:
|
||||
out += f' .. presets-versionadded:: {self.since}\n\n'
|
||||
if self.until < until:
|
||||
out += f' .. presets-versionremoved:: {self.until}\n\n'
|
||||
out += indent(self.content)
|
||||
|
||||
return out
|
||||
|
||||
# -------------------------------------------------------------------------
|
||||
def defs(self) -> dict[str, Any]:
|
||||
if len(self._revisions):
|
||||
out = {}
|
||||
for r in self._revisions:
|
||||
out.update(r.defs())
|
||||
return out
|
||||
|
||||
return self.value.defs()
|
||||
|
||||
# -------------------------------------------------------------------------
|
||||
def schema(self, version: int) -> dict[str, Any]:
|
||||
for r in self._revisions:
|
||||
if version >= r.since and version < r.until:
|
||||
return r.value.schema(version)
|
||||
return self.value.schema(version)
|
||||
|
||||
|
||||
# =============================================================================
|
||||
class CommentProperty(Property):
|
||||
name: str = '$comment'
|
||||
since: int = 10
|
||||
|
||||
# -------------------------------------------------------------------------
|
||||
def __init__(self):
|
||||
data = {
|
||||
'since': type(self).since,
|
||||
'id': 'comment',
|
||||
'type': 'variant',
|
||||
'items': [
|
||||
{
|
||||
'type': 'string',
|
||||
'description': 'A single-line comment.',
|
||||
},
|
||||
{
|
||||
'type': 'array',
|
||||
'description': 'A multi-line comment.',
|
||||
'minItems': 1,
|
||||
'items': {
|
||||
'type': 'string',
|
||||
'description': 'One line of the multi-line comment.',
|
||||
}
|
||||
}
|
||||
],
|
||||
}
|
||||
super().__init__(data, type(self).name, type(self).name)
|
||||
|
||||
# -------------------------------------------------------------------------
|
||||
def doc(self, since: int, until: int) -> None:
|
||||
return None
|
||||
|
||||
|
||||
# -----------------------------------------------------------------------------
|
||||
def buildValue(
|
||||
data: Any, name: str, label: str | None = None
|
||||
) -> Variant | Object | Array | Ref | Value:
|
||||
if type(data) is dict:
|
||||
if 'anyOf' in data:
|
||||
return Union(data.pop('anyOf'), name, label)
|
||||
elif data['type'] == 'variant':
|
||||
return Variant(data, name, label)
|
||||
elif data['type'] == 'array':
|
||||
return Array(data, name, label)
|
||||
elif data['type'] == 'object':
|
||||
return Object(data, name, label)
|
||||
elif data['type'] == 'ref':
|
||||
return Ref(data)
|
||||
|
||||
return Value(data)
|
||||
|
||||
|
||||
# -----------------------------------------------------------------------------
|
||||
def extractDivisions(spans: list[tuple[int, int]]) -> set[int]:
|
||||
return {n for s in spans for n in s}
|
||||
|
||||
|
||||
# -----------------------------------------------------------------------------
|
||||
def trimSpans(spans: list[tuple[int, int]],
|
||||
since: int, until: int) -> list[tuple[int, int]]:
|
||||
divisions = extractDivisions(spans)
|
||||
|
||||
last = since
|
||||
out = []
|
||||
|
||||
for d in sorted(divisions):
|
||||
if d > since:
|
||||
out.append((last, min(d, until)))
|
||||
last = min(d, until)
|
||||
if d >= until:
|
||||
break
|
||||
|
||||
return out
|
||||
|
||||
|
||||
# -----------------------------------------------------------------------------
|
||||
def combineSpans(*spans: list[tuple[int, int]]) -> list[tuple[int, int]]:
|
||||
divisions = set()
|
||||
for s in spans:
|
||||
divisions.update(extractDivisions(s))
|
||||
|
||||
divisions = sorted(divisions)
|
||||
last = divisions.pop(0)
|
||||
out = []
|
||||
|
||||
for d in divisions:
|
||||
out.append((last, d))
|
||||
last = d
|
||||
|
||||
return out
|
||||
|
||||
|
||||
# -----------------------------------------------------------------------------
|
||||
def findSpan(spans: list[tuple[int, int]],
|
||||
version: int) -> tuple[int, int] | None:
|
||||
for s in spans:
|
||||
if version >= s[0] and version < s[1]:
|
||||
return s
|
||||
|
||||
return None
|
||||
|
||||
|
||||
# -----------------------------------------------------------------------------
|
||||
def spanRef(since: int, until: int) -> str:
|
||||
if since + 1 < until:
|
||||
if until > LATEST:
|
||||
return f'v{since}..'
|
||||
else:
|
||||
return f'v{since}..v{until - 1}'
|
||||
return f'v{since}'
|
||||
|
||||
|
||||
# -----------------------------------------------------------------------------
|
||||
def indent(text: str):
|
||||
return '\n'.join([(' ' + line).rstrip() for line in text.split('\n')])
|
||||
|
||||
|
||||
# -----------------------------------------------------------------------------
|
||||
def trimDescriptions(data: Any):
|
||||
if type(data) is dict:
|
||||
for k, v in data.items():
|
||||
if type(v) is str and k in {'description', 'sphinxDescription'}:
|
||||
data[k] = v.strip()
|
||||
elif type(v) is dict:
|
||||
data[k] = trimDescriptions(v)
|
||||
elif type(v) is list:
|
||||
data[k] = [trimDescriptions(item) for item in v]
|
||||
|
||||
return data
|
||||
|
||||
|
||||
# -----------------------------------------------------------------------------
|
||||
def main():
|
||||
# Read the schema definition.
|
||||
with open(PRESETS / SCHEMA_YAML_FILENAME, 'r') as f:
|
||||
schema = yaml.safe_load(f)
|
||||
|
||||
# Extract the current (latest) version.
|
||||
global LATEST
|
||||
|
||||
del schema['definitions']
|
||||
LATEST = schema.pop('version')
|
||||
|
||||
# Remove whitespace around descriptions.
|
||||
schema = trimDescriptions(schema)
|
||||
|
||||
# Extract global type definitions.
|
||||
global TYPES, REFS
|
||||
|
||||
for t in schema.pop('types', []):
|
||||
name = t['id']
|
||||
value = buildValue(t, name)
|
||||
value.updateSpans(1, LATEST + 1)
|
||||
TYPES[name] = value
|
||||
|
||||
for t in TYPES.values():
|
||||
t.updateRefs(TYPES)
|
||||
|
||||
# Reset the spans for references, as these currently contain only spans for
|
||||
# circular references of global types, which are likely broader than the
|
||||
# actual usage spans of those types. We'll recalculate the correct spans
|
||||
# when we update refs from the root object.
|
||||
REFS = {}
|
||||
|
||||
# Parse the root object. This will also recursively parse other objects.
|
||||
root = Object(schema, 'root')
|
||||
root.updateSpans(1, LATEST + 1)
|
||||
|
||||
# Resolve references.
|
||||
objects = root.objects
|
||||
|
||||
types = objects
|
||||
types.update(TYPES)
|
||||
|
||||
root.updateRefs(types)
|
||||
|
||||
for name, value in TYPES.items():
|
||||
span = REFS.get(name)
|
||||
if span is not None:
|
||||
value.updateSpans(*span)
|
||||
|
||||
root.updateSpans(1, LATEST + 1)
|
||||
|
||||
# Extract Sphinx documentation for each object's properties.
|
||||
for n, o in objects.items():
|
||||
doc = o.doc(1, LATEST + 1)
|
||||
if doc is not None:
|
||||
print(f'- Generating reST documentation for {n} properties')
|
||||
with open(PRESETS / f'{o.name}-properties.rst', 'w') as f:
|
||||
print(RST_BANNER, file=f)
|
||||
print(doc, file=f)
|
||||
|
||||
# Generate schema for each version.
|
||||
versions = []
|
||||
for v in range(1, LATEST + 1):
|
||||
vs = root.schema(v, inline={'version'})
|
||||
vs['properties']['version']['const'] = v
|
||||
versions.append(vs)
|
||||
|
||||
# Add definitions and write the schema.
|
||||
types = root.defs(exclude={'version'})
|
||||
for t in TYPES.values():
|
||||
types.update(t.defs())
|
||||
|
||||
schema = {
|
||||
'$schema': 'http://json-schema.org/draft/2020-12/schema#',
|
||||
'type': 'object',
|
||||
'oneOf': versions,
|
||||
'required': ['version'],
|
||||
'definitions': types
|
||||
}
|
||||
|
||||
with open(PRESETS / SCHEMA_JSON_FILENAME, 'w') as f:
|
||||
print(json.dumps(schema, indent=2), file=f)
|
||||
|
||||
|
||||
# %%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
|
||||
|
||||
main()
|
||||
@@ -21,6 +21,8 @@ if sphinx.version_info >= (2,):
|
||||
from sphinx import addnodes
|
||||
from sphinx.directives import ObjectDescription, nl_escape_re
|
||||
from sphinx.domains import Domain, ObjType
|
||||
from sphinx.domains.changeset import VersionChange
|
||||
from sphinx.domains.changeset import versionlabels, versionlabel_classes
|
||||
from sphinx.domains.std import OptionXRefRole
|
||||
from sphinx.roles import XRefRole
|
||||
from sphinx.util import logging, ws_re
|
||||
@@ -776,4 +778,21 @@ def setup(app):
|
||||
app.add_transform(CMakeTransform)
|
||||
app.add_transform(CMakeXRefTransform)
|
||||
app.add_domain(CMakeDomain)
|
||||
|
||||
versionlabels.update({
|
||||
'presets-versionadded': 'Added in presets version %s',
|
||||
'presets-versionchanged': 'Changed in presets version %s',
|
||||
'presets-versionremoved': 'Removed in presets version %s',
|
||||
})
|
||||
|
||||
versionlabel_classes.update({
|
||||
'presets-versionadded': 'added',
|
||||
'presets-versionchanged': 'changed',
|
||||
'presets-versionremoved': 'removed',
|
||||
})
|
||||
|
||||
app.add_directive('presets-versionadded', VersionChange)
|
||||
app.add_directive('presets-versionchanged', VersionChange)
|
||||
app.add_directive('presets-versionremoved', VersionChange)
|
||||
|
||||
return {"parallel_read_safe": True}
|
||||
@@ -26,7 +26,8 @@ exclude_patterns = [
|
||||
'dev',
|
||||
# NOTE Ignore shared RST files used in `.. include::` directives
|
||||
'include/*.rst',
|
||||
'**/include/*.rst'
|
||||
'**/include/*.rst',
|
||||
'manual/presets/*.rst',
|
||||
]
|
||||
|
||||
extensions = ['cmake']
|
||||
|
||||
Reference in new issue
Block a user