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