📄 boost-base.jam
字号:
return $(grist1) $(grist2) $(grist3)$(ungrist3) ;
}
else if $(grist2)
{
return <*> $(grist1) $(grist2)$(ungrist2) ;
}
else
{
return <*> <*> $(<) ;
}
}
rule unique # list
{
local result = ;
local f ;
for f in $(<)
{
if ! $(f) in $(result)
{
result += $(f) ;
}
}
return $(result) ;
}
# get-properties features : properties
#
# Given a list of gristed features and a list of properties, returns the
# properties matching the given features.
rule get-properties
{
local result = ;
local property ;
for property in $(>)
{
if $(property:G) in $(<)
{
result += $(property) ;
}
}
return $(result) ;
}
# get-values features : properties
#
# Given a list of gristed feature names and a list of properties, returns the
# value(s) of the given features.
rule get-values
{
local _properties = [ get-properties $(<) : $(>) ] ;
return $(_properties:G=) ;
}
rule replace-properties ( property-set * : new-properties * )
{
local result = ;
for local x in $(property-set)
{
if $(x:G) in $(new-properties:G)
{
if ! $(x:G) in $(result:G)
{
result += [ get-properties $(x:G) : $(new-properties) ] ;
}
}
else
{
result += $(x) ;
}
}
return $(result) ;
}
# normalize-properties properties
#
# Normalizes a set of (possibly qualified) properties by prepending <*> as many
# times as neccessary to ensure that each property has at least 3 gristed elements.
rule normalize-properties
{
local property ;
local result ;
for property in $(<)
{
switch $(property)
{
case <*><*><tag>* : result += $(property) ;
case <*><tag>* : result += <*>$(property) ;
case <tag>* : result += <*><*>$(property) ;
case <*><*><*><default>* : result += $(property) ;
case <*><*><default><*>* : result += <*>$(property) ;
case <*><*><default>* : result += $(property) ;
case <*><default><*>* : result += <*><*>$(property) ;
case <*><default>* : result += <*>$(property) ;
case <default><*>* : result += <*><*><*>$(property) ;
case <default>* : result += <*><*>$(property) ;
case <*><*><*><*@*>* : result += $(property) ;
case <*><*><*@*>* : result += <*>$(property) ;
case <*><*@*>* : result += <*><*>$(property) ;
case <*@*>* : result += <*><*><*>$(property) ;
case <*><*><*>* : result += $(property) ;
case <*><*>* : result += <*>$(property) ;
case <*>* : result += <*><*>$(property) ;
case * : result += <*><*><*>$(property) ;
}
}
return $(result) ;
}
# intersection set1 : set2
#
# Removes from set1 any items which don't appear in set2 and returns the result.
rule intersection
{
local result v ;
for v in $(<)
{
if $(v) in $(>)
{
result += $(v) ;
}
}
return $(result) ;
}
# subset sub : super
#
# Returns true iff sub is a subset of super, empty otherwise
rule is-subset
{
if [ intersection $(<) : $(>) ] = $(<)
{
return true ;
}
}
# distribute-feature <feature>value1[/value2...]
#
# Distribute the given feature across the slash-separated set of values, i.e.
# returns <feature>value1[ <feature>/value2...]
rule distribute-feature
{
local g = $(<:G) ;
local result = [ split-path $(<:G=) ] ;
return $(g)$(result) ;
}
# set-insert variable-name : value... ;
#
# Appends the given values to the list designated by variable-name if they are
# not already present.
rule set-insert
{
local v ;
for v in $(>)
{
if ! ( $(v) in $($(<)) )
{
$(<) += $(v) ;
}
}
}
# equal-sets set1 : set2
#
# Returns true iff set1 contains the same elements as set2.
# Not sensitive to the same element appearing multiple times
rule equal-sets
{
if ( ! [ difference $(<) : $(>) ] ) && ( ! [ difference $(>) : $(<) ] )
{
return true ;
}
}
# feature name : [values...]
#
# Declares a feature with the given name, and the given allowed values.
rule feature
{
if $(<) in $(gFEATURES)
{
EXIT feature $(<) : $(gFEATURE_VALUES(<$(<)>) redeclared as $(<) : $(>) ;
}
gFEATURES += <$(<)> ;
gUNGRISTED(<$(<)>) = $(<) ;
gFEATURE_VALUES(<$(<)>) = $(>) ;
}
rule free-feature
{
feature $(<) : $(>) ;
gFREE_FEATURES += <$(<)> ;
if $(>)
{
gSINGLE_VALUED_FREE_FEATURES += <$(<)> ;
}
}
rule path-feature
{
free-feature $(<) : $(>) ;
gPATH_FEATURES += <$(<)> ;
}
rule dependency-feature
{
path-feature $(<) : $(>) ;
gDEPENDENCY_FEATURES += <$(<)> ;
}
# feature-default <feature>...
#
# return the default properties corresponding to the given feature(s)
rule feature-default
{
local result f ;
for f in $(<)
{
result += $(f)$(gFEATURE_VALUES($(f))[1]) ;
}
return $(result) ;
}
# flags tools-name variable-name condition [: value(s)]
#
# Declare command-line settings for a given toolset.
# toolset: the name of the toolset
# variable-name: the name of a global variable which can be used to carry
# information to a command-line
# condition: One of the following:
# 1. zero or more property-sets of the form:
# <feature>value[/<feature>value...]
# 2. one or more <feature>[/<feature>...]
#
# This rule appends to the specified variable, depending on a target's build
# configuration and the form of condition.
#
# 1. if any specified property-set is a subset of the target's build properties or if
# condition is empty, the values specified in $(3) will be appended once to
# /variable-name/.
#
# 2. The value of each specified feature that participates in the target's
# build properaties is appended to /variable-name/.
#
# The variable will be set "on" the target so it may be used in its build actions.
rule flags
{
local toolset = $(gCURRENT_TOOLSET) ;
local variable = $(<[2]) ;
local condition = $(<[3-]) ;
# record the names of all variables used so they can be set on targets
if ! ( $(variable) in $(gTARGET_VARIABLES) )
{
gTARGET_VARIABLES += $(variable) ;
$(variable) = ;
}
local found = ;
local x ;
for x in $(condition)
{
x = [ split-path $(x) ] ;
# Add each feature to the set of features relevant to the toolset
gRELEVANT_FEATURES($(toolset)) += $(x:G) ;
# is it a property set?
if $(x:G=)
{
# if this property_set is a subset of the current build-properties
if ( ! $(found) ) && [ is-subset $(x) : $(gBUILD_PROPERTIES) ]
{
found = true ;
$(variable) += $(>) ;
}
}
else
{
$(variable) += [ get-values $(x) : $(gBUILD_PROPERTIES) ] ;
if $(x:G) in $(gDEPENDENCY_FEATURES)
{
gDEPENDENCY_VARIABLES($(toolset)) += $(variable) ;
}
}
}
if ! $(condition)
{
$(variable) += $(>) ;
}
}
# include-tools toolset
#
# Unconditionally process the specification file for the given toolset. It is
# neccessary to do this for each target built with that toolset, since the
# toolset will invoke the flags rule to set global variables based on the build
# properties of the target.
rule include-tools
{
if ! $(gIN_INCLUDE_TOOLS)
{
gCURRENT_TOOLSET = $(<) ;
gRELEVANT_FEATURES($(<)) = ; # clear relevant feature set
gDEPENDENCY_VARIABLES($(<)) = ;
# clear any lingering target variables that may have been declared
$(gTARGET_VARIABLES) = ;
gTARGET_VARIABLES = NEEDLIBS NEEDIMPS ; # start over from the beginning
gTOOLSET_LIB_PATH = ;
}
{
local gIN_INCLUDE_TOOLS = true ;
SEARCH on <jam-module>$(<)-tools.jam = $(BOOST_BUILD_PATH) ;
include <jam-module>$(<)-tools.jam ;
}
# Always maintain the list of relevant features as unique
if ! $(gIN_INCLUDE_TOOLS)
{
gRELEVANT_FEATURES($(<)) = [
unique $(gRELEVANT_FEATURES($(<)))
$(gALWAYS_RELEVANT)
] ;
}
gINCLUDED(<jam-module>$(<)-tools.jam) = TRUE ;
}
# extends-toolset toolset
#
# Used in a toolset definition file; Declares that the toolset currently being
# defined is an extension of the given toolset.
rule extends-toolset
{
include-tools $(<) ;
}
# relevant-features toolset
#
# Returns the set of unique features relevant to the given toolset; includes the
# toolset description file as a side-effect if neccessary.
rule relevant-features # name
{
if ! $(gRELEVANT_FEATURES($(<)))
{
include-tools $(<) ;
}
return $(gRELEVANT_FEATURES($(<))) ;
}
# variant name [ : parents... ] : [<toolset>]<feature>value...
#
# Declare a build variant, whose configuration is given by the given (optionally
# toolset-qualified) properties.
rule variant ( name : parents-or-properties * : tool-properties * )
{
gALL_VARIANTS += $(name) ;
local parents ;
if ! $(tool-properties)
{
if $(parents-or-properties[1]:G)
{
tool-properties = $(parents-or-properties) ;
}
else
{
parents = $(parents-or-properties) ;
}
}
else
{
parents = $(parents-or-properties) ;
}
local toolset ;
for toolset in $(TOOLS)
{
# We hijack select-properties to do our dirty work here.
# Because properties in a variant declaration are only qualified with
# toolset and not variant, we specify the toolset where
# select-properties expects a variant name. The first toolset parameter
# is neccessary to get the relevant-features correctly set. We supply
# the variant name as the target name, so that error messages will look
# coherent.
local name-properties
= [ select-properties $(toolset) $(toolset) $(name) : $(tool-properties) ] ;
if $(parents)
{
local parent ;
for parent in $(parents)
{
local parent-properties
= $(gBASE_PROPERTIES($(toolset),$(parent))) ;
local inherited-features
= [ unique
[ difference $(parent-properties:G) : $(name-properties:G) ]
$(gFREE_FEATURES)
$(gPATH_FEATURES)
$(gDEPENDENCY_FEATURES ] ;
⌨️ 快捷键说明
复制代码
Ctrl + C
搜索代码
Ctrl + F
全屏模式
F11
切换主题
Ctrl + Shift + D
显示快捷键
?
增大字号
Ctrl + =
减小字号
Ctrl + -