summaryrefslogtreecommitdiff
path: root/boostcpp.jam
diff options
context:
space:
mode:
authorVladimir Prus <vladimir@codesourcery.com>2015-04-04 20:02:43 +0300
committerVladimir Prus <vladimir@codesourcery.com>2015-04-04 20:14:51 +0300
commit945e3c0bbdd31ce8c297e0aff5340f0adb196cea (patch)
tree930539cc981a88ebf4ead3c3b86ebc202b9b6ab8 /boostcpp.jam
parentd96a696ae8348007e2a1b005f6917e4cbb601dc6 (diff)
downloadboost-945e3c0bbdd31ce8c297e0aff5340f0adb196cea.tar.gz
Suppress deduced properties in the target paths.
Since recently, boostcpp.jam and Jamroot detect default address-model and architecture of the compiler, so that every library can modify its behaviour accordingly. However, these properties also become part of target paths, if they are different from global default value. What we conceptually want is to introduce 'toolset instance', which is toolset name and the exact compiler command, and determine default address model of that. Then, we want to show address model in the target path only if it's different from toolset-instance's default. It would happen automatically if toolset-instance were a feature. But we don't have it now - we don't allocate any ids for each 'using', and changing that scheme is not trivial. So, this patch introduces a new feature, deduced-address-model, which is hidden (never present in target path) and composite, expanding to same value of address-model. As result, it suppresses address-model from the command-line, but only if it's equal to deduced value.
Diffstat (limited to 'boostcpp.jam')
-rw-r--r--boostcpp.jam110
1 files changed, 70 insertions, 40 deletions
diff --git a/boostcpp.jam b/boostcpp.jam
index e2d04cc188..f45d12ef2f 100644
--- a/boostcpp.jam
+++ b/boostcpp.jam
@@ -22,6 +22,7 @@ import project ;
import regex ;
import set ;
import targets ;
+import feature ;
import property ;
##############################################################################
@@ -595,24 +596,45 @@ rule declare-targets ( all-libraries * : headers * )
declare_top_level_targets $(libraries) : $(headers) ;
}
+# Returns the properties identifying the toolset. We'll use them
+# below to configure checks. These are essentially same as in
+# configure.builds, except we don't use address-model and
+# architecture - as we're trying to detect them here.
+#
+rule toolset-properties ( properties * )
+{
+ local toolset = [ property.select <toolset> : $(properties) ] ;
+ local toolset-version-property = "<toolset-$(toolset:G=):version>" ;
+ return [ property.select <target-os> <toolset> $(toolset-version-property) : $(properties) ] ;
+}
+
+feature.feature deduced-address-model : 32 64 : propagated optional composite hidden ;
+feature.compose <deduced-address-model>32 : <address-model>32 ;
+feature.compose <deduced-address-model>64 : <address-model>64 ;
+
rule deduce-address-model ( properties * )
{
- local result = [ property.select <address-model> : $(properties) ] ;
- if $(result)
+ local result ;
+ local filtered = [ toolset-properties $(properties) ] ;
+
+ if [ configure.builds /boost/architecture//32 : $(filtered) : 32-bit ]
{
- return $(result) ;
+ result = 32 ;
}
- else
+ else if [ configure.builds /boost/architecture//64 : $(filtered) : 64-bit ]
{
- if [ configure.builds /boost/architecture//32 : $(properties) : 32-bit ]
- {
- return <address-model>32 ;
- }
- else if [ configure.builds /boost/architecture//64 : $(properties) : 64-bit ]
- {
- return <address-model>64 ;
- }
+ result = 64 ;
}
+
+ if $(result)
+ {
+ # Normally, returning composite feature here is equivalent to forcing
+ # consituent properties as well. But we only want to indicate toolset
+ # deduced default, so also pick whatever address-model is explicitly
+ # specified, if any.
+ result = <deduced-address-model>$(result) [ property.select <address-model> : $(properties) ] ;
+ }
+ return $(result) ;
}
rule address-model ( )
@@ -620,40 +642,48 @@ rule address-model ( )
return <conditional>@boostcpp.deduce-address-model ;
}
+local deducable-architectures = arm mips1 power sparc x86 combined ;
+feature.feature deduced-architecture : $(deducable-architectures) : propagated optional composite hidden ;
+for a in $(deducable-architectures)
+{
+ feature.compose <deduced-architecture>$(a) : <architecture>$(a) ;
+}
+
rule deduce-architecture ( properties * )
{
- local result = [ property.select <architecture> : $(properties) ] ;
- if $(result)
+ local result ;
+ local filtered = [ toolset-properties $(properties) ] ;
+ if [ configure.builds /boost/architecture//arm : $(filtered) : arm ]
{
- return $(result) ;
+ result = arm ;
}
- else
+ else if [ configure.builds /boost/architecture//mips1 : $(filtered) : mips1 ]
{
- if [ configure.builds /boost/architecture//arm : $(properties) : arm ]
- {
- return <architecture>arm ;
- }
- else if [ configure.builds /boost/architecture//mips1 : $(properties) : mips1 ]
- {
- return <architecture>mips1 ;
- }
- else if [ configure.builds /boost/architecture//power : $(properties) : power ]
- {
- return <architecture>power ;
- }
- else if [ configure.builds /boost/architecture//sparc : $(properties) : sparc ]
- {
- return <architecture>sparc ;
- }
- else if [ configure.builds /boost/architecture//x86 : $(properties) : x86 ]
- {
- return <architecture>x86 ;
- }
- else if [ configure.builds /boost/architecture//combined : $(properties) : combined ]
- {
- return <architecture>combined ;
- }
+ result = mips1 ;
}
+ else if [ configure.builds /boost/architecture//power : $(filtered) : power ]
+ {
+ result = power ;
+ }
+ else if [ configure.builds /boost/architecture//sparc : $(filtered) : sparc ]
+ {
+ result = sparc ;
+ }
+ else if [ configure.builds /boost/architecture//x86 : $(filtered) : x86 ]
+ {
+ result = x86 ;
+ }
+ else if [ configure.builds /boost/architecture//combined : $(filtered) : combined ]
+ {
+ result = combined ;
+ }
+
+ if $(result)
+ {
+ # See comment in deduce-address-model.
+ result = <deduced-architecture>$(result) [ property.select <architecture> : $(properties) ] ;
+ }
+ return $(result) ;
}
rule architecture ( )