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

Restore the gcc specific link generators.

* build/toolset.jam (inherit-generator): New parameter 'generators-to-ignore'.
* tools/gcc.jam: Ignore *link* generators when inheriting. Declare the
  gcc specific generator.
* test/gcc_runtime.py: Test that <link-runtime>static is correctly handled.
  The gcc specific generator is necessary exactly for that reason.


[SVN r25700]
This commit is contained in:
Vladimir Prus
2004-10-13 08:02:23 +00:00
parent da19826066
commit 593ceeef79
4 changed files with 70 additions and 19 deletions

View File

@@ -285,30 +285,33 @@ rule inherit ( toolset : base )
inherit-rules $(toolset) : $(base) ;
}
rule inherit-generators ( toolset properties * : base )
rule inherit-generators ( toolset properties * : base : generators-to-ignore * )
{
properties ?= <toolset>$(toolset) ;
local base-generators = [ generators.generators-for-toolset $(base) ] ;
for local g in $(base-generators)
{
local id = [ $(g).id ] ;
if ! $(id) in $(generators-to-ignore)
{
# Some generator names have multiple periods in their name, so
# $(id:B=$(toolset)) doesn't generate the right new-id name.
# e.g. if id = gcc.compile.c++, $(id:B=darwin) = darwin.c++,
# which is not what we want. Manually parse the base and suffix
# (if there's a better way to do this, I'd love to see it.)
# See also register in module generators.
local base = $(id) ;
local suffix = "" ;
while $(base:S)
{
suffix = $(base:S)$(suffix) ;
base = $(base:B) ;
}
local new-id = $(toolset)$(suffix) ;
# Some generator names have multiple periods in their name, so
# $(id:B=$(toolset)) doesn't generate the right new-id name.
# e.g. if id = gcc.compile.c++, $(id:B=darwin) = darwin.c++,
# which is not what we want. Manually parse the base and suffix
# (if there's a better way to do this, I'd love to see it.)
# See also register in module generators.
local base = $(id) ;
local suffix = "" ;
while $(base:S)
{
suffix = $(base:S)$(suffix) ;
base = $(base:B) ;
}
local new-id = $(toolset)$(suffix) ;
generators.register [ $(g).clone $(new-id) : $(properties) ] ;
generators.register [ $(g).clone $(new-id) : $(properties) ] ;
}
}
}

31
v2/test/gcc_runtime.py Normal file
View File

@@ -0,0 +1,31 @@
#!/usr/bin/python
# Copyright (C) Vladimir Prus 2004. 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.
# Tests that on gcc, we correctly report problem when static runtime
# is requested when building DLL.
from BoostBuild import Tester, List
import string
t = Tester()
# Create the needed files
t.write("project-root.jam", "")
t.write("Jamfile", """
lib hello : hello.cpp ;
""")
t.write("hello.cpp", """
int main()
{
return 0;
}
""")
t.run_build_system("link-runtime=static", status=1)
t.fail_test(string.find(t.stdout(),
"on gcc, DLL can't be build with <link-runtime>static") == -1)
t.cleanup()

View File

@@ -1,5 +1,6 @@
#!/usr/bin/python
import os, sys, string
from BoostBuild import get_toolset
# clear environment for testing
#
@@ -133,6 +134,9 @@ if os.name == 'posix':
# Besides, it fails ;-)
tests.append("library_order")
if string.find(get_toolset(), 'gcc') == 0:
tests.append("gcc_runtime")
if os.environ.has_key('QTDIR'):
tests.append("railsys")
else:

View File

@@ -17,7 +17,13 @@ import set ;
import common ;
feature.extend toolset : gcc ;
toolset.inherit gcc : unix ;
import unix ;
toolset.inherit-generators gcc : unix : unix.link unix.link.dll ;
toolset.inherit-flags gcc : unix ;
toolset.inherit-rules gcc : unix ;
# Make the "o" suffix used for gcc toolset on all
# platforms
@@ -151,10 +157,17 @@ class gcc-linking-generator : unix-linking-generator
}
return [ unix-linking-generator.generated-targets
$(sources) : $(property-set) : $(property-set) $(name) ] ;
$(sources) : $(property-set) : $(project) $(name) ] ;
}
}
generators.register [ new gcc-linking-generator gcc.link : LIB OBJ : EXE
: <toolset>gcc ] ;
generators.register [ new gcc-linking-generator gcc.link.dll : LIB OBJ : SHARED_LIB
: <toolset>gcc ] ;
# Declare flags and action for linking
flags gcc.link OPTIONS <debug-symbols>on : -g ;