mirror of
https://github.com/boostorg/build.git
synced 2026-02-14 00:32:11 +00:00
Allow customization of suffixes used for generated targets.
* new/property.jam
(property-map.find-replace): New method
(property-map.find): Implement of terms of the above.
* new/qt.jam: Don't set any suffix on UIC_H.
* new/type.jam
(change-generated-target-suffix): New rule.
(generated-target-suffix): Process base types if no
suffix is found.
[SVN r16986]
This commit is contained in:
1
qt.jam
1
qt.jam
@@ -33,7 +33,6 @@ rule init ( prefix ? )
|
||||
|
||||
type.register UI : ui ;
|
||||
type.register UIC_H : : H ;
|
||||
type.set-generated-target-suffix UIC_H : : h ;
|
||||
|
||||
generators.register-standard qt.uic-h : UI : UIC_H : <uses>qt ;
|
||||
|
||||
|
||||
@@ -369,6 +369,14 @@ rule property-map ( )
|
||||
# subset has value assigned to it, return the
|
||||
# value for the longest subset, if it's unique.
|
||||
rule find ( properties + )
|
||||
{
|
||||
return [ find-replace $(properties) ] ;
|
||||
}
|
||||
|
||||
# Find the value associated with 'properties'.
|
||||
# If 'value' parameter is given, replaces the found value
|
||||
# Returns the value that were stored originally.
|
||||
rule find-replace ( properties + : value ? )
|
||||
{
|
||||
# First find all matches
|
||||
local matches ;
|
||||
@@ -388,7 +396,12 @@ rule property-map ( )
|
||||
{
|
||||
errors.error "Ambiguous key" ;
|
||||
}
|
||||
return $(self.value.$(best)) ;
|
||||
local original = $(self.value.$(best)) ;
|
||||
if $(value)
|
||||
{
|
||||
self.value.$(best) = $(value) ;
|
||||
}
|
||||
return $(original) ;
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
@@ -53,7 +53,7 @@ rule register ( type : suffixes * : base-type ? : main ? )
|
||||
{
|
||||
# Generated targets of 'type' will use the first of 'suffixes'
|
||||
# (this may be overriden)
|
||||
$(.suffixes).insert <type>$(type) : $(suffixes[1]) ;
|
||||
$(.suffixes).insert <target-type>$(type) : $(suffixes[1]) ;
|
||||
# Specify mapping from suffixes to type
|
||||
register-suffixes $(suffixes) : $(type) ;
|
||||
}
|
||||
@@ -159,15 +159,31 @@ rule is-derived ( type base )
|
||||
# one.
|
||||
rule set-generated-target-suffix ( type : properties * : suffix )
|
||||
{
|
||||
$(.suffixes).insert <type>$(type) $(properties) : $(suffix) ;
|
||||
properties = <target-type>$(type) $(properties) ;
|
||||
$(.suffixes).insert $(properties) : $(suffix) ;
|
||||
}
|
||||
|
||||
# Change the suffix previously registered for this type/properties
|
||||
# combination.
|
||||
rule change-generated-target-suffix ( type : properties * : suffix )
|
||||
{
|
||||
properties = <target-type>$(type) $(properties) ;
|
||||
$(.suffixes).find-replace $(properties) : $(suffix) ;
|
||||
}
|
||||
|
||||
|
||||
# Returns suffix that should be used when generating target of 'type',
|
||||
# with the specified properties.
|
||||
# with the specified properties. If not suffix were specified for
|
||||
# 'type', returns suffix for base type, if any.
|
||||
rule generated-target-suffix ( type : properties * )
|
||||
{
|
||||
return [ $(.suffixes).find <type>$(type) $(properties) ] ;
|
||||
local result ;
|
||||
while $(type) && ! $(result)
|
||||
{
|
||||
result = [ $(.suffixes).find <target-type>$(type) $(properties) ] ;
|
||||
type = $(.bases.$(type)) ;
|
||||
}
|
||||
return $(result) ;
|
||||
}
|
||||
|
||||
# Returns file type given its suffix. The 'suffix' parameter should include
|
||||
|
||||
Reference in New Issue
Block a user