Skip to content
Snippets Groups Projects
Commit 60848f8b authored by g0dil's avatar g0dil
Browse files

Call CompileCheck builder from BoostUnitTest

Fix CompileCheck failure
parent 0af284f4
No related branches found
No related tags found
No related merge requests found
......@@ -17,7 +17,7 @@ env.Tool('PkgDraw', [ 'senfscons' ])
env.Tool('CopyToDir', [ 'senfscons' ])
env.Tool('CompileCheck', [ 'senfscons' ])
env.Tool('Boost', [ 'senfscons' ])
env.Tool('BoostUnitTests', [ 'senfscons' ])
env.Tool('BoostUnitTest', [ 'senfscons' ])
env.Tool('InstallSubdir', [ 'senfscons' ])
env.Help("""
......@@ -53,7 +53,7 @@ env.Append(
LIBPATH = [ '$LOCALLIBDIR' ],
LIBS = [ 'rt', '$BOOSTREGEXLIB', '$BOOSTIOSTREAMSLIB', '$BOOSTSIGNALSLIB',
'$BOOSTFSLIB' ],
TEST_EXTRA_LIBS = [ ],
TEST_EXTRA_LIBS = [ '$LIBSENF$LIBADDSUFFIX' ],
PREFIX = '/usr/local',
LIBINSTALLDIR = '$PREFIX/lib',
......
......@@ -26,8 +26,12 @@ import SCons.Defaults
import os.path
import os
def BoostUnitTests(env, target=None, source=None, **kw):
# ARGH ... Why do they put a '+' in the module name ????????
SCons.Tool.cplusplus=getattr(__import__('SCons.Tool.c++', globals(), locals(), []).Tool, 'c++')
def BoostUnitTest(env, target=None, source=None, **kw):
target = env.arg2nodes(target)[0]
source = env.arg2nodes(source)
binnode = target.dir.File('.' + target.name + '.bin')
stampnode = target.dir.File('.' + target.name + '.stamp')
......@@ -42,12 +46,21 @@ def BoostUnitTests(env, target=None, source=None, **kw):
'touch $TARGET' ],
**kw)
return env.Command(env.File(target), stamp, [ 'true' ])
alias = env.Command(env.File(target), stamp, [ 'true' ])
compileTests = [ src for src in source
if src.suffix in SCons.Tool.cplusplus.CXXSuffixes \
and src.exists() \
and 'COMPILE_CHECK' in file(str(src)).read() ]
if compileTests:
env.Depends(alias, env.CompileCheck(source = compileTests))
return alias
def generate(env):
env['BOOSTTESTLIB'] = 'boost_unit_test_framework'
env['BOOSTTESTARGS'] = [ '--build_info=yes', '--log_level=test_suite' ]
env['BUILDERS']['BoostUnitTests'] = BoostUnitTests
env['BUILDERS']['BoostUnitTest'] = BoostUnitTest
def exists(env):
return 1
......@@ -19,7 +19,7 @@ def scanTests(f):
def CompileCheck(target, source, env):
tests = scanTests(file(source[0].abspath))
cenv = env.Clone()
cenv.Append( CPPDEFINES = { 'COMPILE_CHECK': '' } )
cenv.Append( CPPDEFINES = [ 'COMPILE_CHECK' ] )
out = tempfile.TemporaryFile()
cenv['SPAWN'] = lambda sh, escape, cmd, args, env, pspawn=cenv['PSPAWN'], out=out: \
pspawn(sh, escape, cmd, args, env, out, out)
......
......@@ -28,24 +28,11 @@ def Glob(env, exclude=[], subdirs=[]):
return ( GlobSources(env, exclude, subdirs),
GlobIncludes(env, exclude, subdirs) )
def LibPath(lib): return '${LOCALLIBDIR}/${LIBPREFIX}%s${LIBADDSUFFIX}${LIBSUFFIX}' % lib
def Test(env, sources):
test = env.BoostUnitTests( target = 'test',
source = sources,
TEST_EXTRA_LIBS = [ '$LIBSENF$LIBADDSUFFIX'
] + env['TEST_EXTRA_LIBS'])
compileTestSources = [ src for src in sources
if 'COMPILE_CHECK' in file(src).read() ]
if compileTestSources:
env.Depends(test, env.CompileCheck(source = compileTestSources))
test=env.BoostUnitTest( target = 'test', source = sources )
env.Alias('all_tests', test)
return test
def Objects(env, sources, testSources = None):
if type(sources) == type(()):
testSources = sources[1]
......
0% Loading or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment