/[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 618 by gross, Wed Mar 22 04:02:38 2006 UTC revision 682 by robwdcock, Mon Mar 27 02:43:09 2006 UTC
# Line 1  Line 1 
 libinstall = None  
 incinstall = None  
   
1  Import('*')  Import('*')
2    
3    local_env=env.Copy()
4    py_wrapper_local_env=env.Copy()
5    # Remove the sharedlibrary prefix on all platform - we don't want 'lib' mucking with our python modules
6    del py_wrapper_local_env['SHLIBPREFIX']
7    
8    lib_name = 'finley'
9    py_wrapper_name = lib_name+'cpp'
10    py_wrapper_source = 'CPPAdapter/'+py_wrapper_name+'.cpp' # FIXME: In need of a source tree refactor
11    py_wrapper_lib_name = py_wrapper_name
12    
13    src_dir = local_env.Dir('.').srcnode().abspath
14    
15  import os  import os
16  import string  filenames = os.listdir(src_dir)
17    sources = [x for x in filenames if os.path.splitext(x)[1] in ['.cpp', '.c']]
18    headers = [x for x in filenames if os.path.splitext(x)[1] in ['.h']]
19    # Filter unused sources
20    sources.remove('ElementFile_borrowLocalVolume.c') # FIXME: Should this file be removed?
21    
22    
23    # finleycpp has additional source in the CPPAdapter sub-directory. Append these to the list
24    cppadapter_filenames = os.listdir(src_dir+'/CPPAdapter');
25    sources += ['CPPAdapter/'+x for x in cppadapter_filenames if os.path.splitext(x)[1] in ['.cpp', '.c']]
26    cppadapter_headers = ['CPPAdapter/'+x for x in cppadapter_filenames if os.path.splitext(x)[1] in ['.h']]
27    
28    sources.remove(py_wrapper_source) # FIXME: should probably refactor the source tree so the python wrapper isn't colocated with c++ sources
29    local_env.Append(LIBS = [boost_lib, python_lib, sys_libs, 'escript', 'esysUtils', 'paso'])
30    py_wrapper_local_env.Append(LIBS = [boost_lib, python_lib, sys_libs, lib_name, 'escript', 'esysUtils', 'paso'])
31    
32    if mkl_libs:
33       local_env.Append(CPPDEFINES=['MKL',])
34       local_env.Append(LIBS = mkl_libs)
35    if scsl_libs:
36       local_env.Append(CPPDEFINES=['SCSL',])
37       local_env.Append(LIBS = scsl_libs)
38    if umf_libs:
39       local_env.Append(CPPDEFINES=['UMFPACK',])
40       local_env.Append(LIBS = umf_libs)
41    if papi_libs:
42       local_env.Append(CPPDEFINES=['PAPI',])
43       local_env.Append(LIBS = papi_libs)
44    
45    
46    lib = local_env.SharedLibrary(lib_name, sources)
47    py_wrapper_lib = py_wrapper_local_env.SharedLibrary( py_wrapper_lib_name, py_wrapper_source)
48    
49    include_path = Dir(lib_name, incinstall)
50    cppadapter_include_path = Dir('CppAdapter', include_path)
51    
52    local_env.Install(include_path, headers )
53    local_env.Install(cppadapter_include_path, cppadapter_headers )
54    local_env.Install(libinstall, lib)
55    py_wrapper_local_env.Install(pyinstall+'/finley', py_wrapper_lib)
56    
57    # export the lib target since tests will depend on it
58    # the lib target is a list of file nodes (why? win32 produces more than one output file: .lib, .dll, .pdb)
59    # FIXME: This list handling produces the desired result but can this be done directly with scons File nodes?
60    dep_lib = [libinstall+'/'+str(x) for x in lib]
61    Export('dep_lib')
62    
63    # Call the python sconscript
64    env.SConscript(dirs = ['#/finley/py_src'], build_dir='py', duplicate=0)
65    
66  libname = 'finleycpp'  # Call the unit tests SConscript
67    local_env.SConscript(dirs = ['#/finley/test'], build_dir='#/build/$PLATFORM/finley/test', duplicate=0)
68    
 finley_path = Dir(str(esysroot) + '/finley/src')  
 finley_cppadapter_path = Dir(str(esysroot) + '/finley/src/CPPAdapter')  
 paso_path = Dir(str(esysroot) + '/paso/src')  
 escript_path = Dir(str(esysroot) + '/escript/src')  
 esysUtils_path = Dir(str(esysroot) + '/esysUtils/src')  
   
 esys_lib_path = Dir(str(esysroot) + '/lib')  
 esysUtils_lib_path = Dir(str(esysroot) + '/esysUtils/lib')  
   
 esysUtils_lib = str(esysUtils_lib_path) + '/libesysUtils.a'  
 escript_lib = str(esys_lib_path) + '/libescriptcpp.so'  
 paso_lib = str(esys_lib_path) + '/libpaso.a'  
   
 cpp_path = [finley_path,  
             finley_cppadapter_path,  
             paso_path,  
             escript_path,  
             esysUtils_path,  
             python_path,  
             papi_path,  
             boost_path]  
   
 incs = ['Assemble.h',  
         'ElementFile.h',  
         'Finley.h',  
         'FinleyVersion.h',  
         'IndexList.h',  
         'Mesh.h',  
         'NodeFile.h',  
         'Quadrature.h',  
         'RectangularMesh.h',  
         'ReferenceElements.h',  
         'ShapeFunctions.h',  
         'Util.h',  
 #        'vtkCellType.h',  
         'CPPAdapter/FinleyAdapterException.h',  
         'CPPAdapter/FinleyError.h',  
         'CPPAdapter/MeshAdapterFactory.h',  
         'CPPAdapter/MeshAdapter.h',  
         'CPPAdapter/SystemMatrixAdapter.h']  
   
 sources = ['Assemble_addToSystemMatrix.c',  
            'Assemble_CopyElementData.c',  
            'Assemble_CopyNodalData.c',  
            'Assemble_getAssembleParameters.c',  
            'Assemble_getSize.c',  
            'Assemble_gradient.c',  
            'Assemble_handelShapeMissMatch.c',  
            'Assemble_integrate.c',  
            'Assemble_interpolate.c',  
            'Assemble_NodeCoordinates.c',  
            'Assemble_PDE.c',  
            'Assemble_PDEMatrix_Single2.c',  
            'Assemble_PDEMatrix_System2.c',  
            'Assemble_PDE_RHS.c',  
            'Assemble_RHSMatrix_Single.c',  
            'Assemble_RHSMatrix_System.c',  
            'Assemble_RobinCondition.c',  
            'Assemble_RobinCondition_RHS.c',  
            'Assemble_setNormal.c',  
            'ElementFile_allocTable.c',  
            'ElementFile.c',  
            'ElementFile_copyTable.c',  
            'ElementFile_gather.c',  
            'ElementFile_improveColoring.c',  
            'ElementFile_markNodes.c',  
            'ElementFile_optimizeDistribution.c',  
            'ElementFile_prepare.c',  
            'ElementFile_relableNodes.c',  
            'ElementFile_scatter.c',  
            'ElementFile_setNodeRange.c',  
            'ElementFile_setCoordinates.c',  
            'Finley.c',  
            'IndexList.c',  
            'Mesh.c',  
            'Mesh_findMatchingFaces.c',  
            'Mesh_getPattern.c',  
            'Mesh_glueFaces.c',  
            'Mesh_hex20.c',  
            'Mesh_hex8.c',  
            'Mesh_joinFaces.c',  
            'Mesh_line2.c',  
            'Mesh_line3.c',  
            'Mesh_markNodes.c',  
            'Mesh_merge.c',  
            'Mesh_prepare.c',  
            'Mesh_prepareNodes.c',  
            'Mesh_print.c',  
            'Mesh_read.c',  
            'Mesh_rec4.c',  
            'Mesh_rec8.c',  
            'Mesh_relabelElementNodes.c',  
            'Mesh_resolveNodeIds.c',  
            'Mesh_saveDX.c',  
            'Mesh_saveVTK.c',  
            'Mesh_write.c',  
            'Mesh_setCoordinates.c',  
            'NodeFile_allocTable.c',  
            'NodeFile.c',  
            'NodeFile_copyTable.c',  
            'NodeFile_gatter.c',  
            'NodeFile_scatter.c',  
            'NodeFile_setCoordinates.c',  
            'NodeFile_setIdRange.c',  
            'Quadrature.c',  
            'ReferenceElements.c',  
            'ShapeFunctions.c',  
            'Util.c',  
            'CPPAdapter/FinleyError.cpp',  
            'CPPAdapter/MeshAdapter.cpp',  
            'CPPAdapter/MeshAdapterFactory.cpp',  
            'CPPAdapter/SystemMatrixAdapter.cpp',  
            'CPPAdapter/finleycpp.cpp']  
   
 lib_path = [esys_lib_path,  
             esysUtils_lib_path,  
             boost_lib_path,  
             papi_lib_path]  \  
           + solver_lib_paths  
   
 libs = ['escriptcpp',  
         'esysUtils',  
         'paso',  
         str(boost_lib),  
         'dl',  
         'util']     \  
        + sys_libs   \  
        + solver_libs \  
        + papi_libs  
   
 finley_env = Environment(ENV = os.environ)  
   
 finley_env.Replace(CC = cc)  
 finley_env.Replace(CXX = cxx)  
 finley_env.Replace(CCFLAGS = cc_flags)  
 finley_env.Replace(CXXFLAGS = cxx_flags)  
 finley_env.Replace(SHOBJSUFFIX = '.lo')  
 finley_env.Replace(CPPPATH = cpp_path)  
 finley_env.Replace(LIBPATH = lib_path)  
 finley_env.Replace(LIBS = libs)  
   
 finley_lib = finley_env.SharedLibrary(libname, sources)  
   
 Depends(finley_lib, esysUtils_lib)  
 Depends(finley_lib, escript_lib)  
 Depends(finley_lib, paso_lib)  
   
 Default(finley_env.Install(incdir, incs))  
 Default(finley_env.Install(incdir2, incs))  
 if incinstall != None:  
   Default(finley_env.Install(incinstall, incs))  
   
 Default(finley_env.Install(libdir, finley_lib))  
 Default(finley_env.Install(libdir2, finley_lib))  
 if libinstall != None:  
   Default(finley_env.Install(libinstall, finley_lib))  

Legend:
Removed from v.618  
changed lines
  Added in v.682

  ViewVC Help
Powered by ViewVC 1.1.26