1 |
# Scons configuration file for Data unit tests |
2 |
|
3 |
# |
4 |
# set appropriate defaults for configuration variables |
5 |
esysroot=str(Dir('./../../../../').abspath) |
6 |
execfile(str(File(esysroot+"/scons/esys_options.py"))) |
7 |
|
8 |
cxx_flags=cxx_flags_debug |
9 |
|
10 |
# |
11 |
# print out build configuration for this module |
12 |
|
13 |
print "Build configuration for module: Data unit tests" |
14 |
print " cxx: ", cxx |
15 |
print " cxx_flags: ", cxx_flags |
16 |
|
17 |
# |
18 |
# do the actual build |
19 |
|
20 |
data_test_path = str(esysroot) + '/escript/test/Data' |
21 |
escript_path = str(esysroot) + '/escript/src' |
22 |
esysUtils_path = str(esysroot) + '/esysUtils/src' |
23 |
CppUnitTest_path = str(esysroot) + '/tools/CppUnitTest/inc' |
24 |
|
25 |
esys_lib_path = str(esysroot) + '/lib' |
26 |
esysUtils_lib_path = str(esysroot) + '/esysUtils/lib' |
27 |
CppUnitTest_lib_path = str(esysroot) + '/tools/CppUnitTest/lib' |
28 |
|
29 |
escript_lib = str(esys_lib_path) + '/libescriptcpp.so' |
30 |
|
31 |
install_dir = str(esysroot) + '/escript/test' |
32 |
|
33 |
cpp_path = [data_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 = ['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 = ['DataTestCase.cpp', |
57 |
'DataTest.cpp'] |
58 |
|
59 |
target = 'DataTest.exe' |
60 |
|
61 |
import os |
62 |
data_env = Environment(ENV = os.environ) |
63 |
|
64 |
data_env.Replace(CXX = cxx) |
65 |
data_env.Replace(CXXFLAGS = cxx_flags) |
66 |
data_env.Replace(CPPPATH = cpp_path) |
67 |
data_env.Replace(LIBPATH = lib_path) |
68 |
data_env.Replace(LIBS = libs) |
69 |
|
70 |
data_test_exe = data_env.Program(target, sources) |
71 |
|
72 |
Depends(data_test_exe, escript_lib) |
73 |
|
74 |
Alias("build_tests", data_env.Install(install_dir, data_test_exe)) |
75 |
|
76 |
import scons_extensions |
77 |
runUnitTest_builder = Builder(action = scons_extensions.runUnitTest, suffix = '.passed', single_source=True) |
78 |
data_env.Append(BUILDERS = {'RunUnitTest' : runUnitTest_builder}); |
79 |
|
80 |
Alias("run_tests", data_env.RunUnitTest(target)) |