1 |
|
|
2 |
|
######################################################## |
3 |
|
# |
4 |
|
# Copyright (c) 2003-2008 by University of Queensland |
5 |
|
# Earth Systems Science Computational Center (ESSCC) |
6 |
|
# http://www.uq.edu.au/esscc |
7 |
|
# |
8 |
|
# Primary Business: Queensland, Australia |
9 |
|
# Licensed under the Open Software License version 3.0 |
10 |
|
# http://www.opensource.org/licenses/osl-3.0.php |
11 |
|
# |
12 |
|
######################################################## |
13 |
|
|
14 |
|
|
15 |
import os |
import os |
16 |
Import('*') |
Import('*') |
17 |
|
|
18 |
local_env=env.Copy() |
local_env = clone_env(env_mpi) |
19 |
py_wrapper_local_env=env.Copy() |
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 |
# Remove the sharedlibrary prefix on all platform - we don't want 'lib' mucking with our python modules |
22 |
del py_wrapper_local_env['SHLIBPREFIX'] |
del py_wrapper_local_env['SHLIBPREFIX'] |
23 |
|
|
24 |
lib_name = 'finley' |
sources = """ |
25 |
py_wrapper_name = lib_name+'cpp' |
Assemble_AverageElementData.c |
26 |
py_wrapper_source = 'CPPAdapter/'+py_wrapper_name+'.cpp' # FIXME: In need of a source tree refactor |
Assemble_CopyElementData.c |
27 |
py_wrapper_lib_name = py_wrapper_name |
Assemble_CopyNodalData.c |
28 |
|
Assemble_LumpedSystem.c |
29 |
src_dir = local_env.Dir('.').srcnode().abspath |
Assemble_NodeCoordinates.c |
30 |
filenames = [ x for x in os.listdir(src_dir) if os.path.splitext(x)[1] in [".h", ".c", ".cpp"] ] |
Assemble_PDE.c |
31 |
|
Assemble_PDE_Single2_1D.c |
32 |
sources = [x for x in filenames if os.path.splitext(x)[1] in ['.cpp', '.c']] |
Assemble_PDE_Single2_2D.c |
33 |
headers = [x for x in filenames if os.path.splitext(x)[1] in ['.h']] |
Assemble_PDE_Single2_3D.c |
34 |
|
Assemble_PDE_Single2_C.c |
35 |
|
Assemble_PDE_System2_1D.c |
36 |
# finleycpp has additional source in the CPPAdapter sub-directory. Append these to the list |
Assemble_PDE_System2_2D.c |
37 |
cppadapter_filenames = [ 'CPPAdapter/'+x for x in os.listdir(src_dir+'/CPPAdapter') if os.path.splitext(x)[1] in [".h", ".c", ".cpp"] ] |
Assemble_PDE_System2_3D.c |
38 |
sources += [ x for x in cppadapter_filenames if os.path.splitext(x)[1] in ['.cpp', '.c']] |
Assemble_PDE_System2_C.c |
39 |
cppadapter_headers = [x for x in cppadapter_filenames if os.path.splitext(x)[1] in ['.h']] |
Assemble_addToSystemMatrix.c |
40 |
|
Assemble_getAssembleParameters.c |
41 |
sources.remove(py_wrapper_source) # FIXME: should probably refactor the source tree so the python wrapper isn't colocated with c++ sources |
Assemble_getSize.c |
42 |
local_env.Append(LIBS = [boost_lib, python_lib, sys_libs, 'escript', 'esysUtils', 'paso']) |
Assemble_gradient.c |
43 |
py_wrapper_local_env.Append(LIBS = [boost_lib, python_lib, sys_libs, lib_name, 'escript', 'esysUtils', 'paso']) |
Assemble_integrate.c |
44 |
|
Assemble_interpolate.c |
45 |
if mkl_libs: |
Assemble_jacobeans.c |
46 |
local_env.Append(CPPDEFINES=['MKL',]) |
Assemble_setNormal.c |
47 |
local_env.Append(LIBS = mkl_libs) |
ElementFile.c |
48 |
if scsl_libs: |
ElementFile_allocTable.c |
49 |
local_env.Append(CPPDEFINES=['SCSL',]) |
ElementFile_copyTable.c |
50 |
local_env.Append(LIBS = scsl_libs) |
ElementFile_createColoring.c |
51 |
if umf_libs: |
ElementFile_distributeByRankOfDOF.c |
52 |
local_env.Append(CPPDEFINES=['UMFPACK',]) |
ElementFile_gather.c |
53 |
local_env.Append(LIBS = umf_libs) |
ElementFile_jacobeans.c |
54 |
if papi_libs: |
ElementFile_markNodes.c |
55 |
local_env.Append(CPPDEFINES=['PAPI',]) |
ElementFile_optimizeOrdering.c |
56 |
local_env.Append(LIBS = papi_libs) |
ElementFile_relableNodes.c |
57 |
|
ElementFile_scatter.c |
58 |
|
ElementFile_setCoordinates.c |
59 |
|
ElementFile_setNodeRange.c |
60 |
|
ElementFile_setTags.c |
61 |
|
Finley.c |
62 |
|
IndexList.c |
63 |
|
Mesh.c |
64 |
|
Mesh_createNodeFileMappings.c |
65 |
|
Mesh_distributeByRankOfDOF.c |
66 |
|
Mesh_findMatchingFaces.c |
67 |
|
Mesh_getPattern.c |
68 |
|
Mesh_glueFaces.c |
69 |
|
Mesh_hex20.c |
70 |
|
Mesh_hex8.c |
71 |
|
Mesh_joinFaces.c |
72 |
|
Mesh_markNodes.c |
73 |
|
Mesh_merge.c |
74 |
|
Mesh_optimizeDOFDistribution.c |
75 |
|
Mesh_optimizeDOFLabeling.c |
76 |
|
Mesh_prepare.c |
77 |
|
Mesh_print.c |
78 |
|
Mesh_read.c |
79 |
|
Mesh_readGmsh.c |
80 |
|
Mesh_rec4.c |
81 |
|
Mesh_rec8.c |
82 |
|
Mesh_relableElementNodes.c |
83 |
|
Mesh_resolveNodeIds.c |
84 |
|
Mesh_saveDX.c |
85 |
|
Mesh_saveVTK.c |
86 |
|
Mesh_setCoordinates.c |
87 |
|
Mesh_tagmaps.c |
88 |
|
Mesh_write.c |
89 |
|
NodeFile.c |
90 |
|
NodeFile_allocTable.c |
91 |
|
NodeFile_copyTable.c |
92 |
|
NodeFile_createDenseLabelings.c |
93 |
|
NodeFile_gather.c |
94 |
|
NodeFile_scatter.c |
95 |
|
NodeFile_setCoordinates.c |
96 |
|
NodeFile_setIdRange.c |
97 |
|
NodeFile_setTags.c |
98 |
|
NodeMapping.c |
99 |
|
Quadrature.c |
100 |
|
ReferenceElements.c |
101 |
|
ShapeFunctions.c |
102 |
|
TagMap.c |
103 |
|
Util.c |
104 |
|
CPPAdapter/FinleAdapterException.cpp |
105 |
|
CPPAdapter/FinleyError.cpp |
106 |
|
CPPAdapter/MeshAdapter.cpp |
107 |
|
CPPAdapter/MeshAdapterFactory.cpp |
108 |
|
CPPAdapter/SystemMatrixAdapter.cpp |
109 |
|
CPPAdapter/TransportProblemAdapter.cpp |
110 |
|
""".split() |
111 |
|
headers = """ |
112 |
|
Assemble.h |
113 |
|
ElementFile.h |
114 |
|
Finley.h |
115 |
|
FinleyVersion.h |
116 |
|
IndexList.h |
117 |
|
Mesh.h |
118 |
|
NodeFile.h |
119 |
|
NodeMapping.h |
120 |
|
Quadrature.h |
121 |
|
RectangularMesh.h |
122 |
|
ReferenceElements.h |
123 |
|
ShapeFunctions.h |
124 |
|
TagMap.h |
125 |
|
Util.h |
126 |
|
vtkCellType.h |
127 |
|
""".split() |
128 |
|
cppadapter_headers = """ |
129 |
|
CPPAdapter/FinleyAdapterException.h |
130 |
|
CPPAdapter/FinleyError.h |
131 |
|
CPPAdapter/MeshAdapter.h |
132 |
|
CPPAdapter/MeshAdapterFactory.h |
133 |
|
CPPAdapter/SystemMatrixAdapter.h |
134 |
|
CPPAdapter/TransportProblemAdapter.h |
135 |
|
CPPAdapter/system_dep.h |
136 |
|
""".split() |
137 |
|
|
138 |
|
local_env.Append(LIBS = ['escript', 'esysUtils', 'paso'] + env['sys_libs'] ) |
139 |
|
py_wrapper_local_env.Append(LIBS = ['finley', 'escript', 'esysUtils', 'paso'] + env['sys_libs'] ) |
140 |
|
|
141 |
|
lib = local_env.SharedLibrary('finley', sources) |
142 |
|
env.Alias('target_finley_so', lib) |
143 |
|
|
144 |
lib = local_env.SharedLibrary(lib_name, sources) |
py_wrapper_lib = py_wrapper_local_env.SharedLibrary('finleycpp', 'CPPAdapter/finleycpp.cpp') |
145 |
py_wrapper_lib = py_wrapper_local_env.SharedLibrary( py_wrapper_lib_name, py_wrapper_source) |
env.Alias('target_finleycpp_so', py_wrapper_lib) |
146 |
|
|
147 |
include_path = Dir(lib_name, incinstall) |
include_path = Dir('finley', local_env['incinstall']) |
148 |
cppadapter_include_path = Dir('CppAdapter', include_path) |
cppadapter_include_path = Dir('CppAdapter', include_path) |
149 |
|
|
150 |
local_env.Install(include_path, headers ) |
tmp1 = local_env.Install(include_path, headers ) |
151 |
local_env.Install(cppadapter_include_path, cppadapter_headers ) |
tmp2 = local_env.Install(cppadapter_include_path, cppadapter_headers ) |
152 |
local_env.Install(libinstall, lib) |
env.Alias('target_install_finley_headers', [tmp1, tmp2]) |
153 |
py_wrapper_local_env.Install(pyinstall+'/finley', py_wrapper_lib) |
|
154 |
|
tmp3 = local_env.Install(local_env['libinstall'], lib) |
155 |
|
env.Alias('target_install_finley_so', tmp3) |
156 |
|
|
157 |
|
#windows specific mod |
158 |
|
if os.name == 'nt': |
159 |
|
tmp4 = py_wrapper_local_env.Install(local_env['pyinstall']+'/finley', ['finleycpp.pyd', 'finleycpp.lib', 'finleycpp.exp']) |
160 |
|
else: |
161 |
|
tmp4 = py_wrapper_local_env.InstallAs(local_env['pyinstall']+'/finley/finleycpp.so', py_wrapper_lib) |
162 |
|
env.Alias('target_install_finleycpp_so', tmp4) |
163 |
|
|
164 |
# export the lib target since tests will depend on it |
# export the lib target since tests will depend on it |
165 |
# the lib target is a list of file nodes (why? win32 produces more than one output file: .lib, .dll, .pdb) |
# the lib target is a list of file nodes (why? win32 produces more than one output file: .lib, .dll, .pdb) |
166 |
# FIXME: This list handling produces the desired result but can this be done directly with scons File nodes? |
# FIXME: This list handling produces the desired result but can this be done directly with scons File nodes? |
167 |
dep_lib = [libinstall+'/'+str(x) for x in lib] |
dep_lib = [local_env['libinstall']+'/'+str(x) for x in lib] |
168 |
Export('dep_lib') |
Export('dep_lib') |
169 |
|
|
|
# add source files to release |
|
|
release_srcfiles = [ env.File(x) for x in filenames + cppadapter_filenames ] + [env.File("SConscript"), ] |
|
|
env.Zip(src_zipfile, release_srcfiles) |
|
|
env.Tar(src_tarfile, release_srcfiles) |
|
|
|
|
170 |
# Call the python sconscript |
# Call the python sconscript |
171 |
env.SConscript(dirs = ['#/finley/py_src'], build_dir='py', duplicate=0) |
env.SConscript(dirs = ['#/finley/py_src'], build_dir='py', duplicate=0) |
172 |
|
|