2
0
mirror of https://github.com/boostorg/build.git synced 2026-02-15 00:52:16 +00:00

Skip targets that can't be generated like BBv1 does.

[SVN r34806]
This commit is contained in:
Rene Rivera
2006-08-02 18:26:30 +00:00
parent ee8b2ded17
commit 008c8b1643
3 changed files with 108 additions and 72 deletions

View File

@@ -1,7 +1,9 @@
# Copyright (C) Vladimir Prus 2002. Permission to copy, use, modify, sell and
# distribute this software is granted provided this copyright notice appears in
# all copies. This software is provided "as is" without express or implied
# warranty, and with no claim as to its suitability for any purpose.
# Copyright Vladimir Prus 2002.
# Copyright Rene Rivera 2006.
#
# Distributed under the Boost Software License, Version 1.0.
# (See accompanying file LICENSE_1_0.txt or copy at
# http://www.boost.org/LICENSE_1_0.txt)
# Manages 'generators' --- objects which can do transformation between different
# target types and contain algorithm for finding transformation from sources
@@ -219,6 +221,13 @@ class generator
return ;
}
}
# Indicates if this generator can handle building the given target
# combination.
rule can-build ( target-type : property-set : sources * )
{
return true ;
}
# Returns another generator which differers from $(self) in
# - id
@@ -928,7 +937,7 @@ local rule ensure-type ( targets * )
#
# Note: this algorithm explicitly ignores generators for base classes if there's
# at least one generator for requested target-type.
local rule find-viable-generators-aux ( target-type : property-set )
local rule find-viable-generators-aux ( target-type : property-set : sources * )
{
# Select generators that can create the required target type.
local viable-generators = ;
@@ -981,25 +990,28 @@ local rule find-viable-generators-aux ( target-type : property-set )
for local g in $(generators)
{
generators.dout [ indent ] "trying generator" [ $(g).id ] "(" [ $(g).source-types ] -> [ $(g).target-types ] ")" ;
local m = [ $(g).match-rank $(property-set) ] ;
if $(m)
if [ $(g).can-build $(target-type) : $(property-set) : $(sources) ]
{
generators.dout [ indent ] " is viable" ;
viable-generators += $(g) ;
}
local m = [ $(g).match-rank $(property-set) ] ;
if $(m)
{
generators.dout [ indent ] " is viable" ;
viable-generators += $(g) ;
}
}
}
return $(viable-generators) ;
}
rule find-viable-generators ( target-type : property-set )
rule find-viable-generators ( target-type : property-set : sources * )
{
local key = $(target-type).$(property-set) ;
local l = $(.fv.$(key)) ;
if ! $(l)
{
l = [ find-viable-generators-aux $(target-type) : $(property-set) ] ;
l = [ find-viable-generators-aux $(target-type) : $(property-set) : $(sources) ] ;
if ! $(l)
{
l = none ;
@@ -1059,7 +1071,7 @@ rule find-viable-generators ( target-type : property-set )
local rule construct-really (
project name ? : target-type : property-set : sources * )
{
viable-generators = [ find-viable-generators $(target-type) : $(property-set) ] ;
viable-generators = [ find-viable-generators $(target-type) : $(property-set) : $(sources) ] ;
generators.dout [ indent ] "*** " [ sequence.length $(viable-generators) ]
" viable generators" ;

View File

@@ -1,7 +1,9 @@
# Copyright (C) Vladimir Prus 2002. Permission to copy, use, modify, sell and
# distribute this software is granted provided this copyright notice appears in
# all copies. This software is provided "as is" without express or implied
# warranty, and with no claim as to its suitability for any purpose.
# Copyright Vladimir Prus 2002.
# Copyright Rene Rivera 2006.
#
# Distributed under the Boost Software License, Version 1.0.
# (See accompanying file LICENSE_1_0.txt or copy at
# http://www.boost.org/LICENSE_1_0.txt)
# Supports 'abstract' targets, which are targets explicitly defined in Jamfile.
@@ -733,8 +735,11 @@ class main-target : abstract-target
for local p in $(all-property-sets)
{
local r = [ generate-really $(p) ] ;
usage-requirements = [ $(usage-requirements).add $(r[1]) ] ;
result += $(r[2-]) ;
if $(r)
{
usage-requirements = [ $(usage-requirements).add $(r[1]) ] ;
result += $(r[2-]) ;
}
}
end-building $(__name__) ;
return $(usage-requirements) [ sequence.unique $(result) ] ;
@@ -1184,28 +1189,30 @@ class basic-target : abstract-target
[ construct $(self.name) :
$(source-targets) : $(rproperties) ] ;
local gur = $(result[1]) ;
result = $(result[2-]) ;
local s = [ create-subvariant
$(result) :
[ virtual-target.recent-targets ]
: $(property-set) : $(source-targets)
: $(rproperties) : $(usage-requirements) ] ;
virtual-target.clear-recent-targets ;
local ur = [ compute-usage-requirements $(s) ] ;
ur = [ $(ur).add $(gur) ] ;
$(s).set-usage-requirements $(ur) ;
if [ modules.peek : .debug-building ]
if $(result)
{
ECHO [ targets.indent ]
"Usage requirements from $(self.name) are "
[ $(ur).raw ] ;
local gur = $(result[1]) ;
result = $(result[2-]) ;
local s = [ create-subvariant
$(result) :
[ virtual-target.recent-targets ]
: $(property-set) : $(source-targets)
: $(rproperties) : $(usage-requirements) ] ;
virtual-target.clear-recent-targets ;
local ur = [ compute-usage-requirements $(s) ] ;
ur = [ $(ur).add $(gur) ] ;
$(s).set-usage-requirements $(ur) ;
if [ modules.peek : .debug-building ]
{
ECHO [ targets.indent ]
"Usage requirements from $(self.name) are "
[ $(ur).raw ] ;
}
self.generated.$(property-set) = $(ur) $(result) ;
}
self.generated.$(property-set) = $(ur) $(result) ;
}
else
{
@@ -1339,20 +1346,19 @@ class typed-target : basic-target
: $(source-targets) ] ;
if ! $(r)
{
ECHO "error: unable to construct " [ full-name ] ;
ECHO "warn: Unable to construct" [ full-name ] ;
# Are there any top-level generators for this type/property set.
if ! [ generators.find-viable-generators
$(self.type) : $(property-set) ]
$(self.type) : $(property-set) : $(source-targets) ]
{
ECHO "error: no generators were found for type '$(self.type)'" ;
ECHO "error: and the requested properties" ;
ECHO "error: make sure you've configured the needed tools" ;
ECHO "See http://boost.org/boost-build2/doc/html/bbv2/advanced/configuration.html" ;
ECHO "To debug this problem, try the --debug-generators option." ;
}
ECHO "To debug this problem, try the --debug-generators option." ;
EXIT ;
}
return $(r) ;

View File

@@ -1,10 +1,10 @@
# Copyright (c) 2001 David Abrahams.
# Copyright (c) 2002-2003 Rene Rivera.
# Copyright (c) 2002-2003 Vladimir Prus.
# Copyright 2001 David Abrahams.
# Copyright 2002-2006 Rene Rivera.
# Copyright 2002-2003 Vladimir Prus.
#
# Use, modification and distribution is subject to the Boost Software
# License Version 1.0. (See accompanying file LICENSE_1_0.txt or
# http://www.boost.org/LICENSE_1_0.txt)
# Distributed under the Boost Software License, Version 1.0.
# (See accompanying file LICENSE_1_0.txt or copy at
# http://www.boost.org/LICENSE_1_0.txt)
import toolset : flags ;
import property ;
@@ -254,36 +254,54 @@ actions compile.asm
# since it's not supported by gcc/libc.
class gcc-linking-generator : unix-linking-generator
{
rule generated-targets ( sources + : property-set : project name ? )
rule can-build ( target-type : property-set : sources * )
{
if <runtime-link>static in [ $(property-set).raw ]
local no-static-link = ;
if [ modules.peek : UNIX ]
{
local m ;
if [ id ] = "gcc.link.dll"
switch [ modules.peek : JAMUNAME ]
{
case * : no-static-link = true ;
}
}
local properties = [ $(property-set).raw ] ;
local reason ;
if $(no-static-link) && <runtime-link>static in $(properties)
{
if <link>shared in $(properties)
{
reason =
"On gcc, DLL can't be build with '<runtime-link>static'." ;
}
else if [ type.is-derived $(target-type) EXE ]
{
m = "on gcc, DLL can't be build with <runtime-link>static" ;
}
if ! $(m) {
for local s in $(sources)
{
local type = [ $(s).type ] ;
if $(type) && [ type.is-derived $(type) SHARED_LIB ]
if $(type) && [ type.is-derived $(type) SHARED_LIB ]
{
m = "on gcc, using DLLS together with the <runtime-link>static options is not possible " ;
}
}
reason =
"On gcc, using DLLS together with the"
"<runtime-link>static options is not possible " ;
}
}
}
if $(m)
{
errors.user-error $(m) :
"it's suggested to use <runtime-link>static together with the <link>static" ;
}
}
return [ unix-linking-generator.generated-targets
$(sources) : $(property-set) : $(project) $(name) ] ;
}
if $(reason)
{
ECHO warn:
$(reason) ;
ECHO warn:
"It's suggested to use '<runtime-link>static' together"
"with the '<link>static'." ;
return ;
}
else
{
return true ;
}
}
}
generators.register [ new gcc-linking-generator gcc.link : LIB OBJ : EXE