1 |
# Scons configuration file for DataConstant unit tests |
2 |
|
3 |
# |
4 |
# set appropriate defaults for configuration variables |
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: DataConstant unit tests" |
12 |
print " cxx: ", cxx |
13 |
print " cxx_flags: ", cxx_flags |
14 |
|
15 |
# |
16 |
# do the actual build |
17 |
|
18 |
dataconstant_test_path = str(esysroot) + '/escript/test/DataConstant' |
19 |
escript_path = str(esysroot) + '/escript/inc' |
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 |
escript_lib = str(esys_lib_path) + '/libescriptcpp.so' |
28 |
|
29 |
install_dir = str(esysroot) + '/escript/test' |
30 |
|
31 |
cpp_path = [dataconstant_test_path, |
32 |
escript_path, |
33 |
esysUtils_path, |
34 |
CppUnitTest_path, |
35 |
python_path, |
36 |
boost_path] |
37 |
|
38 |
lib_path = [esys_lib_path, |
39 |
esysUtils_lib_path, |
40 |
CppUnitTest_lib_path, |
41 |
python_lib_path, |
42 |
boost_lib_path] |
43 |
|
44 |
libs = ['escriptcpp', |
45 |
'esysUtils', |
46 |
'CppUnitTest', |
47 |
str(python_lib), |
48 |
str(boost_lib), |
49 |
'dl', |
50 |
'util'] |
51 |
|
52 |
libs.extend(sys_libs) |
53 |
|
54 |
sources = ['DataConstantTestCase.cpp', |
55 |
'DataConstantTest.cpp'] |
56 |
|
57 |
target = 'DataConstantTest.exe' |
58 |
|
59 |
import os |
60 |
dataconstant_env = Environment(ENV = os.environ) |
61 |
|
62 |
dataconstant_env.Replace(CXX = cxx) |
63 |
dataconstant_env.Replace(CXXFLAGS = cxx_flags) |
64 |
dataconstant_env.Replace(CPPPATH = cpp_path) |
65 |
dataconstant_env.Replace(LIBPATH = lib_path) |
66 |
dataconstant_env.Replace(LIBS = libs) |
67 |
|
68 |
dataconstant_test_exe = dataconstant_env.Program(target, sources) |
69 |
|
70 |
Depends(dataconstant_test_exe, escript_lib) |
71 |
|
72 |
Alias("build_tests", dataconstant_env.Install(install_dir, dataconstant_test_exe)) |
73 |
|
74 |
import scons_extensions |
75 |
runUnitTest_builder = Builder(action = scons_extensions.runUnitTest, suffix = '.passed', single_source=True) |
76 |
dataconstant_env.Append(BUILDERS = {'RunUnitTest' : runUnitTest_builder}); |
77 |
|
78 |
Alias("run_tests", dataconstant_env.RunUnitTest(target)) |