/[escript]/trunk/SConstruct
ViewVC logotype

Diff of /trunk/SConstruct

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

revision 690 by robwdcock, Tue Mar 28 07:18:51 2006 UTC revision 757 by woo409, Mon Jun 26 13:12:56 2006 UTC
# Line 15  Line 15 
15  EnsureSConsVersion(0,96,91)  EnsureSConsVersion(0,96,91)
16  EnsurePythonVersion(2,3)  EnsurePythonVersion(2,3)
17    
18    # import tools:
19    import glob
20  import sys, os  import sys, os
21  # Add our extensions  # Add our extensions
22  if sys.path.count('scons')==0: sys.path.append('scons')  if sys.path.count('scons')==0: sys.path.append('scons')
# Line 43  opts.AddOptions( Line 45  opts.AddOptions(
45    ('incinstall', 'where the esys headers will be installed', Dir('#.').abspath+'/include'),    ('incinstall', 'where the esys headers will be installed', Dir('#.').abspath+'/include'),
46    ('libinstall', 'where the esys libraries will be installed', Dir('#.').abspath+'/lib'),    ('libinstall', 'where the esys libraries will be installed', Dir('#.').abspath+'/lib'),
47    ('pyinstall', 'where the esys python modules will be installed', Dir('#.').abspath),    ('pyinstall', 'where the esys python modules will be installed', Dir('#.').abspath),
48      ('src_zipfile', 'the source zip file will be installed.', Dir('#.').abspath+"/release/escript_src.zip"),
49      ('test_zipfile', 'the test zip file will be installed.', Dir('#.').abspath+"/release/escript_tests.zip"),
50      ('src_tarfile', 'the source tar file will be installed.', Dir('#.').abspath+"/release/escript_src.tar.gz"),
51      ('test_tarfile', 'the test tar file will be installed.', Dir('#.').abspath+"/release/escript_tests.tar.gz"),
52      ('examples_tarfile', 'the examples tar file will be installed.', Dir('#.').abspath+"/release/doc/escript_examples.tar.gz"),
53      ('examples_zipfile', 'the examples zip file will be installed.', Dir('#.').abspath+"/release/doc/escript_examples.zip"),
54      ('guide_pdf', 'name of the user guide in pdf format', Dir('#.').abspath+"/release/doc/user/guide.pdf"),
55      ('api_epydoc', 'name of the epydoc api docs directory',Dir('#.').abspath+"/release/doc/epydoc"),
56      ('guide_html', 'name of the directory for user guide in html format', Dir('#.').abspath+"/release/doc/user/html"),
57  # Compilation options  # Compilation options
58    BoolOption('dodebug', 'Do you want a debug build?', 'yes'),    BoolOption('dodebug', 'Do you want a debug build?', 'no'),
59    ('options_file', "Optional file containing preferred options. Ignored if it doesn't exist (default: scons/hostname_options.py)", options_file),    ('options_file', "Optional file containing preferred options. Ignored if it doesn't exist (default: scons/hostname_options.py)", options_file),
60    ('cc_defines','C/C++ defines to use', None),    ('cc_defines','C/C++ defines to use', None),
61    ('cc_flags','C compiler flags to use (Release build)', None),    ('cc_flags','C compiler flags to use (Release build)', '-O3 -std=c99 -ffast-math -fpic -Wno-unknown-pragmas'),
62    ('cc_flags_debug', 'C compiler flags to use (Debug build)', None),    ('cc_flags_debug', 'C compiler flags to use (Debug build)', '-g -O0 -ffast-math -std=c99 -fpic -Wno-unknown-pragmas'),
63    ('cxx_flags', 'C++ compiler flags to use (Release build)', None),    ('cxx_flags', 'C++ compiler flags to use (Release build)', '--no-warn -ansi'),
64    ('cxx_flags_debug', 'C++ compiler flags to use (Debug build)', None),    ('cxx_flags_debug', 'C++ compiler flags to use (Debug build)', '--no-warn -ansi -DDOASSERT -DDOPROF'),
65    ('ar_flags', 'Static library archiver flags to use', None),    ('ar_flags', 'Static library archiver flags to use', None),
66    ('sys_libs', 'System libraries to link with', None),    ('sys_libs', 'System libraries to link with', None),
67      ('tar_flags','flags for zip files','-c -z'),
68  # MKL  # MKL
69    PathOption('mkl_path', 'Path to MKL includes', None),    PathOption('mkl_path', 'Path to MKL includes', None),
70    PathOption('mkl_lib_path', 'Path to MKL libs', None),    PathOption('mkl_lib_path', 'Path to MKL libs', None),
# Line 74  opts.AddOptions( Line 86  opts.AddOptions(
86    PathOption('boost_path', 'Path to Boost includes', '/usr/include'),    PathOption('boost_path', 'Path to Boost includes', '/usr/include'),
87    PathOption('boost_lib_path', 'Path to Boost libs', '/usr/lib'),    PathOption('boost_lib_path', 'Path to Boost libs', '/usr/lib'),
88    ('boost_lib', 'Boost libraries to link with', ['boost_python',]),    ('boost_lib', 'Boost libraries to link with', ['boost_python',]),
 # CppUnit  
   PathOption('cppunit_path', 'Path to CppUnit includes', Dir('#.').abspath+'/tools/CppUnitTest/inc'),  
   PathOption('cppunit_lib_path', 'Path to CppUnit libs', Dir('#.').abspath+'/lib'),  
   ('cppunit_lib', 'CppUnit libraries to link with', ['CppUnitTest',]),  
89  # Doc building  # Doc building
90    PathOption('doxygen_path', 'Path to Doxygen executable', None),  #  PathOption('doxygen_path', 'Path to Doxygen executable', None),
91    PathOption('epydoc_path', 'Path to Epydoc executable', None),  #  PathOption('epydoc_path', 'Path to Epydoc executable', None),
   PathOption('epydoc_pythonpath', 'Path to Epydoc python files', None),  
92  # PAPI  # PAPI
93    PathOption('papi_path', 'Path to PAPI includes', None),    PathOption('papi_path', 'Path to PAPI includes', None),
94    PathOption('papi_lib_path', 'Path to PAPI libs', None),    PathOption('papi_lib_path', 'Path to PAPI libs', None),
# Line 119  if os.name != "nt" and os.uname()[4]=='i Line 126  if os.name != "nt" and os.uname()[4]=='i
126     if env['CXX'] == 'icpc':     if env['CXX'] == 'icpc':
127        env['LINK'] = env['CXX'] # version >=9 of intel c++ compiler requires use of icpc to link in C++ runtimes (icc does not). FIXME: this behaviour could be directly incorporated into scons intelc.py        env['LINK'] = env['CXX'] # version >=9 of intel c++ compiler requires use of icpc to link in C++ runtimes (icc does not). FIXME: this behaviour could be directly incorporated into scons intelc.py
128  elif os.name == "nt":  elif os.name == "nt":
    # FIXME: Need to implement equivalent of ld library path for windoze  
129     env = Environment(tools = ['default', 'intelc'], options = opts)     env = Environment(tools = ['default', 'intelc'], options = opts)
130     env['ENV']['PYTHONPATH'] = python_path     env['ENV']['PYTHONPATH'] = python_path
131  else:  else:
# Line 154  try: Line 160  try:
160     libinstall = env['libinstall']     libinstall = env['libinstall']
161     env.Append(LIBPATH = [libinstall,])     env.Append(LIBPATH = [libinstall,])
162     env.PrependENVPath('LD_LIBRARY_PATH', libinstall)     env.PrependENVPath('LD_LIBRARY_PATH', libinstall)
163       if env['PLATFORM'] == "win32":
164          env.PrependENVPath('PATH', libinstall)
165          env.PrependENVPath('PATH', env['boost_lib_path'])
166  except KeyError:  except KeyError:
167     libinstall = None       libinstall = None  
168  try:  try:
# Line 167  except KeyError: Line 176  except KeyError:
176     dodebug = None       dodebug = None  
177  try:  try:
178     cc_defines = env['cc_defines']     cc_defines = env['cc_defines']
179     env.Append(CPPDEFINES = [cc_defines,])     env.Append(CPPDEFINES = cc_defines)
180  except KeyError:  except KeyError:
181     pass     pass
182  if dodebug:  if dodebug:
# Line 207  except KeyError: Line 216  except KeyError:
216     sys_libs = ''     sys_libs = ''
217    
218  try:  try:
219       tar_flags = env['tar_flags']
220       env.Replace(TARFLAGS = tar_flags)
221    except KeyError:
222       pass
223    
224    try:
225     includes = env['mkl_path']     includes = env['mkl_path']
226     env.Append(CPPPATH = [includes,])     env.Append(CPPPATH = [includes,])
227  except KeyError:  except KeyError:
228     pass     pass
229    
230  try:  try:
231     lib_path = env['mkl_lib_path']     lib_path = env['mkl_lib_path']
232     env.Append(LIBPATH = [lib_path,])     env.Append(LIBPATH = [lib_path,])
233  except KeyError:  except KeyError:
234     pass     pass
235    
236  try:  try:
237     mkl_libs = env['mkl_libs']     mkl_libs = env['mkl_libs']
238  except KeyError:  except KeyError:
# Line 263  try: Line 280  try:
280  except KeyError:  except KeyError:
281     boost_lib = None       boost_lib = None  
282  try:  try:
    includes = env['cppunit_path']  
    env.Append(CPPPATH = [includes,])  
 except KeyError:  
    pass  
 try:  
    lib_path = env['cppunit_lib_path']  
    env.Append(LIBPATH = [lib_path,])  
 except KeyError:  
    pass  
 try:  
    cppunit_lib = env['cppunit_lib']  
 except KeyError:  
    boost_lib = None    
 try:  
283     includes = env['python_path']     includes = env['python_path']
284     env.Append(CPPPATH = [includes,])     env.Append(CPPPATH = [includes,])
285  except KeyError:  except KeyError:
# Line 299  try: Line 302  try:
302  except KeyError:  except KeyError:
303     epydoc_path = None       epydoc_path = None  
304  try:  try:
    epydoc_pythonpath = env['epydoc_pythonpath']  
 except KeyError:  
    epydoc_pythonpath = None    
 try:  
305     includes = env['papi_path']     includes = env['papi_path']
306     env.Append(CPPPATH = [includes,])     env.Append(CPPPATH = [includes,])
307  except KeyError:  except KeyError:
# Line 317  try: Line 316  try:
316  except KeyError:  except KeyError:
317     papi_libs = None       papi_libs = None  
318    
319  # Targets  
320    try:
321       src_zipfile = env.File(env['src_zipfile'])
322    except KeyError:
323       src_zipfile = None  
324    try:
325       test_zipfile = env.File(env['test_zipfile'])
326    except KeyError:
327       test_zipfile = None  
328    try:
329       examples_zipfile = env.File(env['examples_zipfile'])
330    except KeyError:
331       examples_zipfile = None  
332    
333    try:
334       src_tarfile = env.File(env['src_tarfile'])
335    except KeyError:
336       src_tarfile = None  
337    try:
338       test_tarfile = env.File(env['test_tarfile'])
339    except KeyError:
340       test_tarfile = None  
341    try:
342       examples_tarfile = env.File(env['examples_tarfile'])
343    except KeyError:
344       examples_tarfile = None  
345    
346    try:
347       guide_pdf = env.File(env['guide_pdf'])
348    except KeyError:
349       guide_pdf = None  
350    
351    try:
352       guide_html_index = env.File('index.htm',env['guide_html'])
353    except KeyError:
354       guide_html_index = None  
355    
356    try:
357       api_epydoc = env.Dir(env['api_epydoc'])
358    except KeyError:
359       api_epydoc = None  
360    
361    # Zipgets
362      
363  env.Default(libinstall)  env.Default(libinstall)
364  env.Default(incinstall)  env.Default(incinstall)
365  env.Default(pyinstall)  env.Default(pyinstall)
366  env.Alias('build_tests')  env.Alias('release_src',[ src_zipfile, src_tarfile ])  
367  env.Alias('run_tests')  env.Alias('release_tests',[ test_zipfile, test_tarfile])
368  env.Alias('py_tests')  env.Alias('release_examples',[ examples_zipfile, examples_tarfile])
369  env.Alias('basic_py_tests')  env.Alias('api_epydoc',api_epydoc)
370  env.Alias('all_tests', ['run_tests', 'py_tests'])  env.Alias('docs',[ 'release_examples', guide_pdf, guide_html_index, api_epydoc])
371    env.Alias('release', ['release_src', 'release_tests', 'docs'])
372    env.Alias('build_tests')    # target to build all C++ tests
373    env.Alias('build_py_tests') # target to build all python tests
374    env.Alias('build_all_tests', [ 'build_tests', 'build_py_tests' ] ) # target to build all python tests
375    env.Alias('run_tests', 'build_tests')   # target to run all C++ test
376    env.Alias('py_tests', 'build_py_tests') # taget to run all released python tests
377    env.Alias('all_tests', ['run_tests', 'py_tests']) # target to run all C++ and released python tests
378    
379  # Python install - esys __init__.py  # Python install - esys __init__.py
380  # This is just an empty file but stills need to be touched so add a special target and Command. Note you can't use the scons Touch() function as it will not  init_target = env.Command(pyinstall+'/__init__.py', None, Touch('$TARGET'))
381  # create the file if it doesn't exist  env.Alias(init_target)
 env.Command('esys/__init__.py', None, 'touch $TARGET')  
382    
383  # Allow sconscripts to see the env  # Allow sconscripts to see the env
384  Export(["env", "incinstall", "libinstall", "pyinstall", "dodebug", "mkl_libs", "scsl_libs", "umf_libs",  Export(["env", "incinstall", "libinstall", "pyinstall", "dodebug", "mkl_libs", "scsl_libs", "umf_libs",
385      "boost_lib", "python_lib", "doxygen_path", "epydoc_path", "epydoc_pythonpath", "papi_libs", "cppunit_lib", "sys_libs" ])      "boost_lib", "python_lib", "doxygen_path", "epydoc_path", "papi_libs",
386            "sys_libs", "test_zipfile", "src_zipfile", "test_tarfile", "src_tarfile", "examples_tarfile", "examples_zipfile",
387            "guide_pdf", "guide_html_index", "api_epydoc"])
388    
389  # End initialisation section  # End initialisation section
390  # Begin configuration section  # Begin configuration section
391    # adds this file and the scons option directore to the source tar
392    release_srcfiles=[env.File('SConstruct'),]+[ env.File(x) for x in glob.glob('scons/*.py') ]
393    release_testfiles=[env.File('README_TESTS'),]
394    env.Zip(src_zipfile, release_srcfiles)
395    env.Zip(test_zipfile, release_testfiles)
396    env.Tar(src_tarfile, release_srcfiles)
397    env.Tar(test_tarfile, release_testfiles)
398    
399  # Insert new components to be build here  # Insert new components to be build here
400  # FIXME: might be nice to replace this verbosity with a list of targets and some  # FIXME: might be nice to replace this verbosity with a list of targets and some
401  # FIXME: nifty python to create the lengthy but very similar env.Sconscript lines  # FIXME: nifty python to create the lengthy but very similar env.Sconscript lines
# Line 350  env.SConscript(dirs = ['escript/src'], b Line 408  env.SConscript(dirs = ['escript/src'], b
408  env.SConscript(dirs = ['esysUtils/src'], build_dir='build/$PLATFORM/esysUtils', duplicate=0)  env.SConscript(dirs = ['esysUtils/src'], build_dir='build/$PLATFORM/esysUtils', duplicate=0)
409  env.SConscript(dirs = ['finley/src'], build_dir='build/$PLATFORM/finley', duplicate=0)  env.SConscript(dirs = ['finley/src'], build_dir='build/$PLATFORM/finley', duplicate=0)
410  env.SConscript(dirs = ['modellib/py_src'], build_dir='build/$PLATFORM/modellib', duplicate=0)  env.SConscript(dirs = ['modellib/py_src'], build_dir='build/$PLATFORM/modellib', duplicate=0)
411    env.SConscript(dirs = ['doc'], build_dir='build/$PLATFORM/doc', duplicate=0)
412    env.SConscript(dirs = ['pyvisi/py_src'], build_dir='build/$PLATFORM/pyvisi', duplicate=0)
413    
414  # FIXME:need to be incorporated into build system  # added by Ben Cumming
415  # FIXME: 'pyvisi/SConstruct']  env.SConscript(dirs = ['pythonMPI/src'], build_dir='build/$PLATFORM/pythonMPI', duplicate=0)
 # FIXME: 'doc/SConstruct']  
 # FIXME: 'doc/SConstruct']  

Legend:
Removed from v.690  
changed lines
  Added in v.757

  ViewVC Help
Powered by ViewVC 1.1.26