Debian Codegraph @

sample/SCons/SConstruct

raw
1
2 cxxtestbuilder_path = '../../build_tools/SCons/cxxtest.py'
3 cxxtest_path = '../..'
4
5 # First a bit of python magic to make the CxxTestBuilder available
6 # without having to copy it into a particular path.
7 # for nicer examples you *should* use, see the cxxtest builder tests in the
8 # build_tools/SCons/test directory.
9 import imp
10 cxxtest = imp.load_source('cxxtest', cxxtestbuilder_path)
11
12 # First build the 'real' library, when working on an embedded system
13 # this may involve a cross compiler.
14 env = Environment()
15 env.BuildDir('build/embedded_platform', 'src')
16 env.Append(CPPPATH=['include'])
17 libtested = env.StaticLibrary('build/embedded_platform/tested',
18 env.Glob('build/embedded_platform/*.c'))
19
20 # Now create a seperate build environment for the tests so we can keep any
21 # options that are specific to testing seperate from the 'production' build
22 # environment. For simplicity I am just copying the production environment.
23 # If we are cross compiling for the "real" library, then this
24 # environement might be using the normal compiler.
25 env_test = env.Clone()
26
27 # Add the CxxTestBuilder to our testing build environment.
28 cxxtest.generate(env_test, CXXTEST_INSTALL_DIR = cxxtest_path)
29
30 # If we were working with an embedded platform we may want to create a
31 # seperate version of our library that runs on our development box in
32 # order to do our initial unit testing. This version may also include
33 # any special preprocessor defines needed for testing e.g. -DTESTING
34 env_test.BuildDir('build/dev_platform', 'src')
35 env_test.BuildDir('build/tests', 'tests')
36 lib_to_test = env_test.StaticLibrary('build/dev_platform/tested',
37 env.Glob('build/dev_platform/*.c'))
38 env_test.Append(LIBS=lib_to_test)
39 env_test.CxxTest(env_test.Glob('tests/*.h'))
40