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