From beb53b6b9574f95309384bfc5afffb40d467bc04 Mon Sep 17 00:00:00 2001 From: Vladimir Prus Date: Sat, 4 Apr 2015 20:02:43 +0300 Subject: 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. --- boostcpp.jam | 110 +++++++++++++++++++++++++++++++++++++---------------------- 1 file changed, 70 insertions(+), 40 deletions(-) (limited to 'boostcpp.jam') diff --git a/boostcpp.jam b/boostcpp.jam index 9c2e28d30b..a964caf417 100644 --- a/boostcpp.jam +++ b/boostcpp.jam @@ -22,6 +22,7 @@ import project ; import regex ; import set ; import targets ; +import feature ; import property ; ############################################################################## @@ -554,24 +555,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 : $(properties) ] ; + local toolset-version-property = "" ; + return [ property.select $(toolset-version-property) : $(properties) ] ; +} + +feature.feature deduced-address-model : 32 64 : propagated optional composite hidden ; +feature.compose 32 : 32 ; +feature.compose 64 : 64 ; + rule deduce-address-model ( properties * ) { - local result = [ property.select : $(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 32 ; - } - else if [ configure.builds /boost/architecture//64 : $(properties) : 64-bit ] - { - return 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 = $(result) [ property.select : $(properties) ] ; + } + return $(result) ; } rule address-model ( ) @@ -579,40 +601,48 @@ rule address-model ( ) return @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 $(a) : $(a) ; +} + rule deduce-architecture ( properties * ) { - local result = [ property.select : $(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 arm ; - } - else if [ configure.builds /boost/architecture//mips1 : $(properties) : mips1 ] - { - return mips1 ; - } - else if [ configure.builds /boost/architecture//power : $(properties) : power ] - { - return power ; - } - else if [ configure.builds /boost/architecture//sparc : $(properties) : sparc ] - { - return sparc ; - } - else if [ configure.builds /boost/architecture//x86 : $(properties) : x86 ] - { - return x86 ; - } - else if [ configure.builds /boost/architecture//combined : $(properties) : combined ] - { - return 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 = $(result) [ property.select : $(properties) ] ; + } + return $(result) ; } rule architecture ( ) -- cgit v1.2.1