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 |
252 |
sys_libs = [] |
18 |
jgs |
197 |
|
19 |
jgs |
227 |
# |
20 |
jgs |
248 |
# import configuration variables passed in from |
21 |
|
|
# calling SConscript (if any) |
22 |
|
|
|
23 |
|
|
Import('*') |
24 |
|
|
|
25 |
|
|
# |
26 |
jgs |
227 |
# retreive command-line arguments if any |
27 |
|
|
|
28 |
|
|
if ARGUMENTS.get('usegcc',0): |
29 |
|
|
usegcc = 1 |
30 |
|
|
|
31 |
jgs |
246 |
if ARGUMENTS.get('options',0): |
32 |
|
|
options = ARGUMENTS.get('options',0) |
33 |
|
|
|
34 |
jgs |
227 |
# |
35 |
|
|
# determine platform |
36 |
|
|
|
37 |
|
|
env = Environment(ENV = os.environ) |
38 |
|
|
platform = env['PLATFORM'] |
39 |
|
|
|
40 |
|
|
# |
41 |
|
|
# determine hostname |
42 |
|
|
|
43 |
|
|
hostname = os.environ['HOSTNAME'] |
44 |
|
|
|
45 |
|
|
# |
46 |
|
|
# load configuration settings |
47 |
|
|
|
48 |
|
|
options_dir = str(esysroot) + '/scons' |
49 |
|
|
sys.path.append(options_dir) |
50 |
|
|
|
51 |
|
|
if hostname=='ess': |
52 |
|
|
from ess_options import * |
53 |
|
|
|
54 |
jgs |
241 |
if usegcc==1: |
55 |
|
|
from gcc_options import * |
56 |
|
|
|
57 |
jgs |
246 |
if options!=None: |
58 |
|
|
exec "from " + options + " import *" |
59 |
|
|
|
60 |
jgs |
227 |
cxx_flags=cxx_flags_debug |
61 |
|
|
|
62 |
|
|
# |
63 |
|
|
# print out build configuration for this module |
64 |
|
|
|
65 |
|
|
print "####################################################" |
66 |
jgs |
246 |
print "Build configuration for module: EsysException unit tests" |
67 |
jgs |
227 |
print " dodebug: 1" |
68 |
|
|
print " usegcc: ", usegcc |
69 |
|
|
print " cxx: ", cxx |
70 |
|
|
print " platform: ", platform |
71 |
|
|
print " hostname: ", hostname |
72 |
|
|
print "####################################################" |
73 |
|
|
|
74 |
|
|
# |
75 |
|
|
# do the actual build |
76 |
|
|
|
77 |
jgs |
197 |
esysexception_test_path = str(esysroot) + '/esysUtils/test/EsysException' |
78 |
|
|
esysUtils_path = str(esysroot) + '/esysUtils/inc' |
79 |
|
|
CppUnitTest_path = str(esysroot) + '/tools/CppUnitTest/inc' |
80 |
|
|
|
81 |
|
|
esysUtils_lib_path = str(esysroot) + '/esysUtils/lib' |
82 |
|
|
CppUnitTest_lib_path = str(esysroot) + '/tools/CppUnitTest/lib' |
83 |
|
|
|
84 |
|
|
cpp_path = [esysexception_test_path, |
85 |
|
|
esysUtils_path, |
86 |
|
|
CppUnitTest_path] |
87 |
|
|
|
88 |
|
|
lib_path = [esysUtils_lib_path, |
89 |
|
|
CppUnitTest_lib_path] |
90 |
|
|
|
91 |
|
|
libs = ['esysUtils', |
92 |
jgs |
252 |
'CppUnitTest'] |
93 |
jgs |
197 |
|
94 |
jgs |
252 |
libs.extend(sys_libs) |
95 |
|
|
|
96 |
jgs |
197 |
sources = ['EsysExceptionTestCase.cpp', |
97 |
|
|
'EsysExceptionTest.cpp'] |
98 |
|
|
|
99 |
|
|
target = 'EsysExceptionTest.exe' |
100 |
|
|
|
101 |
|
|
esysexception_env = Environment(ENV = os.environ) |
102 |
|
|
|
103 |
jgs |
227 |
esysexception_env.Replace(CXX = cxx) |
104 |
jgs |
197 |
esysexception_env.Replace(CXXFLAGS = cxx_flags) |
105 |
|
|
esysexception_env.Replace(CPPPATH = cpp_path) |
106 |
|
|
esysexception_env.Replace(LIBPATH = lib_path) |
107 |
|
|
esysexception_env.Replace(LIBS = libs) |
108 |
|
|
|
109 |
|
|
esysexception_test_exe = esysexception_env.Program(target, sources) |