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