]> git.proxmox.com Git - ceph.git/blame - ceph/src/boost/tools/build/src/tools/features/variant-feature.jam
update source to Ceph Pacific 16.2.2
[ceph.git] / ceph / src / boost / tools / build / src / tools / features / variant-feature.jam
CommitLineData
b32b8144
FG
1# Copyright 2017 Rene Rivera
2# Distributed under the Boost Software License, Version 1.0.
3# (See accompanying file LICENSE_1_0.txt or copy at
4# http://www.boost.org/LICENSE_1_0.txt)
5
b32b8144
FG
6import feature ;
7import errors ;
8import property ;
9
f67539c2
TL
10#| tag::doc[]
11
12[[bbv2.builtin.features.variant]]`variant`::
13*Allowed values:* `debug`, `release`, `profile`.
14+
15A feature combining several low-level features, making it easy to
16request common build configurations.
17+
18The value `debug` expands to
19+
20----
21<optimization>off <debug-symbols>on <inlining>off <runtime-debugging>on
22----
23+
24The value `release` expands to
25+
26----
27<optimization>speed <debug-symbols>off <inlining>full <runtime-debugging>off
28----
29+
30The value `profile` expands to the same as `release`, plus:
31+
32----
33<profiling>on <debug-symbols>on
34----
35+
36Users can define their own build variants using the `variant` rule
37from the `common` module.
38+
39NOTE: Runtime debugging is on in debug builds to suit the expectations of
40people used to various IDEs.
41
42|# # end::doc[]
43
b32b8144
FG
44feature.feature variant
45 :
46 : implicit composite propagated symmetric ;
47
48# Declares a new variant.
49#
50# First determines explicit properties for this variant, by refining parents'
51# explicit properties with the passed explicit properties. The result is
52# remembered and will be used if this variant is used as parent.
53#
54# Second, determines the full property set for this variant by adding to the
55# explicit properties default values for all missing non-symmetric properties.
56#
57# Lastly, makes appropriate value of 'variant' property expand to the full
58# property set.
59#
60rule variant ( name # Name of the variant
61 : parents-or-properties * # Specifies parent variants, if
62 # 'explicit-properties' are given, and
63 # explicit-properties or parents otherwise.
64 : explicit-properties * # Explicit properties.
65 )
66{
67 local parents ;
68 if ! $(explicit-properties)
69 {
70 if $(parents-or-properties[1]:G)
71 {
72 explicit-properties = $(parents-or-properties) ;
73 }
74 else
75 {
76 parents = $(parents-or-properties) ;
77 }
78 }
79 else
80 {
81 parents = $(parents-or-properties) ;
82 }
83
84 # The problem is that we have to check for conflicts between base variants.
85 if $(parents[2])
86 {
87 errors.error "multiple base variants are not yet supported" ;
88 }
89
90 local inherited ;
91 # Add explicitly specified properties for parents.
92 for local p in $(parents)
93 {
94 # TODO: This check may be made stricter.
95 if ! [ feature.is-implicit-value $(p) ]
96 {
97 errors.error "Invalid base variant" $(p) ;
98 }
99
100 inherited += $(.explicit-properties.$(p)) ;
101 }
102 property.validate $(explicit-properties) ;
103 explicit-properties = [ property.refine $(inherited)
104 : $(explicit-properties) ] ;
105
106 # Record explicitly specified properties for this variant. We do this after
107 # inheriting parents' properties so they affect other variants derived from
108 # this one.
109 .explicit-properties.$(name) = $(explicit-properties) ;
110
111 feature.extend variant : $(name) ;
112 feature.compose <variant>$(name) : $(explicit-properties) ;
113}
114IMPORT $(__name__) : variant : : variant ;