1 |
jgs |
235 |
# Scons configuration file for Bruce unit tests |
2 |
jgs |
193 |
|
3 |
|
|
import os |
4 |
jgs |
226 |
import sys |
5 |
jgs |
193 |
|
6 |
jgs |
226 |
# |
7 |
|
|
# ensure correct versions of python and scons |
8 |
jgs |
193 |
|
9 |
jgs |
226 |
EnsurePythonVersion(2,3) |
10 |
|
|
EnsureSConsVersion(0,96) |
11 |
jgs |
193 |
|
12 |
jgs |
226 |
# |
13 |
|
|
# set appropriate defaults for configuration variables |
14 |
jgs |
193 |
|
15 |
jgs |
226 |
esysroot = Dir('#../../..') |
16 |
|
|
usegcc = 0 |
17 |
jgs |
246 |
options = None |
18 |
jgs |
252 |
sys_libs = [] |
19 |
jgs |
193 |
|
20 |
jgs |
226 |
# |
21 |
jgs |
248 |
# import configuration variables passed in from |
22 |
|
|
# calling SConscript (if any) |
23 |
|
|
|
24 |
|
|
Import('*') |
25 |
|
|
|
26 |
|
|
# |
27 |
jgs |
226 |
# retreive command-line arguments if any |
28 |
jgs |
193 |
|
29 |
jgs |
226 |
if ARGUMENTS.get('usegcc',0): |
30 |
|
|
usegcc = 1 |
31 |
jgs |
193 |
|
32 |
jgs |
246 |
if ARGUMENTS.get('options',0): |
33 |
|
|
options = ARGUMENTS.get('options',0) |
34 |
|
|
|
35 |
jgs |
226 |
# |
36 |
|
|
# determine platform |
37 |
|
|
|
38 |
|
|
env = Environment(ENV = os.environ) |
39 |
|
|
platform = env['PLATFORM'] |
40 |
|
|
|
41 |
|
|
# |
42 |
|
|
# determine hostname |
43 |
|
|
|
44 |
|
|
hostname = os.environ['HOSTNAME'] |
45 |
|
|
|
46 |
|
|
# |
47 |
|
|
# load configuration settings |
48 |
|
|
|
49 |
|
|
options_dir = str(esysroot) + '/scons' |
50 |
|
|
sys.path.append(options_dir) |
51 |
|
|
|
52 |
jgs |
309 |
from default_options import * |
53 |
|
|
|
54 |
jgs |
226 |
if hostname=='ess': |
55 |
|
|
from ess_options import * |
56 |
|
|
|
57 |
jgs |
241 |
if usegcc==1: |
58 |
|
|
from gcc_options import * |
59 |
|
|
|
60 |
jgs |
246 |
if options!=None: |
61 |
|
|
exec "from " + options + " import *" |
62 |
|
|
|
63 |
jgs |
226 |
cxx_flags=cxx_flags_debug |
64 |
|
|
|
65 |
|
|
# |
66 |
|
|
# print out build configuration for this module |
67 |
|
|
|
68 |
|
|
print "Build configuration for module: Bruce unit tests" |
69 |
|
|
print " dodebug: 1" |
70 |
|
|
print " usegcc: ", usegcc |
71 |
|
|
print " cxx: ", cxx |
72 |
|
|
print " platform: ", platform |
73 |
|
|
print " hostname: ", hostname |
74 |
|
|
|
75 |
|
|
# |
76 |
|
|
# do the actual build |
77 |
|
|
|
78 |
jgs |
193 |
bruce_path = str(esysroot) + '/bruce/inc' |
79 |
|
|
bruce_test_path = str(esysroot) + '/bruce/test/Bruce' |
80 |
|
|
escript_path = str(esysroot) + '/escript/inc' |
81 |
|
|
esysUtils_path = str(esysroot) + '/esysUtils/inc' |
82 |
|
|
CppUnitTest_path = str(esysroot) + '/tools/CppUnitTest/inc' |
83 |
|
|
|
84 |
|
|
esys_lib_path = str(esysroot) + '/lib' |
85 |
|
|
esysUtils_lib_path = str(esysroot) + '/esysUtils/lib' |
86 |
|
|
CppUnitTest_lib_path = str(esysroot) + '/tools/CppUnitTest/lib' |
87 |
|
|
|
88 |
jgs |
288 |
bruce_lib = str(esys_lib_path) + '/libbrucecpp.so' |
89 |
|
|
|
90 |
|
|
install_dir = str(esysroot) + '/bruce/test' |
91 |
|
|
|
92 |
jgs |
193 |
cpp_path = [bruce_path, |
93 |
|
|
bruce_test_path, |
94 |
|
|
escript_path, |
95 |
|
|
esysUtils_path, |
96 |
|
|
CppUnitTest_path, |
97 |
|
|
python_path, |
98 |
|
|
boost_path] |
99 |
|
|
|
100 |
|
|
lib_path = [esys_lib_path, |
101 |
|
|
esysUtils_lib_path, |
102 |
|
|
CppUnitTest_lib_path, |
103 |
|
|
python_lib_path, |
104 |
|
|
boost_lib_path] |
105 |
|
|
|
106 |
|
|
libs = ['brucecpp', |
107 |
|
|
'escriptcpp', |
108 |
|
|
'esysUtils', |
109 |
|
|
'CppUnitTest', |
110 |
jgs |
239 |
str(python_lib), |
111 |
|
|
str(boost_lib), |
112 |
jgs |
193 |
'dl', |
113 |
jgs |
252 |
'util'] |
114 |
jgs |
193 |
|
115 |
jgs |
252 |
libs.extend(sys_libs) |
116 |
|
|
|
117 |
jgs |
193 |
sources = ['BruceTestCase.cpp', |
118 |
|
|
'BruceTest.cpp'] |
119 |
|
|
|
120 |
|
|
target = 'BruceTest.exe' |
121 |
|
|
|
122 |
|
|
bruce_env = Environment(ENV = os.environ) |
123 |
|
|
|
124 |
jgs |
226 |
bruce_env.Replace(CXX = cxx) |
125 |
jgs |
193 |
bruce_env.Replace(CXXFLAGS = cxx_flags) |
126 |
|
|
bruce_env.Replace(CPPPATH = cpp_path) |
127 |
|
|
bruce_env.Replace(LIBPATH = lib_path) |
128 |
|
|
bruce_env.Replace(LIBS = libs) |
129 |
|
|
|
130 |
|
|
bruce_test_exe = bruce_env.Program(target, sources) |
131 |
jgs |
288 |
|
132 |
|
|
Depends(bruce_test_exe, bruce_lib) |
133 |
|
|
|
134 |
|
|
bruce_env.Install(install_dir, bruce_test_exe) |
135 |
jgs |
297 |
|
136 |
|
|
import scons_extensions |
137 |
|
|
runUnitTest_builder = Builder(action = scons_extensions.runUnitTest, suffix = '.passed', single_source=True) |
138 |
|
|
bruce_env.Append(BUILDERS = {'RunUnitTest' : runUnitTest_builder}); |
139 |
jgs |
310 |
#bruce_env.RunUnitTest(target) |