/[escript]/branches/domexper/dudley/src/SConscript
ViewVC logotype

Diff of /branches/domexper/dudley/src/SConscript

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

revision 3250 by jfenwick, Wed Sep 29 00:33:16 2010 UTC revision 3251 by jfenwick, Thu Oct 7 04:02:30 2010 UTC
# Line 16  Line 16 
16  import os  import os
17  Import('*')  Import('*')
18    
19  local_env = clone_env(env_mpi)  local_env = env_mpi.Clone()
20  py_wrapper_local_env = clone_env(env_mpi)  py_wrapper_local_env = env_mpi.Clone()
21  local_unroll_env = clone_env(env_mpi)  local_unroll_env = env_mpi.Clone()
22  local_unroll_env.Append(CFLAGS = env_mpi['dudley_assemble_flags'])  local_unroll_env.Append(CFLAGS = env_mpi['dudley_assemble_flags'])
23    
24    
# Line 132  cppadapter_headers = """ Line 132  cppadapter_headers = """
132      CPPAdapter/system_dep.h      CPPAdapter/system_dep.h
133  """.split()  """.split()
134    
135  local_env.Append(LIBS = ['escript', 'esysUtils', 'paso'] + env['sys_libs'] )  local_env.Append(LIBS = ['escript', 'esysUtils', 'paso'])
136    
137  if IS_WINDOWS_PLATFORM :  if IS_WINDOWS :
138    local_env.Append(CPPDEFINES = ['DUDLEY_EXPORTS'])    local_env.Append(CPPDEFINES = ['DUDLEY_EXPORTS'])
139    
 py_wrapper_local_env.Append(LIBS = ['dudley', 'escript', 'esysUtils', 'paso'] + env['sys_libs'] )  
   
140  module_name = 'dudley'  module_name = 'dudley'
 py_wrapper_name = module_name + 'cpp'  
141    
142  un = [ local_unroll_env.SharedObject(x) for x in unroll_sources]  un = [ local_unroll_env.SharedObject(x) for x in unroll_sources]
143    
144  lib = local_env.SharedLibrary(module_name, sources+un)  lib = local_env.SharedLibrary(module_name, sources+un)
145  env.Alias('target_dudley_so', lib)  env.Alias('build_dudley_lib', lib)
   
 py_wrapper_lib = py_wrapper_local_env.SharedLibrary(py_wrapper_name, 'CPPAdapter/dudleycpp.cpp')  
 env.Alias('target_dudleycpp_so', py_wrapper_lib)  
146    
147  include_path = Dir('dudley', local_env['incinstall'])  include_path = Dir('dudley', local_env['incinstall'])
148  cppadapter_include_path = Dir('CppAdapter', include_path)  cppadapter_include_path = Dir('CppAdapter', include_path)
149    
150  tmp1 = local_env.Install(include_path, headers )  hdr_inst1 = local_env.Install(include_path, headers )
151  tmp2 = local_env.Install(cppadapter_include_path, cppadapter_headers )  hdr_inst2 = local_env.Install(cppadapter_include_path, cppadapter_headers )
152  env.Alias('target_install_dudley_headers', [tmp1, tmp2])  env.Alias('install_dudley_headers', [hdr_inst1, hdr_inst2])
   
 tmp3 = local_env.Install(local_env['libinstall'], lib)  
 env.Alias('target_install_dudley_so', tmp3)  
   
 #windows specific mod  
 tmp_inst = os.path.join(local_env['pyinstall'],module_name)  
 if os.name == 'nt':  
   wrapper_postfix = '.pyd'  
 else:  
   wrapper_postfix = '.so'  
153    
154  share_name = os.path.join(tmp_inst,py_wrapper_name+wrapper_postfix)  lib_inst = local_env.Install(local_env['libinstall'], lib)
155    env.Alias('install_dudley_lib', lib_inst)
156    
157  tmp4 = py_wrapper_local_env.InstallAs(target=share_name,  ### Python wrapper ###
158                                        source=py_wrapper_lib[0])  py_wrapper_local_env.Append(LIBS = ['dudley', 'escript', 'esysUtils', 'paso'])
159    py_wrapper_name = module_name + 'cpp'
160  env.Alias('target_install_dudleycpp_so', tmp4)  py_wrapper_lib = py_wrapper_local_env.SharedLibrary(py_wrapper_name, 'CPPAdapter/dudleycpp.cpp')
161    env.Alias('build_dudleycpp_lib', py_wrapper_lib)
162    
163  # export the lib target since tests will depend on it  tmp_inst = os.path.join(local_env['pyinstall'], module_name)
164  # the lib target is a list of file nodes (why? win32 produces more than one output file: .lib, .dll, .pdb)  if IS_WINDOWS:
165  # FIXME: This list handling produces the desired result but can this be done directly with scons File nodes?      wrapper_ext = '.pyd'
166  dep_lib = [local_env['libinstall']+'/'+str(x) for x in lib]  else:
167  Export('dep_lib')      wrapper_ext = '.so'
168    
169  # Call the python sconscript  share_name = os.path.join(tmp_inst, py_wrapper_name+wrapper_ext)
170  CallSConscript(env,dirs = ['#/dudley/py_src'], variant_dir='py', duplicate=0)  mod_inst = py_wrapper_local_env.InstallAs(target=share_name,
171                                              source=py_wrapper_lib[0])
172    env.Alias('install_dudleycpp_lib', mod_inst)
173    
174  # Call the unit tests SConscript  # configure python module
175  CallSConscript(local_env,dirs = ['#/dudley/test'], variant_dir='#/build/$PLATFORM/dudley/test', duplicate=0)  local_env.SConscript(dirs = ['#/dudley/py_src'], variant_dir='py', duplicate=0)
176    
177    # configure unit tests
178    local_env.SConscript(dirs = ['#/dudley/test'], variant_dir='#/build/$PLATFORM/dudley/test', duplicate=0, exports=['py_wrapper_lib'])

Legend:
Removed from v.3250  
changed lines
  Added in v.3251

  ViewVC Help
Powered by ViewVC 1.1.26