Skip to content

Commit f3dd734

Browse files
committed
Add Build Presets
1 parent 3d104ca commit f3dd734

File tree

1 file changed

+29
-5
lines changed

1 file changed

+29
-5
lines changed

cppython/plugins/cmake/schema.py

Lines changed: 29 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -65,17 +65,36 @@ class ConfigurePreset(CPPythonModel, extra='allow'):
6565
cacheVariables: dict[str, None | bool | str | CacheVariable] | None = None
6666

6767

68-
class CMakePresets(CPPythonModel, extra='allow'):
69-
"""The schema for the CMakePresets and CMakeUserPresets files.
68+
class BuildPreset(CPPythonModel, extra='allow'):
69+
"""Partial Build Preset specification for CMake build presets"""
7070

71-
The only information needed is the configure preset list for cache variable injection
72-
"""
71+
name: str
72+
hidden: Annotated[bool | None, Field(description='If true, the preset is hidden and cannot be used directly.')] = (
73+
None
74+
)
75+
76+
inherits: Annotated[
77+
str | list[str] | None, Field(description='The inherits field allows inheriting from other presets.')
78+
] = None
79+
configurePreset: Annotated[
80+
str | None,
81+
Field(description='The name of a configure preset to associate with this build preset.'),
82+
] = None
83+
configuration: Annotated[
84+
str | None,
85+
Field(description='Build configuration. Equivalent to --config on the command line.'),
86+
] = None
87+
88+
89+
class CMakePresets(CPPythonModel, extra='allow'):
90+
"""The schema for the CMakePresets and CMakeUserPresets files."""
7391

7492
version: Annotated[int, Field(description='The version of the JSON schema.')] = 9
7593
include: Annotated[
7694
list[str] | None, Field(description='The include field allows inheriting from another preset.')
7795
] = None
7896
configurePresets: Annotated[list[ConfigurePreset] | None, Field(description='The list of configure presets')] = None
97+
buildPresets: Annotated[list[BuildPreset] | None, Field(description='The list of build presets')] = None
7998

8099

81100
class CMakeSyncData(SyncData):
@@ -108,5 +127,10 @@ class CMakeConfiguration(CPPythonModel):
108127
),
109128
] = Path('CMakePresets.json')
110129
configuration_name: Annotated[
111-
str, Field(description='The CMake configuration preset to look for and override inside the given `preset_file`')
130+
str,
131+
Field(
132+
description='The CMake configuration preset to look for and override inside the given `preset_file`. '
133+
'Additional configurations will be added using this option as the base. For example, given "default", '
134+
'"default-release" will also be written'
135+
),
112136
] = 'default'

0 commit comments

Comments
 (0)