1 |
# Scons configuration file for Bruce unit tests |
2 |
|
3 |
# |
4 |
# set appropriate configuration variable defaults |
5 |
esysroot=str(Dir('./../../../..').abspath) |
6 |
execfile(str(File(esysroot+"/scons/esys_options.py"))) |
7 |
|
8 |
cxx_flags=cxx_flags_debug |
9 |
|
10 |
print "Build configuration for module: Bruce unit tests" |
11 |
print " cxx: ", cxx |
12 |
print " cxx_flags: ", cxx_flags |
13 |
|
14 |
# |
15 |
# do the actual build |
16 |
|
17 |
bruce_path = str(esysroot) + '/bruce/src' |
18 |
bruce_test_path = str(esysroot) + '/bruce/test/Bruce' |
19 |
escript_path = str(esysroot) + '/escript/src' |
20 |
esysUtils_path = str(esysroot) + '/esysUtils/src' |
21 |
CppUnitTest_path = str(esysroot) + '/tools/CppUnitTest/inc' |
22 |
|
23 |
esys_lib_path = str(esysroot) + '/lib' |
24 |
esysUtils_lib_path = str(esysroot) + '/esysUtils/lib' |
25 |
CppUnitTest_lib_path = str(esysroot) + '/tools/CppUnitTest/lib' |
26 |
|
27 |
bruce_lib = str(esys_lib_path) + '/libbrucecpp.so' |
28 |
|
29 |
install_dir = str(esysroot) + '/bruce/test' |
30 |
|
31 |
cpp_path = [bruce_path, |
32 |
bruce_test_path, |
33 |
escript_path, |
34 |
esysUtils_path, |
35 |
CppUnitTest_path, |
36 |
python_path, |
37 |
boost_path] |
38 |
|
39 |
lib_path = [esys_lib_path, |
40 |
esysUtils_lib_path, |
41 |
CppUnitTest_lib_path, |
42 |
python_lib_path, |
43 |
boost_lib_path] |
44 |
|
45 |
libs = ['brucecpp', |
46 |
'escriptcpp', |
47 |
'esysUtils', |
48 |
'CppUnitTest', |
49 |
str(python_lib), |
50 |
str(boost_lib), |
51 |
'dl', |
52 |
'util'] |
53 |
|
54 |
libs.extend(sys_libs) |
55 |
|
56 |
sources = ['BruceTestCase.cpp', |
57 |
'BruceTest.cpp'] |
58 |
|
59 |
target = 'BruceTest.exe' |
60 |
|
61 |
import os |
62 |
bruce_env = Environment(ENV = os.environ) |
63 |
|
64 |
bruce_env.Replace(CXX = cxx) |
65 |
bruce_env.Replace(CXXFLAGS = cxx_flags) |
66 |
bruce_env.Replace(CPPPATH = cpp_path) |
67 |
bruce_env.Replace(LIBPATH = lib_path) |
68 |
bruce_env.Replace(LIBS = libs) |
69 |
|
70 |
bruce_test_exe = bruce_env.Program(target, sources) |
71 |
|
72 |
Depends(bruce_test_exe, bruce_lib) |
73 |
|
74 |
Alias("build_tests", bruce_env.Install(install_dir, bruce_test_exe)) |
75 |
|
76 |
import scons_extensions |
77 |
runUnitTest_builder = Builder(action = scons_extensions.runUnitTest, suffix = '.passed', single_source=True) |
78 |
bruce_env.Append(BUILDERS = {'RunUnitTest' : runUnitTest_builder}); |
79 |
|
80 |
Alias("run_tests", bruce_env.RunUnitTest(target)) |