Skip to content

Commit 5ab3806

Browse files
committed
Improve configuration-related documentation
- Separate configuration selection and description merging into separate documents and formalize "appendix" as the preferred term for supplemental, non-configuration-specific files. (This has been in use in other contexts, including CMake's implementation, but previously the specification itself did not provide a specific term for these.) This should also help the description merging documentation to be more discoverable, since, while configuration-specific files are one of the things that need merging, merging is not a sub-topic of configuration selection. - Clarify what contents are allowed in an appendix. (This information was previously missing.) Clarify meaning of `default_license` when used in an appendix. - Specify that configurations shall be treated as case insensitive. - Improve explanation of configurations and add much more extensive recommendations on how configurations should be used. - Fix minor error in multi-axis configuration example.
1 parent c03579a commit 5ab3806

8 files changed

Lines changed: 262 additions & 82 deletions

File tree

configurations.rst

Lines changed: 27 additions & 69 deletions
Original file line numberDiff line numberDiff line change
@@ -1,22 +1,42 @@
11
Package Configurations
22
======================
33

4-
Configurations provide a mechanism
5-
for a package to provide multiple configurations
6-
from a single distribution.
7-
Such configurations might include
8-
separate debug and release libraries,
9-
builds with and without thread safety,
10-
and so forth.
4+
Configurations allow packages to provide
5+
multiple "flavors" of binary objects
6+
in a single distribution,
7+
which have been compiled using different options
8+
to facilitate different use cases.
9+
Nominally, such objects must be *type-homogeneous*,
10+
meaning all configurations of a component
11+
must be of the same `type`_.
12+
(See `Multi-Axis Configurations`_
13+
for a way to work around this restriction;
14+
however, be aware of the caveats described therein.)
15+
16+
Typical configuration axes include
17+
presence or omission of instrumentation code,
18+
optimization level,
19+
and selection of interchangeable implementations.
1120
The possible configurations
1221
are determined by each individual package,
1322
and it is left to the consumer and build system
1423
to decide when and how to select a non-default configuration.
24+
Refer to `Configuration Use Cases`_ for guidance
25+
on what should or should not be expressed as a configuration.
26+
27+
Like appendices, configurations support partial installation.
28+
This allows a package to be built in several configurations,
29+
while permitting users to install only one desired configuration.
30+
Refer to `Description Merging`_ for additional information.
31+
32+
Configuration Selection
33+
'''''''''''''''''''''''
1534

1635
When a consumer consumes a component,
1736
the build system must determine the attribute values for that component
1837
by selecting which configuration of the component to use
1938
(if the component has multiple configurations).
39+
Selection shall treat configuration names as case insensitive.
2040
It is recommended that build systems select a configuration as follows:
2141

2242
- For each package, the consumer shall have a mechanism
@@ -60,68 +80,6 @@ otherwise, a value of :keyword:`null`
6080
shall be treated as the attribute being unset
6181
(and shall suppress falling back to the non-configuration-specific value).
6282

63-
Configuration Merging
64-
'''''''''''''''''''''
65-
66-
Some build systems may desire to output
67-
separate specifications per configuration,
68-
and/or to output separate CPS files per component.
69-
This is especially useful to permit piecemeal installation
70-
of individual components and/or configurations
71-
(for example, a "base" package
72-
with release libraries and common components,
73-
an optional package with debug libraries,
74-
and another optional package with optional components).
75-
76-
When a tool locates a CPS file, :var:`name`\ :path:`.cps`,
77-
the tool shall look in the same directory for any files
78-
which match any of the patterns
79-
(the asterisk (``*``) represents file globbing):
80-
81-
- :var:`name`\ :path:`:`\ :glob:`*`\ :path:`.cps`
82-
83-
- :var:`name`\ :path:`-`\ :glob:`*`\ :path:`.cps`
84-
85-
- :var:`name`\ :path:`@`\ :glob:`*`\ :path:`.cps`
86-
87-
- :var:`name`\ :path:`:`\ :glob:`*`\ :path:`@`\ :glob:`*`\ :path:`.cps`
88-
89-
- :var:`name`\ :path:`-`\ :glob:`*`\ :path:`@`\ :glob:`*`\ :path:`.cps`
90-
91-
Patterns containing colon (``:``) shall be skipped
92-
on platforms for which that character
93-
is not permitted in file names (e.g. Windows).
94-
95-
If any such package specifications are found,
96-
they shall be loaded at the same time,
97-
and their contents appended to the information loaded from the base CPS.
98-
(Note, however, that tools are permitted
99-
to ignore the information in any such supplemental CPS file
100-
as they may determine is not relevant to the user's needs.
101-
In particular, see `Transitive Dependencies`_.)
102-
103-
A ``.cps`` file whose name contains ``@``
104-
is a configuration-specific CPS.
105-
The structure of a configuration-specific CPS
106-
is the same as a common CPS, with three exceptions:
107-
108-
- The only defined :object:`package` keys are
109-
`name`_, `configuration`_, and `components <components\ (package)>`_.
110-
The first two are required.
111-
Use of other attributes specified in the schema is ill-formed.
112-
113-
- The per-configuration specification may not specify
114-
any :object:`component` attributes (e.g. :attribute:`type`).
115-
Only :object:`configuration` attributes are allowed.
116-
117-
- An attribute on a :object:`component`
118-
is considered to belong instead
119-
to the component-configuration
120-
identified by the configuration-specific CPS.
121-
122-
The order in which the data from multiple CPS files is appended
123-
is implementation-defined.
124-
12583
.. ... .. ... .. ... .. ... .. ... .. ... .. ... .. ... .. ... .. ... .. ... ..
12684
12785
.. kate: hl reStructuredText

index.rst

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -57,6 +57,7 @@ Core Specification
5757
components
5858
configurations
5959
searching
60+
merging
6061

6162
Appendices
6263
''''''''''

merging.rst

Lines changed: 88 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,88 @@
1+
Description Merging
2+
===================
3+
4+
Some build systems may desire to output
5+
separate specifications per configuration,
6+
and/or to break a package's components into multiple output files,
7+
often according to functional groups.
8+
This is especially useful to permit piecemeal installation
9+
of components and/or configurations
10+
(for example, a "base" package
11+
with release libraries and common components,
12+
an optional package with debug libraries,
13+
and another optional package with optional components).
14+
This also allows build tools to import only those components
15+
which are actually required by a consumer.
16+
17+
When a tool locates a CPS file, :var:`name`\ :path:`.cps`,
18+
the tool shall look in the same directory for any files
19+
which match any of the patterns
20+
(the asterisk (``*``) represents file globbing):
21+
22+
- :var:`name`\ :path:`:`\ :glob:`*`\ :path:`.cps`
23+
24+
- :var:`name`\ :path:`-`\ :glob:`*`\ :path:`.cps`
25+
26+
- :var:`name`\ :path:`@`\ :glob:`*`\ :path:`.cps`
27+
28+
- :var:`name`\ :path:`:`\ :glob:`*`\ :path:`@`\ :glob:`*`\ :path:`.cps`
29+
30+
- :var:`name`\ :path:`-`\ :glob:`*`\ :path:`@`\ :glob:`*`\ :path:`.cps`
31+
32+
.. note::
33+
34+
Patterns containing colon (``:``) shall be skipped
35+
on platforms for which that character
36+
is not permitted in file names (e.g. Windows).
37+
38+
If any such package specifications are found,
39+
they shall be loaded at the same time,
40+
and their contents appended to the information loaded from the base CPS.
41+
However, tools are permitted and encouraged
42+
to ignore the information in any such supplemental CPS files
43+
as they may determine is not relevant to the user's needs.
44+
In particular, see `Transitive Dependencies`_.)
45+
46+
A ``.cps`` file whose name contains ``@``
47+
is a configuration-specific CPS.
48+
The structure of a configuration-specific CPS
49+
is the same as a base CPS, with three exceptions:
50+
51+
- The only defined :object:`package` keys are
52+
`name`_, `cps_version`_, `configuration`_,
53+
and `components <components\ (package)>`_.
54+
The first three are required.
55+
Use of other attributes specified in the schema is ill-formed.
56+
57+
- The per-configuration specification may not specify
58+
any :object:`component` attributes (e.g. :attribute:`type`).
59+
Only :object:`configuration` attributes are allowed.
60+
61+
- An attribute on a :object:`component`
62+
is considered to belong instead
63+
to the component-configuration
64+
identified by the configuration-specific CPS.
65+
66+
A ``.cps`` file which supplements the components
67+
of the package's base CPS
68+
is known as an "appendix".
69+
The structure of a CPS appendix
70+
is the same as a base CPS, with two exceptions:
71+
72+
- The only defined :object:`package` keys are
73+
`name`_, `requires <requires\ (package)>`_, `default_license`_
74+
and `components <components\ (package)>`_.
75+
The first is required.
76+
Use of other attributes specified in the schema is ill-formed.
77+
78+
- An appendix may not specify components
79+
which are described in the base CPS
80+
or in any other appendix.
81+
82+
The order in which the data from multiple CPS files is collated
83+
is implementation-defined.
84+
Behavior when a supplemental CPS file's `cps_version`_
85+
differs from the base CPS's version
86+
is implementation-defined.
87+
(However, for obvious reasons,
88+
this is strongly discouraged.)

overview.rst

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -75,7 +75,7 @@ Advantages of CPS
7575

7676
CPS allows a package to provide targets in multiple configurations,
7777
with no restriction on the naming of configurations.
78-
Use of interface targets (see `Configurations as Flags`_)
78+
Use of interface targets (see `Multi-Axis Configurations`_)
7979
allows consumers to select the appropriate configuration
8080
by specifying target points along multiple axes.
8181
This especially facilitates creation and use of packages

0 commit comments

Comments
 (0)