1 import SCons.Script.SConscript
6 def BoostUnitTests(env, target, source, test_source=None, LIBS = [], DEPENDS = [], **kw):
7 path, name = os.path.split(target)
9 if type(test_source) is not type([]):
10 test_source = [ test_source ]
13 testEnv = env.Copy(**kw)
14 testEnv.Prepend(LIBS = '$BOOSTTESTLIB')
15 testEnv.Prepend(LIBS = LIBS)
18 sources = sources + env.Object(source)
19 sources = sources + test_source
20 binName = os.path.join(path,'.' + name +'.bin')
21 testRunner = testEnv.Program(binName, sources)
22 stamp = os.path.join(path,'.' + os.path.splitext(name)[0]+'.stamp')
24 env.Depends(testRunner, DEPENDS)
25 return env.Command([ stamp ], testRunner,
26 [ '$SOURCE $BOOSTTESTARGS',
29 def dispatcher(*arg,**kw):
30 return BoostUnitTests(*arg,**kw)
33 env['BOOSTTESTLIB'] = 'boost_unit_test_framework'
34 env['BOOSTTESTARGS'] = [ '--build_info=yes', '--log_level=test_suite' ]
35 env.__class__.BoostUnitTests = dispatcher