1 |
######################################################## |
2 |
# |
3 |
# Copyright (c) 2003-2010 by University of Queensland |
4 |
# Earth Systems Science Computational Center (ESSCC) |
5 |
# http://www.uq.edu.au/esscc |
6 |
# |
7 |
# Primary Business: Queensland, Australia |
8 |
# Licensed under the Open Software License version 3.0 |
9 |
# http://www.opensource.org/licenses/osl-3.0.php |
10 |
# |
11 |
######################################################## |
12 |
|
13 |
|
14 |
import os |
15 |
Import('*') |
16 |
|
17 |
local_env = clone_env(env_mpi) |
18 |
local_dodgy = clone_env(dodgy_env) |
19 |
py_wrapper_local_env = clone_env(env_mpi) |
20 |
|
21 |
# Remove the sharedlibrary prefix on all platform - we don't want 'lib' mucking with our python modules |
22 |
del py_wrapper_local_env['SHLIBPREFIX'] |
23 |
|
24 |
sources = """ |
25 |
AbstractContinuousDomain.cpp |
26 |
AbstractDomain.cpp |
27 |
AbstractSystemMatrix.cpp |
28 |
AbstractTransportProblem.cpp |
29 |
Data.cpp |
30 |
DataAbstract.cpp |
31 |
DataBlocks2D.cpp |
32 |
DataC.cpp |
33 |
DataConstant.cpp |
34 |
DataEmpty.cpp |
35 |
DataException.cpp |
36 |
DataExpanded.cpp |
37 |
DataFactory.cpp |
38 |
DataLazy.cpp |
39 |
DataMaths.cpp |
40 |
DataReady.cpp |
41 |
DataTagged.cpp |
42 |
DataTypes.cpp |
43 |
DataVector.cpp |
44 |
DomainException.cpp |
45 |
EscriptParams.cpp |
46 |
FunctionSpace.cpp |
47 |
FunctionSpaceException.cpp |
48 |
FunctionSpaceFactory.cpp |
49 |
LapackInverseHelper.cpp |
50 |
NullDomain.cpp |
51 |
SystemMatrixException.cpp |
52 |
Taipan.cpp |
53 |
TestDomain.cpp |
54 |
TransportProblemException.cpp |
55 |
Utils.cpp |
56 |
WrappedArray.cpp |
57 |
""".split() |
58 |
# blocktimer.c |
59 |
headers = """ |
60 |
AbstractContinuousDomain.h |
61 |
AbstractDomain.h |
62 |
AbstractSystemMatrix.h |
63 |
AbstractTransportProblem.h |
64 |
BinaryOp.h |
65 |
Data.h |
66 |
DataAbstract.h |
67 |
DataAlgorithm.h |
68 |
DataBlocks2D.h |
69 |
DataC.h |
70 |
DataConstant.h |
71 |
DataEmpty.h |
72 |
DataException.h |
73 |
DataExpanded.h |
74 |
DataFactory.h |
75 |
DataLazy.h |
76 |
DataMaths.h |
77 |
DataReady.h |
78 |
DataTagged.h |
79 |
DataTypes.h |
80 |
DataVector.h |
81 |
Dodgy.h |
82 |
DomainException.h |
83 |
EscriptParams.h |
84 |
FunctionSpace.h |
85 |
FunctionSpaceException.h |
86 |
FunctionSpaceFactory.h |
87 |
LapackInverseHelper.h |
88 |
LocalOps.h |
89 |
NullDomain.h |
90 |
Pointers.h |
91 |
SystemMatrixException.h |
92 |
Taipan.h |
93 |
TestDomain.h |
94 |
TransportProblemException.h |
95 |
UnaryFuncs.h |
96 |
UnaryOp.h |
97 |
UtilC.h |
98 |
Utils.h |
99 |
WrappedArray.h |
100 |
esysmpi.h |
101 |
system_dep.h |
102 |
""".split() |
103 |
# blocktimer.h |
104 |
|
105 |
dodgy_sources = """ |
106 |
Dodgy.cpp |
107 |
""".split() |
108 |
|
109 |
local_env.Append(LIBS = [ 'esysUtils'] + env['sys_libs'] ) |
110 |
local_dodgy.Append(LIBS = [ 'esysUtils'] + env['sys_libs'] ) |
111 |
|
112 |
if IS_WINDOWS: |
113 |
local_env.Append(CPPDEFINES = ['ESCRIPT_EXPORTS']) |
114 |
local_dodgy.Append(CPPDEFINES = ['ESCRIPT_EXPORTS']) |
115 |
|
116 |
py_wrapper_local_env.Append(LIBS = [ 'escript', 'esysUtils'] + env['sys_libs']) |
117 |
|
118 |
module_name = 'escript' |
119 |
py_wrapper_name = module_name + 'cpp' |
120 |
|
121 |
#Specify to build shared object |
122 |
if local_env['iknowwhatimdoing']: |
123 |
nonped=[local_dodgy.SharedObject(x) for x in dodgy_sources] |
124 |
else: |
125 |
nonped=[] |
126 |
|
127 |
lib = local_env.SharedLibrary(module_name, sources+nonped) |
128 |
env.Alias('target_escript_so', lib) |
129 |
|
130 |
py_wrapper_lib = py_wrapper_local_env.SharedLibrary(py_wrapper_name, 'escriptcpp.cpp') |
131 |
env.Alias('target_escriptcpp_so', py_wrapper_lib) |
132 |
|
133 |
include_path = Dir('escript', local_env['incinstall']) |
134 |
|
135 |
tmp1 = local_env.Install(include_path, headers ) |
136 |
env.Alias('target_install_escript_headers', [tmp1]) |
137 |
|
138 |
tmp3 = local_env.Install(local_env['libinstall'], lib) |
139 |
env.Alias('target_install_escript_so', tmp3) |
140 |
|
141 |
#windows specific mod |
142 |
tmp_inst = os.path.join(local_env['pyinstall'],module_name) |
143 |
if os.name == 'nt': |
144 |
wrapper_postfix = '.pyd' |
145 |
else: |
146 |
wrapper_postfix = '.so' |
147 |
|
148 |
share_name = os.path.join(tmp_inst,py_wrapper_name+wrapper_postfix) |
149 |
|
150 |
tmp4 = py_wrapper_local_env.InstallAs(target=share_name, |
151 |
source=py_wrapper_lib[0]) |
152 |
|
153 |
env.Alias('target_install_escriptcpp_so', tmp4) |
154 |
|
155 |
# export the lib target since tests will depend on it |
156 |
# the lib target is a list of file nodes (why? win32 produces more than one output file: .lib, .dll, .pdb) |
157 |
# FIXME: This list handling produces the desired result but can this be done directly with scons File nodes? |
158 |
dep_lib = [local_env['libinstall']+'/'+str(x) for x in lib] |
159 |
Export('dep_lib') |
160 |
|
161 |
# Call the python sconscript |
162 |
CallSConscript(env,dirs = ['#/escript/py_src'], variant_dir='py', duplicate=0) |
163 |
|
164 |
# Call the unit tests SConscript |
165 |
CallSConscript(local_env,dirs = ['#/escript/test'], variant_dir='#/build/$PLATFORM/escript/test', duplicate=0) |
166 |
|