1 |
jgs |
235 |
# Scons configuration file for DataFactory unit tests |
2 |
jgs |
196 |
|
3 |
|
|
import os |
4 |
jgs |
235 |
import sys |
5 |
jgs |
196 |
|
6 |
jgs |
235 |
# |
7 |
|
|
# ensure correct versions of python and scons |
8 |
jgs |
196 |
|
9 |
jgs |
235 |
EnsurePythonVersion(2,3) |
10 |
|
|
EnsureSConsVersion(0,96) |
11 |
jgs |
196 |
|
12 |
jgs |
235 |
# |
13 |
|
|
# set appropriate defaults for configuration variables |
14 |
jgs |
196 |
|
15 |
jgs |
235 |
esysroot = Dir('#../../..') |
16 |
|
|
usegcc = 0 |
17 |
jgs |
246 |
options = None |
18 |
jgs |
196 |
|
19 |
jgs |
235 |
# |
20 |
|
|
# retreive command-line arguments if any |
21 |
jgs |
196 |
|
22 |
jgs |
235 |
if ARGUMENTS.get('usegcc',0): |
23 |
|
|
usegcc = 1 |
24 |
jgs |
196 |
|
25 |
jgs |
246 |
if ARGUMENTS.get('options',0): |
26 |
|
|
options = ARGUMENTS.get('options',0) |
27 |
|
|
|
28 |
jgs |
235 |
# |
29 |
|
|
# determine platform |
30 |
|
|
|
31 |
|
|
env = Environment(ENV = os.environ) |
32 |
|
|
platform = env['PLATFORM'] |
33 |
|
|
|
34 |
|
|
# |
35 |
|
|
# determine hostname |
36 |
|
|
|
37 |
|
|
hostname = os.environ['HOSTNAME'] |
38 |
|
|
|
39 |
|
|
# |
40 |
|
|
# load configuration settings |
41 |
|
|
|
42 |
|
|
options_dir = str(esysroot) + '/scons' |
43 |
|
|
sys.path.append(options_dir) |
44 |
|
|
|
45 |
|
|
if hostname=='ess': |
46 |
|
|
from ess_options import * |
47 |
|
|
|
48 |
jgs |
241 |
if usegcc==1: |
49 |
|
|
from gcc_options import * |
50 |
|
|
|
51 |
jgs |
246 |
if options!=None: |
52 |
|
|
exec "from " + options + " import *" |
53 |
|
|
|
54 |
jgs |
235 |
cxx_flags=cxx_flags_debug |
55 |
|
|
|
56 |
|
|
# |
57 |
|
|
# print out build configuration for this module |
58 |
|
|
|
59 |
|
|
print "#######################################################" |
60 |
|
|
print "Build configuration for module: DataFactory unit tests" |
61 |
|
|
print " dodebug: 1" |
62 |
|
|
print " usegcc: ", usegcc |
63 |
|
|
print " cxx: ", cxx |
64 |
|
|
print " platform: ", platform |
65 |
|
|
print " hostname: ", hostname |
66 |
|
|
print "#######################################################" |
67 |
|
|
|
68 |
|
|
# |
69 |
|
|
# do the actual build |
70 |
|
|
|
71 |
jgs |
196 |
datafactory_test_path = str(esysroot) + '/escript/test/DataFactory' |
72 |
|
|
escript_path = str(esysroot) + '/escript/inc' |
73 |
|
|
esysUtils_path = str(esysroot) + '/esysUtils/inc' |
74 |
|
|
CppUnitTest_path = str(esysroot) + '/tools/CppUnitTest/inc' |
75 |
|
|
|
76 |
|
|
esys_lib_path = str(esysroot) + '/lib' |
77 |
|
|
esysUtils_lib_path = str(esysroot) + '/esysUtils/lib' |
78 |
|
|
CppUnitTest_lib_path = str(esysroot) + '/tools/CppUnitTest/lib' |
79 |
|
|
|
80 |
|
|
cpp_path = [datafactory_test_path, |
81 |
|
|
escript_path, |
82 |
|
|
esysUtils_path, |
83 |
|
|
CppUnitTest_path, |
84 |
|
|
python_path, |
85 |
|
|
boost_path] |
86 |
|
|
|
87 |
|
|
lib_path = [esys_lib_path, |
88 |
|
|
esysUtils_lib_path, |
89 |
|
|
CppUnitTest_lib_path, |
90 |
|
|
python_lib_path, |
91 |
|
|
boost_lib_path] |
92 |
|
|
|
93 |
|
|
libs = ['escriptcpp', |
94 |
|
|
'esysUtils', |
95 |
|
|
'CppUnitTest', |
96 |
jgs |
239 |
str(python_lib), |
97 |
|
|
str(boost_lib), |
98 |
jgs |
196 |
'dl', |
99 |
|
|
'util', |
100 |
|
|
'guide', |
101 |
|
|
'irc'] |
102 |
|
|
|
103 |
|
|
sources = ['DataFactoryTestCase.cpp', |
104 |
|
|
'DataFactoryTest.cpp'] |
105 |
|
|
|
106 |
|
|
target = 'DataFactoryTest.exe' |
107 |
|
|
|
108 |
|
|
datafactory_env = Environment(ENV = os.environ) |
109 |
|
|
|
110 |
jgs |
235 |
datafactory_env.Replace(CXX = cxx) |
111 |
jgs |
196 |
datafactory_env.Replace(CXXFLAGS = cxx_flags) |
112 |
|
|
datafactory_env.Replace(CPPPATH = cpp_path) |
113 |
|
|
datafactory_env.Replace(LIBPATH = lib_path) |
114 |
|
|
datafactory_env.Replace(LIBS = libs) |
115 |
|
|
|
116 |
|
|
datafactory_test_exe = datafactory_env.Program(target, sources) |