1 |
jgs |
246 |
# Scons configuration file for BruceFactory unit tests |
2 |
jgs |
195 |
|
3 |
|
|
import os |
4 |
jgs |
226 |
import sys |
5 |
jgs |
195 |
|
6 |
jgs |
226 |
# |
7 |
|
|
# ensure correct versions of python and scons |
8 |
jgs |
195 |
|
9 |
jgs |
226 |
EnsurePythonVersion(2,3) |
10 |
|
|
EnsureSConsVersion(0,96) |
11 |
jgs |
195 |
|
12 |
jgs |
226 |
# |
13 |
|
|
# set appropriate defaults for configuration variables |
14 |
jgs |
195 |
|
15 |
jgs |
226 |
esysroot = Dir('#../../..') |
16 |
|
|
usegcc = 0 |
17 |
jgs |
246 |
options = None |
18 |
jgs |
253 |
sys_libs = [] |
19 |
jgs |
195 |
|
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 |
195 |
|
29 |
jgs |
226 |
if ARGUMENTS.get('usegcc',0): |
30 |
|
|
usegcc = 1 |
31 |
jgs |
195 |
|
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 |
|
|
if hostname=='ess': |
53 |
|
|
from ess_options import * |
54 |
|
|
|
55 |
jgs |
241 |
if usegcc==1: |
56 |
|
|
from gcc_options import * |
57 |
|
|
|
58 |
jgs |
246 |
if options!=None: |
59 |
|
|
exec "from " + options + " import *" |
60 |
|
|
|
61 |
jgs |
226 |
cxx_flags=cxx_flags_debug |
62 |
|
|
|
63 |
|
|
# |
64 |
|
|
# print out build configuration for this module |
65 |
|
|
|
66 |
|
|
print "########################################################" |
67 |
|
|
print "Build configuration for module: BruceFactory unit tests" |
68 |
|
|
print " dodebug: 1" |
69 |
|
|
print " usegcc: ", usegcc |
70 |
|
|
print " cxx: ", cxx |
71 |
|
|
print " platform: ", platform |
72 |
|
|
print " hostname: ", hostname |
73 |
|
|
print "########################################################" |
74 |
|
|
|
75 |
|
|
# |
76 |
|
|
# do the actual build |
77 |
|
|
|
78 |
jgs |
195 |
bruce_path = str(esysroot) + '/bruce/inc' |
79 |
|
|
brucefactory_test_path = str(esysroot) + '/bruce/test/BruceFactory' |
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 |
|
|
cpp_path = [bruce_path, |
89 |
|
|
brucefactory_test_path, |
90 |
|
|
escript_path, |
91 |
|
|
esysUtils_path, |
92 |
|
|
CppUnitTest_path, |
93 |
|
|
python_path, |
94 |
|
|
boost_path] |
95 |
|
|
|
96 |
|
|
lib_path = [esys_lib_path, |
97 |
|
|
esysUtils_lib_path, |
98 |
|
|
CppUnitTest_lib_path, |
99 |
|
|
python_lib_path, |
100 |
|
|
boost_lib_path] |
101 |
|
|
|
102 |
|
|
libs = ['brucecpp', |
103 |
|
|
'escriptcpp', |
104 |
|
|
'esysUtils', |
105 |
|
|
'CppUnitTest', |
106 |
jgs |
239 |
str(python_lib), |
107 |
|
|
str(boost_lib), |
108 |
jgs |
195 |
'dl', |
109 |
jgs |
253 |
'util'] |
110 |
jgs |
195 |
|
111 |
jgs |
253 |
libs.extend(sys_libs) |
112 |
|
|
|
113 |
jgs |
195 |
sources = ['BruceFactoryTestCase.cpp', |
114 |
|
|
'BruceFactoryTest.cpp'] |
115 |
|
|
|
116 |
|
|
target = 'BruceFactoryTest.exe' |
117 |
|
|
|
118 |
|
|
brucefactory_env = Environment(ENV = os.environ) |
119 |
|
|
|
120 |
jgs |
226 |
brucefactory_env.Replace(CXX = cxx) |
121 |
jgs |
195 |
brucefactory_env.Replace(CXXFLAGS = cxx_flags) |
122 |
|
|
brucefactory_env.Replace(CPPPATH = cpp_path) |
123 |
|
|
brucefactory_env.Replace(LIBPATH = lib_path) |
124 |
|
|
brucefactory_env.Replace(LIBS = libs) |
125 |
|
|
|
126 |
|
|
brucefactory_test_exe = brucefactory_env.Program(target, sources) |