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