Solution for #948 : special treatment for the test-suite
Note: this changeset globally sets the linkerflag --as-needed but adds a single, hard coded exception to this rule for taget/test-suite
This commit is contained in:
parent
9945351ab2
commit
4e5b1901a1
2 changed files with 9 additions and 1 deletions
|
|
@ -78,6 +78,7 @@ def defineBuildEnvironment():
|
||||||
, CFLAGS='-std=gnu99'
|
, CFLAGS='-std=gnu99'
|
||||||
)
|
)
|
||||||
env.Append(LINKFLAGS='-Wl,--no-undefined') # require every dependency is given on link, in the right order
|
env.Append(LINKFLAGS='-Wl,--no-undefined') # require every dependency is given on link, in the right order
|
||||||
|
env.Append(LINKFLAGS='-Wl,--as-needed') # by default only link against dependencies actually needed to resolve symbols
|
||||||
handleVerboseMessages(env)
|
handleVerboseMessages(env)
|
||||||
handleNoBugSwitches(env)
|
handleNoBugSwitches(env)
|
||||||
|
|
||||||
|
|
|
||||||
|
|
@ -62,6 +62,13 @@ def testCases(env,dir):
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
# Specific linker treatment for the testsuite:
|
||||||
|
# force explicit linking against all dependencies to ensure auto-registration of
|
||||||
|
# any test-class on startup, even if no code dependency is visible to the linker
|
||||||
|
envSuite = env.Clone()
|
||||||
|
envSuite.Append(LINKFLAGS='-Wl,--no-as-needed')
|
||||||
|
|
||||||
|
|
||||||
# have to treat some subdirs separately.
|
# have to treat some subdirs separately.
|
||||||
specialDirs = ['plugin','tool','include']
|
specialDirs = ['plugin','tool','include']
|
||||||
testSrcDirs = globRootdirs('*')
|
testSrcDirs = globRootdirs('*')
|
||||||
|
|
@ -69,7 +76,7 @@ testSrcDirs = globRootdirs('*')
|
||||||
|
|
||||||
testcases = [testCases(env, dir) for dir in testSrcDirs if not dir in specialDirs]
|
testcases = [testCases(env, dir) for dir in testSrcDirs if not dir in specialDirs]
|
||||||
testLibs = sharedTestLibs.values()
|
testLibs = sharedTestLibs.values()
|
||||||
testrunner = env.Program("test-suite", ["testrunner.cpp"]+testLibs+core_lib)
|
testrunner = envSuite.Program("test-suite", ["testrunner.cpp"]+testLibs+core_lib)
|
||||||
|
|
||||||
|
|
||||||
testsuite = ( testcases
|
testsuite = ( testcases
|
||||||
|
|
|
||||||
Loading…
Reference in a new issue