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