1 |
# Scons configuration file for finley MeshAdapter 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 |
options = None |
18 |
sys_libs = [] |
19 |
solver_libs = [] |
20 |
|
21 |
# |
22 |
# import configuration variables passed in from |
23 |
# calling SConscript (if any) |
24 |
|
25 |
Import('*') |
26 |
|
27 |
# |
28 |
# retreive command-line arguments if any |
29 |
|
30 |
if ARGUMENTS.get('usegcc',0): |
31 |
usegcc = 1 |
32 |
|
33 |
if ARGUMENTS.get('options',0): |
34 |
options = ARGUMENTS.get('options',0) |
35 |
|
36 |
# |
37 |
# determine platform |
38 |
|
39 |
env = Environment(ENV = os.environ) |
40 |
platform = env['PLATFORM'] |
41 |
|
42 |
# |
43 |
# determine hostname |
44 |
|
45 |
hostname = os.environ['HOSTNAME'] |
46 |
|
47 |
# |
48 |
# load configuration settings |
49 |
|
50 |
options_dir = str(esysroot) + '/scons' |
51 |
sys.path.append(options_dir) |
52 |
|
53 |
from default_options import * |
54 |
|
55 |
if hostname=='ess': |
56 |
from ess_options import * |
57 |
|
58 |
if usegcc==1: |
59 |
from gcc_options import * |
60 |
|
61 |
if options!=None: |
62 |
exec "from " + options + " import *" |
63 |
|
64 |
cxx_flags=cxx_flags_debug |
65 |
|
66 |
# |
67 |
# print out build configuration for this module |
68 |
|
69 |
print "Build configuration for module: MeshAdapter unit tests" |
70 |
print " dodebug: 1" |
71 |
print " usegcc: ", usegcc |
72 |
print " cxx: ", cxx |
73 |
print " platform: ", platform |
74 |
print " hostname: ", hostname |
75 |
|
76 |
# |
77 |
# do the actual build |
78 |
|
79 |
meshadapter_test_path = str(esysroot) + '/finley/test/MeshAdapter' |
80 |
escript_path = str(esysroot) + '/escript/inc' |
81 |
finley_path = str(esysroot) + '/finley/src/finley' |
82 |
finley_cppadapter_path = str(esysroot) + '/finley/src/finley/CPPAdapter' |
83 |
paso_path = str(esysroot) + '/paso/inc' |
84 |
mmio_path = str(esysroot) + '/tools/mmio/inc' |
85 |
esysUtils_path = str(esysroot) + '/esysUtils/inc' |
86 |
CppUnitTest_path = str(esysroot) + '/tools/CppUnitTest/inc' |
87 |
|
88 |
esys_lib_path = str(esysroot) + '/lib' |
89 |
finley_lib_path = str(esysroot) + '/finley/lib' |
90 |
mmio_lib_path = str(esysroot) + '/tools/mmio/lib' |
91 |
esysUtils_lib_path = str(esysroot) + '/esysUtils/lib' |
92 |
CppUnitTest_lib_path = str(esysroot) + '/tools/CppUnitTest/lib' |
93 |
|
94 |
finley_lib = str(esys_lib_path) + '/libfinleycpp.so' |
95 |
|
96 |
install_dir = str(esysroot) + '/finley/test' |
97 |
|
98 |
cpp_path = [meshadapter_test_path, |
99 |
escript_path, |
100 |
finley_path, |
101 |
finley_cppadapter_path, |
102 |
paso_path, |
103 |
mmio_path, |
104 |
esysUtils_path, |
105 |
CppUnitTest_path, |
106 |
python_path, |
107 |
boost_path] |
108 |
|
109 |
lib_path = [esys_lib_path, |
110 |
finley_lib_path, |
111 |
mmio_lib_path, |
112 |
esysUtils_lib_path, |
113 |
CppUnitTest_lib_path, |
114 |
python_lib_path, |
115 |
boost_lib_path] |
116 |
|
117 |
libs = ['escriptcpp', |
118 |
'esysUtils', |
119 |
'finleycpp', |
120 |
'paso', |
121 |
'mmio', |
122 |
'CppUnitTest', |
123 |
str(python_lib), |
124 |
str(boost_lib), |
125 |
'dl', |
126 |
'util'] |
127 |
|
128 |
libs.extend(sys_libs) |
129 |
libs.extend(solver_libs) |
130 |
|
131 |
sources = ['MeshAdapterTestCase.cpp', |
132 |
'MeshAdapterTest.cpp'] |
133 |
|
134 |
target = 'MeshAdapterTest.exe' |
135 |
|
136 |
meshadapter_env = Environment(ENV = os.environ) |
137 |
|
138 |
meshadapter_env.Replace(CXX = cxx) |
139 |
meshadapter_env.Replace(CXXFLAGS = cxx_flags) |
140 |
meshadapter_env.Replace(CPPPATH = cpp_path) |
141 |
meshadapter_env.Replace(LIBPATH = lib_path) |
142 |
meshadapter_env.Replace(LIBS = libs) |
143 |
|
144 |
meshadapter_test_exe = meshadapter_env.Program(target, sources) |
145 |
|
146 |
Depends(meshadapter_test_exe, finley_lib) |
147 |
|
148 |
meshadapter_env.Install(install_dir, meshadapter_test_exe) |