/[escript]/branches/refine/SConstruct
ViewVC logotype

Diff of /branches/refine/SConstruct

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

revision 1235 by phornby, Mon Aug 13 00:25:29 2007 UTC revision 1243 by phornby, Mon Aug 13 06:48:37 2007 UTC
# Line 29  tools_prefix="/usr" Line 29  tools_prefix="/usr"
29  #      #    
30  #    get the installation prefix  #    get the installation prefix
31  #  #
32  prefix = ARGUMENTS.get('prefix', Dir('#.').abspath)  prefix = ARGUMENTS.get('prefix', '/usr')
33    
34  # We may also need to know where python's site-packages subdirectory lives  # We may also need to know where python's site-packages subdirectory lives
35  python_version = 'python%s.%s'%(sys.version_info[0],sys.version_info[1])  python_version = 'python%s.%s'%(sys.version_info[0],sys.version_info[1])
36    
37  if prefix == "/usr":  # Install as a standard python package in /usr/lib64 if available, else in /usr/lib
38     # Install as a standard python package in /usr/lib64 if available, else in /usr/lib  if os.path.isdir(  prefix+"/lib64/"+python_version+"/site-packages"):
39     if os.path.isdir(  prefix+"/lib64/"+python_version+"/site-packages"):     sys_dir_packages =  prefix+"/lib64/"+python_version+"/site-packages/esys"
40        dir_packages =  prefix+"/lib64/"+python_version+"/site-packages"     sys_dir_libraries = prefix+"/lib64"
41        dir_libraries = prefix+"/lib64"  else:
42     elif os.path.isdir(prefix+"/lib/"+python_version+"/site-packages"):     sys_dir_packages =  prefix+"/lib/"+python_version+"/site-packages/esys"
43        dir_packages =  prefix+"/lib/"+python_version+"/site-packages"     sys_dir_libraries = prefix+"/lib"
44        dir_libraries = prefix+"/lib"  
45     else:  sys_dir_examples = prefix+"/share/doc/esys"
       print "Install prefix is /usr but couldn't find python package directory in either"  
       print "/usr/lib64/"+python_version+"/site-packages or /usr/lib/"+python_version+"/site-packages"  
       sys.exit(1)  
    dir_examples = prefix+"/share/doc/esys"  
 else:  
    # Install using the usual escript directory structure  
    dir_packages = prefix  
    dir_libraries = prefix+"/lib"  
    dir_examples = prefix  
 dir_packages += "/esys"  
 dir_examples += "/examples"  
46    
47    source_root = Dir('#.').abspath
48    
49    dir_packages = os.path.join(source_root,"esys")
50    dir_examples = os.path.join(source_root,"examples")
51    dir_libraries = os.path.join(source_root,"lib")
52    
53    print " Default packages local installation:    ", dir_packages
54    print " Default library local installation  ", dir_libraries
55    print " Default example local  installation:    ", dir_examples
56  print "Install prefix is: ", prefix  print "Install prefix is: ", prefix
57  print " python packages will be installed in:   ", dir_packages  print " Default packages system installation:   ", sys_dir_packages
58  print " libraries will be installed in:     ", dir_libraries  print " Default library system installation     ", sys_dir_libraries
59  print " examples will be installed in:      ", dir_examples  print " Default example system installation:    ", sys_dir_examples
60    
61  #==============================================================================================      #==============================================================================================    
62    
# Line 166  opts.AddOptions( Line 164  opts.AddOptions(
164    ('libinstall', 'where the esys libraries will be installed',           dir_libraries),    ('libinstall', 'where the esys libraries will be installed',           dir_libraries),
165    ('pyinstall', 'where the esys python modules will be installed',       dir_packages),    ('pyinstall', 'where the esys python modules will be installed',       dir_packages),
166    ('exinstall', 'where the esys examples will be installed',             dir_examples),    ('exinstall', 'where the esys examples will be installed',             dir_examples),
167      ('sys_libinstall', 'where the system esys libraries will be installed',       sys_dir_libraries),
168      ('sys_pyinstall', 'where the system esys python modules will be installed',   sys_dir_packages),
169      ('sys_exinstall', 'where the system esys examples will be installed',         sys_dir_examples),
170    ('src_zipfile', 'the source zip file will be installed.',              Dir('#.').abspath+"/release/escript_src.zip"),    ('src_zipfile', 'the source zip file will be installed.',              Dir('#.').abspath+"/release/escript_src.zip"),
171    ('test_zipfile', 'the test zip file will be installed.',               Dir('#.').abspath+"/release/escript_tests.zip"),    ('test_zipfile', 'the test zip file will be installed.',               Dir('#.').abspath+"/release/escript_tests.zip"),
172    ('src_tarfile', 'the source tar file will be installed.',              Dir('#.').abspath+"/release/escript_src.tar.gz"),    ('src_tarfile', 'the source tar file will be installed.',              Dir('#.').abspath+"/release/escript_src.tar.gz"),
# Line 216  opts.AddOptions( Line 217  opts.AddOptions(
217    ('netCDF_libs', 'netCDF C++ libraries to link with', netCDF_libs_default),    ('netCDF_libs', 'netCDF C++ libraries to link with', netCDF_libs_default),
218  # Python  # Python
219  # locations of include files for python  # locations of include files for python
220    # FIXME: python_path should be python_inc_path and the same for boost etc.
221    PathOption('python_path', 'Path to Python includes', python_path_default),    PathOption('python_path', 'Path to Python includes', python_path_default),
222    PathOption('python_lib_path', 'Path to Python libs', python_lib_path_default),    PathOption('python_lib_path', 'Path to Python libs', python_lib_path_default),
223    ('python_lib', 'Python libraries to link with', python_lib_default),    ('python_lib', 'Python libraries to link with', python_lib_default),
224      ('python_cmd', 'Python command', 'python'),
225  # Boost  # Boost
226    PathOption('boost_path', 'Path to Boost includes', boost_path_default),    PathOption('boost_path', 'Path to Boost includes', boost_path_default),
227    PathOption('boost_lib_path', 'Path to Boost libs', boost_lib_path_default),    PathOption('boost_lib_path', 'Path to Boost libs', boost_lib_path_default),
# Line 261  Help(opts.GenerateHelpText(env)) Line 264  Help(opts.GenerateHelpText(env))
264  #     Initialise Scons Build Environment  #     Initialise Scons Build Environment
265  #     check for user environment variables we are interested in  #     check for user environment variables we are interested in
266  try:  try:
267     python_path = os.environ['PYTHONPATH']     tmp = os.environ['PYTHONPATH']
268     env['ENV']['PYTHONPATH'] = python_path     env['ENV']['PYTHONPATH'] = tmp
269  except KeyError:  except KeyError:
270     python_path = ''     pass
271    
272    env.PrependENVPath('PYTHONPATH', source_root)
273    
274  try:  try:
275     omp_num_threads = os.environ['OMP_NUM_THREADS']     omp_num_threads = os.environ['OMP_NUM_THREADS']
276  except KeyError:  except KeyError:
277     omp_num_threads = 1     omp_num_threads = 1
278    
279  env['ENV']['OMP_NUM_THREADS'] = omp_num_threads  env['ENV']['OMP_NUM_THREADS'] = omp_num_threads
280    
281  try:  try:
# Line 279  except KeyError: Line 285  except KeyError:
285     pass     pass
286    
287  try:  try:
288     path = os.environ['PATH']     tmp = os.environ['PATH']
289     env['ENV']['PATH'] = path     env['ENV']['PATH'] = tmp
290  except KeyError:  except KeyError:
291     path = ''     pass
292    
293  try:  try:
294     ld_library_path = os.environ['LD_LIBRARY_PATH']     tmp = os.environ['LD_LIBRARY_PATH']
295     env['ENV']['LD_LIBRARY_PATH'] = ld_library_path     env['ENV']['LD_LIBRARY_PATH'] = tmp
296  except KeyError:  except KeyError:
297     ld_library_path = ''     pass
298  #==========================================================================  #==========================================================================
299  #  #
300  #    Add some customer builders  #    Add some customer builders
# Line 295  except KeyError: Line 302  except KeyError:
302  py_builder = Builder(action = scons_extensions.build_py, suffix = '.pyc', src_suffix = '.py', single_source=True)  py_builder = Builder(action = scons_extensions.build_py, suffix = '.pyc', src_suffix = '.py', single_source=True)
303  env.Append(BUILDERS = {'PyCompile' : py_builder});  env.Append(BUILDERS = {'PyCompile' : py_builder});
304    
305  # TODO: use the inbuilt scons suffix variable.  # FIXME: use the inbuilt scons suffix variable.
306  if IS_WINDOWS_PLATFORM:  if IS_WINDOWS_PLATFORM:
307     runUnitTest_builder = Builder(action = scons_extensions.runUnitTest, suffix = '.passed', src_suffix='.exe', single_source=True)     runUnitTest_builder = Builder(action = scons_extensions.runUnitTest, suffix = '.passed', src_suffix='.exe', single_source=True)
308  else:  else:
# Line 322  except KeyError: Line 329  except KeyError:
329     libinstall = None     libinstall = None
330  try:  try:
331     pyinstall = env['pyinstall'] # all targets will install into pyinstall/esys but PYTHONPATH points at straight pyinstall so you go import esys.escript etc     pyinstall = env['pyinstall'] # all targets will install into pyinstall/esys but PYTHONPATH points at straight pyinstall so you go import esys.escript etc
    env.PrependENVPath('PYTHONPATH', env['pyinstall'])  
332  except KeyError:  except KeyError:
333     pyinstall = None     pyinstall = None
334  try:  try:
# Line 330  try: Line 336  try:
336  except KeyError:  except KeyError:
337     exinstall = None     exinstall = None
338  try:  try:
339       sys_libinstall = env['sys_libinstall']
340    except KeyError:
341       sys_libinstall = None
342    try:
343       sys_pyinstall = env['sys_pyinstall']
344    except KeyError:
345       sys_pyinstall = None
346    try:
347       sys_exinstall = env['sys_exinstall']
348    except KeyError:
349       sys_exinstall = None
350    try:
351     dodebug = env['dodebug']     dodebug = env['dodebug']
352  except KeyError:  except KeyError:
353     dodebug = None     dodebug = None
# Line 645  try: Line 663  try:
663  except KeyError:  except KeyError:
664     api_doxygen = None     api_doxygen = None
665    
666    
667    # FIXME: exinstall and friends related to examples are not working.
668    build_target = env.Alias('build',[libinstall,incinstall,pyinstall])
669    
670    env.Default(build_target)
671    
672  # Zipgets  # Zipgets
 env.Default(libinstall)  
 env.Default(incinstall)  
 env.Default(pyinstall)  
 ### env.Default(exinstall) # ksteube this causes dependency error  
673  env.Alias('release_src',[ src_zipfile, src_tarfile ])  env.Alias('release_src',[ src_zipfile, src_tarfile ])
674  env.Alias('release_tests',[ test_zipfile, test_tarfile])  env.Alias('release_tests',[ test_zipfile, test_tarfile])
675  env.Alias('release_examples',[ examples_zipfile, examples_tarfile])  env.Alias('release_examples',[ examples_zipfile, examples_tarfile])
# Line 661  env.Alias('guide_html_index',guide_html_ Line 681  env.Alias('guide_html_index',guide_html_
681  env.Alias('guide_pdf', guide_pdf)  env.Alias('guide_pdf', guide_pdf)
682  env.Alias('docs',[ 'release_examples', 'guide_pdf', api_epydoc, api_doxygen, guide_html_index])  env.Alias('docs',[ 'release_examples', 'guide_pdf', api_epydoc, api_doxygen, guide_html_index])
683  env.Alias('release', ['release_src', 'release_tests', 'docs'])  env.Alias('release', ['release_src', 'release_tests', 'docs'])
684    
685  env.Alias('build_tests')    # target to build all C++ tests  env.Alias('build_tests')    # target to build all C++ tests
686  env.Alias('build_py_tests') # target to build all python tests  env.Alias('build_py_tests') # target to build all python tests
687  env.Alias('build_all_tests', [ 'build_tests', 'build_py_tests' ] ) # target to build all python tests  env.Alias('build_all_tests', [ 'build_tests', 'build_py_tests' ] ) # target to build all python tests
# Line 710  env.SConscript(dirs = ['pycad/py_src'], Line 731  env.SConscript(dirs = ['pycad/py_src'],
731  # added by Ben Cumming  # added by Ben Cumming
732  env.SConscript(dirs = ['pythonMPI/src'], build_dir='build/$PLATFORM/pythonMPI', duplicate=0)  env.SConscript(dirs = ['pythonMPI/src'], build_dir='build/$PLATFORM/pythonMPI', duplicate=0)
733  #env.SConscript(dirs = ['../test'], build_dir='../test/build', duplicate=0)  #env.SConscript(dirs = ['../test'], build_dir='../test/build', duplicate=0)
734    
735    
736    syslib_install_target = env.installDirectory(sys_libinstall,libinstall)
737    syspy_install_target = env.installDirectory(sys_pyinstall,pyinstall,recursive=True)
738    
739    install_target = env.Alias("install", env.Flatten([syslib_install_target, syspy_install_target]) )

Legend:
Removed from v.1235  
changed lines
  Added in v.1243

  ViewVC Help
Powered by ViewVC 1.1.26