mirror of
https://github.com/boostorg/build.git
synced 2026-02-16 13:22:11 +00:00
Optimization:
* build/toolset.jam Setting variables on targets includes two parts: deciding what flags are applicable and applying the flags. The first part requires checking property sets and is pretty slow. It's optimised by cacheing. [SVN r26543]
This commit is contained in:
@@ -199,30 +199,27 @@ rule handle-flag-value ( value * : properties * )
|
||||
return $(result) ;
|
||||
}
|
||||
|
||||
|
||||
rule set-target-variables ( rule-or-module targets + : property-set )
|
||||
{
|
||||
# Given a rule name and a property set, returns a list of interleaved
|
||||
# variables names and values which must be set on targets for that
|
||||
# rule/property-set combination.
|
||||
rule set-target-variables-aux ( rule-or-module : property-set )
|
||||
{
|
||||
local result ;
|
||||
properties = [ $(property-set).raw ] ;
|
||||
for local f in $(.$(rule-or-module).flags)
|
||||
{
|
||||
local variable = $(.$(rule-or-module).variable.$(f)) ;
|
||||
local condition = $(.$(rule-or-module).condition.$(f)) ;
|
||||
local values = $(.$(rule-or-module).values.$(f)) ;
|
||||
local result ;
|
||||
|
||||
|
||||
if ! $(condition) ||
|
||||
[ find-property-subset $(condition) : $(properties) ]
|
||||
{
|
||||
result += [ handle-flag-value $(values) : $(properties) ] ;
|
||||
}
|
||||
|
||||
# Without this test, the assignment below would create a
|
||||
# target variable even if $(result) is empty. That is
|
||||
# undesirable because the empty target variable would mask
|
||||
# module globals intended to be used as defaults.
|
||||
if $(result)-is-nonempty
|
||||
{
|
||||
$(variable) on $(targets) += $(result) ;
|
||||
for local v in $(values)
|
||||
{
|
||||
result += $(variable) $(v) ;
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
@@ -230,8 +227,52 @@ rule set-target-variables ( rule-or-module targets + : property-set )
|
||||
local next = [ MATCH ^(.+)\\.([^\\.])* : $(rule-or-module) ] ;
|
||||
if $(next)
|
||||
{
|
||||
set-target-variables $(next) $(targets) : $(property-set) ;
|
||||
}
|
||||
result += [
|
||||
set-target-variables-aux $(next[1]) : $(property-set) ] ;
|
||||
}
|
||||
return $(result) ;
|
||||
}
|
||||
|
||||
|
||||
rule set-target-variables ( rule-or-module targets + : property-set )
|
||||
{
|
||||
properties = [ $(property-set).raw ] ;
|
||||
local key = $(rule-or-module).$(property-set) ;
|
||||
local settings = $(.stv.$(key)) ;
|
||||
if ! $(settings)
|
||||
{
|
||||
settings = [
|
||||
set-target-variables-aux $(rule-or-module) : $(property-set) ] ;
|
||||
|
||||
if ! $(settings)
|
||||
{
|
||||
settings = none ;
|
||||
}
|
||||
.stv.$(key) = $(settings) ;
|
||||
}
|
||||
|
||||
if $(settings) != none
|
||||
{
|
||||
while $(settings)
|
||||
{
|
||||
# Here, $(settings[1]) is the name of variable to assign
|
||||
# and $(settings[2]) is the value.
|
||||
|
||||
# The value might be <feature-name> so needs special
|
||||
# treatment.
|
||||
local value = [
|
||||
handle-flag-value $(settings[2]) : $(properties) ] ;
|
||||
# Without this test, the assignment below would create a
|
||||
# target variable even if $(result) is empty. That is
|
||||
# undesirable because the empty target variable would mask
|
||||
# module globals intended to be used as defaults.
|
||||
if $(value)-is-nonempty
|
||||
{
|
||||
$(settings[1]) on $(targets) += $(value) ;
|
||||
}
|
||||
settings = $(settings[3-]) ;
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
.toolsets += $(toolset) ;
|
||||
|
||||
Reference in New Issue
Block a user