/[escript]/trunk/finley/src/SConscript
ViewVC logotype

Diff of /trunk/finley/src/SConscript

Parent Directory Parent Directory | Revision Log Revision Log | View Patch Patch

revision 1568 by ksteube, Sat May 24 03:15:08 2008 UTC revision 3400 by caltinay, Mon Dec 6 02:23:07 2010 UTC
# Line 1  Line 1 
1  #          Copyright 2006 by ACcESS MNRF  
2    ########################################################
3    #
4    # Copyright (c) 2003-2010 by University of Queensland
5    # Earth Systems Science Computational Center (ESSCC)
6    # http://www.uq.edu.au/esscc
7  #  #
8  #              http://www.access.edu.au  # Primary Business: Queensland, Australia
9  #       Primary Business: Queensland, Australia  # Licensed under the Open Software License version 3.0
10  #  Licensed under the Open Software License version 3.0  # http://www.opensource.org/licenses/osl-3.0.php
 #     http://www.opensource.org/licenses/osl-3.0.php  
11  #  #
12    ########################################################
13    
14  import os  import os
15  Import('*')  Import('*')
16    
17  local_env=env.Copy()  local_env = env.Clone()
18  py_wrapper_local_env=env.Copy()  py_wrapper_local_env = env.Clone()
19  # Remove the sharedlibrary prefix on all platform - we don't want 'lib' mucking with our python modules  
20    # Remove the sharedlibrary prefix on all platform - we don't want 'lib'
21    # 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, 'escript', 'esysUtils', 'paso'] + sys_libs + mpi_libs )      Assemble_gradient.c
43  py_wrapper_local_env.Append(LIBS = [boost_lib, python_lib, lib_name, 'escript', 'esysUtils', 'paso'] + sys_libs + mpi_libs )      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        ElementFile_markNodes.c
55  if blas_libs:      ElementFile_optimizeOrdering.c
56     local_env.Append(LIBS = blas_libs)      ElementFile_relableNodes.c
57        ElementFile_scatter.c
58  if papi_instrument_solver:      ElementFile_setCoordinates.c
59     local_env.Append(CPPDEFINES=['PAPI',])      ElementFile_setNodeRange.c
60  if papi_libs:      ElementFile_setTags.c
61     local_env.Append(LIBS = papi_libs)      Finley.c
62     local_env.Append(CPPDEFINES=['BLOCKPAPI',])      IndexList.c
63        Mesh.c
64  if trilinos_libs:      Mesh_createNodeFileMappings.c
65     local_env.Append(CPPDEFINES=['TRILINOS',])      Mesh_distributeByRankOfDOF.c
66     local_env.Append(LIBS = trilinos_libs)      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_setCoordinates.c
86        Mesh_tagmaps.c
87        Mesh_write.c
88        NodeFile.c
89        NodeFile_allocTable.c
90        NodeFile_copyTable.c
91        NodeFile_createDenseLabelings.c
92        NodeFile_gather.c
93        NodeFile_scatter.c
94        NodeFile_setCoordinates.c
95        NodeFile_setIdRange.c
96        NodeFile_setTags.c
97        NodeMapping.c
98        Quadrature.c
99        ReferenceElements.c
100        ShapeFunctions.c
101        TagMap.c
102        Util.c
103        ReferenceElementSets.c
104        CPPAdapter/FinleyAdapterException.cpp
105        CPPAdapter/FinleyError.cpp
106        CPPAdapter/MeshAdapter.cpp
107        CPPAdapter/MeshAdapterFactory.cpp
108        CPPAdapter/SystemMatrixAdapter.cpp
109        CPPAdapter/TransportProblemAdapter.cpp
110    """.split()
111    
112    headers = """
113        Assemble.h
114        ElementFile.h
115        Finley.h
116        FinleyVersion.h
117        IndexList.h
118        Mesh.h
119        NodeFile.h
120        NodeMapping.h
121        Quadrature.h
122        RectangularMesh.h
123        ReferenceElements.h
124        ShapeFunctions.h
125        TagMap.h
126        Util.h
127        ReferenceElementSets.h
128    """.split()
129    
130    cppadapter_headers = """
131        CPPAdapter/FinleyAdapterException.h
132        CPPAdapter/FinleyError.h
133        CPPAdapter/MeshAdapter.h
134        CPPAdapter/MeshAdapterFactory.h
135        CPPAdapter/SystemMatrixAdapter.h
136        CPPAdapter/TransportProblemAdapter.h
137        CPPAdapter/system_dep.h
138    """.split()
139    
140    local_env.Append(LIBS = ['escript', 'esysUtils', 'paso'])
141    if IS_WINDOWS:
142        local_env.Append(CPPDEFINES = ['FINLEY_EXPORTS'])
143    
144  local_env.Append(CPPDEFINES = ['FINLEY_EXPORTS'])  module_name = 'finley'
145    
146  lib = local_env.SharedLibrary(lib_name, sources)  lib = local_env.SharedLibrary(module_name, sources)
147  py_wrapper_lib = py_wrapper_local_env.SharedLibrary( py_wrapper_lib_name, py_wrapper_source)  env.Alias('build_finley_lib', lib)
148    
149  include_path = Dir(lib_name, incinstall)  include_path = Dir('finley', local_env['incinstall'])
150  cppadapter_include_path = Dir('CppAdapter', include_path)  cppadapter_include_path = Dir('CppAdapter', include_path)
151    
152  local_env.Install(include_path, headers )  hdr_inst1 = local_env.Install(include_path, headers)
153  local_env.Install(cppadapter_include_path, cppadapter_headers )  hdr_inst2 = local_env.Install(cppadapter_include_path, cppadapter_headers)
154  local_env.Install(libinstall, lib)  env.Alias('install_finley_headers', [hdr_inst1, hdr_inst2])
155  py_wrapper_local_env.Install(pyinstall+'/finley', py_wrapper_lib)  
156    lib_inst = local_env.Install(local_env['libinstall'], lib)
157  #windows specific mod  env.Alias('install_finley_lib', lib_inst)
158  if os.name == 'nt':  
159     py_wrapper_local_env.InstallAs(target = [ pyinstall+'/finley/'+py_wrapper_lib_name+'.pyd', \  ### Python wrapper ###
160                                               pyinstall+'/finley/'+py_wrapper_lib_name+'.lib', \  py_wrapper_local_env.Append(LIBS = ['finley', 'escript', 'esysUtils', 'paso'])
161                                               pyinstall+'/finley/'+py_wrapper_lib_name+'.exp' ], \  py_wrapper_name = module_name + 'cpp'
162                                    source = py_wrapper_lib )  py_wrapper_lib = py_wrapper_local_env.SharedLibrary(py_wrapper_name, 'CPPAdapter/finleycpp.cpp')
163    env.Alias('build_finleycpp_lib', py_wrapper_lib)
164    
165  # export the lib target since tests will depend on it  tmp_inst = os.path.join(local_env['pyinstall'], module_name)
166  # the lib target is a list of file nodes (why? win32 produces more than one output file: .lib, .dll, .pdb)  if IS_WINDOWS:
167  # FIXME: This list handling produces the desired result but can this be done directly with scons File nodes?      wrapper_ext = '.pyd'
168  dep_lib = [libinstall+'/'+str(x) for x in lib]  else:
169  Export('dep_lib')      wrapper_ext = '.so'
170    
171  # add source files to release  share_name = os.path.join(tmp_inst, py_wrapper_name+wrapper_ext)
172  release_srcfiles = [ env.File(x) for x in filenames + cppadapter_filenames ] + [env.File("SConscript"), ]  mod_inst = py_wrapper_local_env.InstallAs(target=share_name,
173  env.Zip(src_zipfile, release_srcfiles)                                            source=py_wrapper_lib[0])
174  env.Tar(src_tarfile, release_srcfiles)  env.Alias('install_finleycpp_lib', mod_inst)
175    
176  # Call the python sconscript  # configure python module
177  env.SConscript(dirs = ['#/finley/py_src'], build_dir='py', duplicate=0)  local_env.SConscript(dirs = ['#/finley/py_src'], variant_dir='py', duplicate=0)
178    
179  # Call the unit tests SConscript  # configure unit tests
180  local_env.SConscript(dirs = ['#/finley/test'], build_dir='#/build/$PLATFORM/finley/test', duplicate=0)  local_env.SConscript(dirs = ['#/finley/test'], variant_dir='$BUILD_DIR/$PLATFORM/finley/test', duplicate=0, exports=['py_wrapper_lib'])
181    

Legend:
Removed from v.1568  
changed lines
  Added in v.3400

  ViewVC Help
Powered by ViewVC 1.1.26