/[escript]/trunk/SConstruct
ViewVC logotype

Diff of /trunk/SConstruct

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

revision 898 by gross, Sun Nov 12 23:56:26 2006 UTC revision 1246 by phornby, Mon Aug 13 22:09:00 2007 UTC
# Line 1  Line 1 
1  #          Copyright 2006 by ACcESS MNRF  #         Copyright 2006 by ACcESS MNRF
2  #  #
3  #              http://www.access.edu.au  #              http://www.access.edu.au
4  #       Primary Business: Queensland, Australia  #       Primary Business: Queensland, Australia
5  #  Licensed under the Open Software License version 3.0  #  Licensed under the Open Software License version 3.0
6  #     http://www.opensource.org/licenses/osl-3.0.php  #     http://www.opensource.org/licenses/osl-3.0.php
 #  
 #  
 #  
7    
8  # top-level Scons configuration file for all esys13 modules  # top-level Scons configuration file for all esys13 modules
9  # Begin initialisation Section  # Begin initialisation Section
# Line 15  Line 12 
12  EnsureSConsVersion(0,96,91)  EnsureSConsVersion(0,96,91)
13  EnsurePythonVersion(2,3)  EnsurePythonVersion(2,3)
14    
15  # import tools:  #===============================================================
16    #   import tools:
17  import glob  import glob
18  import sys, os  import sys, os
 import socket  
19  # Add our extensions  # Add our extensions
20  if sys.path.count('scons')==0: sys.path.append('scons')  if sys.path.count('scons')==0: sys.path.append('scons')
21  import scons_extensions  import scons_extensions
22    
23  # check if UMFPACK is installed on the system:  #===============================================================
 if os.path.isdir('/opt/UMFPACK/Include') and os.path.isdir('/opt/UMFPACK/Lib'):  
    umf_path_default='/opt/UMFPACK/Include'  
    umf_lib_path_default='/opt/UMFPACK/Lib'  
    umf_libs_default=['umfpack']  
 else:  
    umf_path_default=None  
    umf_lib_path_default=None  
    umf_libs_default=None  
24    
25  if os.path.isdir('/opt/AMD/Include') and os.path.isdir('/opt/AMD/Lib'):  tools_prefix="/usr"
26     amd_path_default='/opt/AMD/Include'  
27     amd_lib_path_default='/opt/AMD/Lib'  #==============================================================================================    
28     amd_libs_default=['amd']  #    
29  else:  #    get the installation prefix
30     amd_path_default=None  #
31     amd_lib_path_default=None  prefix = ARGUMENTS.get('prefix', '/usr')
32     amd_libs_default=None  
33    # We may also need to know where python's site-packages subdirectory lives
34    python_version = 'python%s.%s'%(sys.version_info[0],sys.version_info[1])
35    
36  if os.path.isdir('/opt/UFconfig'):  # Install as a standard python package in /usr/lib64 if available, else in /usr/lib
37     ufc_path_default='/opt/UFconfig'  if os.path.isdir(  prefix+"/lib64/"+python_version+"/site-packages"):
38       sys_dir_packages =  prefix+"/lib64/"+python_version+"/site-packages/esys"
39       sys_dir_libraries = prefix+"/lib64"
40  else:  else:
41     ufc_path_default=None     sys_dir_packages =  prefix+"/lib/"+python_version+"/site-packages/esys"
42       sys_dir_libraries = prefix+"/lib"
43    
44    sys_dir_examples = prefix+"/share/doc/esys"
45    
46    source_root = Dir('#.').abspath
47    
48    dir_packages = os.path.join(source_root,"esys")
49    dir_examples = os.path.join(source_root,"examples")
50    dir_libraries = os.path.join(source_root,"lib")
51    
52    print " Default packages local installation:    ", dir_packages
53    print " Default library local installation  ", dir_libraries
54    print " Default example local  installation:    ", dir_examples
55    print "Install prefix is: ", prefix
56    print " Default packages system installation:   ", sys_dir_packages
57    print " Default library system installation     ", sys_dir_libraries
58    print " Default example system installation:    ", sys_dir_examples
59    
60    #==============================================================================================    
61    
62  # Default options and options help text  # Default options and options help text
63  # These are defaults and can be overridden using command line arguments or an options file.  # These are defaults and can be overridden using command line arguments or an options file.
64  # if the options_file or ARGUMENTS do not exist then the ones listed as default here are used  # if the options_file or ARGUMENTS do not exist then the ones listed as default here are used
65  # DO NOT CHANGE THEM HERE  # DO NOT CHANGE THEM HERE
66  if ARGUMENTS.get('options_file',0):  # Where to install?
67     options_file = ARGUMENTS.get('options_file',0)  #==============================================================================================    
68  else:  #    
69    #    get the options file if present:
70    #
71    options_file = ARGUMENTS.get('options_file','')
72    
73    if not os.path.isfile(options_file) :
74        options_file = False
75    
76    if not options_file :
77       import socket
78     from string import ascii_letters,digits     from string import ascii_letters,digits
79     hostname=""     hostname=""
80     for s in socket.gethostname().split('.')[0]:     for s in socket.gethostname().split('.')[0]:
# Line 61  else: Line 82  else:
82           hostname+=s           hostname+=s
83        else:        else:
84           hostname+="_"           hostname+="_"
85     options_file = "scons/"+hostname+"_options.py"     tmp = os.path.join("scons",hostname+"_options.py")
86    
87       if os.path.isfile(tmp) :
88          options_file = tmp
89    
90    IS_WINDOWS_PLATFORM = (os.name== "nt")
91    
92    # If you're not going to tell me then......
93    # FIXME: add one for the altix too.
94    if not options_file :
95       if IS_WINDOWS_PLATFORM :
96          options_file = "scons/windows_mscv71_options.py"
97       else:
98          options_file = "scons/linux_gcc_eg_options.py"
99    
100    # and load it
101  opts = Options(options_file, ARGUMENTS)  opts = Options(options_file, ARGUMENTS)
102    #================================================================
103    #
104    #   check if UMFPACK is installed on the system:
105    #
106    uf_root=None
107    for i in [ 'UMFPACK', 'umfpack', 'ufsparse', 'UFSPARSE']:
108       if os.path.isdir(os.path.join(tools_prefix,'include',i)):
109           uf_root=i
110           print i," is used form ",tools_prefix
111           break
112    if not uf_root==None:
113       umf_path_default=os.path.join(tools_prefix,'include',uf_root)
114       umf_lib_path_default=os.path.join(tools_prefix,'lib')
115       umf_libs_default=['umfpack']
116       amd_path_default=os.path.join(tools_prefix,'include',uf_root)
117       amd_lib_path_default=os.path.join(tools_prefix,'lib')
118       amd_libs_default=['amd']
119       ufc_path_default=os.path.join(tools_prefix,'include',uf_root)
120    else:
121       umf_path_default=None
122       umf_lib_path_default=None
123       umf_libs_default=None
124       amd_path_default=None
125       amd_lib_path_default=None
126       amd_libs_default=None
127       ufc_path_default=None
128    #
129    #==========================================================================
130    #
131    #    python installation:
132    #
133    python_path_default=os.path.join(tools_prefix,'include','python%s.%s'%(sys.version_info[0],sys.version_info[1]))
134    python_lib_path_default=os.path.join(tools_prefix,'lib')
135    python_lib_default="python%s.%s"%(sys.version_info[0],sys.version_info[1])
136    
137    #==========================================================================
138    #
139    #    boost installation:
140    #
141    boost_path_default=os.path.join(tools_prefix,'include')
142    boost_lib_path_default=os.path.join(tools_prefix,'lib')
143    boost_lib_default=['boost_python']
144    #==========================================================================
145    #
146    #    check if netCDF is installed on the system:
147    #
148    netCDF_path_default=os.path.join(tools_prefix,'include','netcdf-3')
149    netCDF_lib_path_default=os.path.join(tools_prefix,'lib','netcdf-3')
150    
151    if os.path.isdir(netCDF_path_default) and os.path.isdir(netCDF_lib_path_default):
152         useNetCDF_default='yes'
153         netCDF_libs_default=[ 'netcdf_c++', 'netcdf' ]
154    else:
155         useNetCDF_default='no'
156         netCDF_path_default=None
157         netCDF_lib_path_default=None
158         netCDF_libs_default=None
159    
160    #==========================================================================
161    #
162    #    compile:
163    #
164    cc_flags_default='-O3 -std=c99 -ffast-math -fpic -Wno-unknown-pragmas -ansi -pedantic-errors'
165    cc_flags_debug_default='-g -O0 -ffast-math -std=c99 -fpic -Wno-unknown-pragmas -ansi -pedantic-errors'
166    cxx_flags_default='--no-warn -ansi'
167    cxx_flags_debug_default='--no-warn -ansi -DDOASSERT'
168    #==============================================================================================    
169    # Default options and options help text
170    # These are defaults and can be overridden using command line arguments or an options file.
171    # if the options_file or ARGUMENTS do not exist then the ones listed as default here are used
172    # DO NOT CHANGE THEM HERE
173  opts.AddOptions(  opts.AddOptions(
174  # Where to install esys stuff  # Where to install esys stuff
175    ('incinstall', 'where the esys headers will be installed', Dir('#.').abspath+'/include'),    ('incinstall', 'where the esys headers will be installed',             Dir('#.').abspath+'/include'),
176    ('libinstall', 'where the esys libraries will be installed', Dir('#.').abspath+'/lib'),    ('libinstall', 'where the esys libraries will be installed',           dir_libraries),
177    ('pyinstall', 'where the esys python modules will be installed', Dir('#.').abspath),    ('pyinstall', 'where the esys python modules will be installed',       dir_packages),
178    ('src_zipfile', 'the source zip file will be installed.', Dir('#.').abspath+"/release/escript_src.zip"),    ('exinstall', 'where the esys examples will be installed',             dir_examples),
179    ('test_zipfile', 'the test zip file will be installed.', Dir('#.').abspath+"/release/escript_tests.zip"),    ('sys_libinstall', 'where the system esys libraries will be installed',       sys_dir_libraries),
180    ('src_tarfile', 'the source tar file will be installed.', Dir('#.').abspath+"/release/escript_src.tar.gz"),    ('sys_pyinstall', 'where the system esys python modules will be installed',   sys_dir_packages),
181    ('test_tarfile', 'the test tar file will be installed.', Dir('#.').abspath+"/release/escript_tests.tar.gz"),    ('sys_exinstall', 'where the system esys examples will be installed',         sys_dir_examples),
182    ('examples_tarfile', 'the examples tar file will be installed.', Dir('#.').abspath+"/release/doc/escript_examples.tar.gz"),    ('src_zipfile', 'the source zip file will be installed.',              Dir('#.').abspath+"/release/escript_src.zip"),
183    ('examples_zipfile', 'the examples zip file will be installed.', Dir('#.').abspath+"/release/doc/escript_examples.zip"),    ('test_zipfile', 'the test zip file will be installed.',               Dir('#.').abspath+"/release/escript_tests.zip"),
184    ('guide_pdf', 'name of the user guide in pdf format', Dir('#.').abspath+"/release/doc/user/guide.pdf"),    ('src_tarfile', 'the source tar file will be installed.',              Dir('#.').abspath+"/release/escript_src.tar.gz"),
185    ('api_epydoc', 'name of the epydoc api docs directory',Dir('#.').abspath+"/release/doc/epydoc"),    ('test_tarfile', 'the test tar file will be installed.',               Dir('#.').abspath+"/release/escript_tests.tar.gz"),
186    ('guide_html', 'name of the directory for user guide in html format', Dir('#.').abspath+"/release/doc/user/html"),    ('examples_tarfile', 'the examples tar file will be installed.',       Dir('#.').abspath+"/release/doc/escript_examples.tar.gz"),
187      ('examples_zipfile', 'the examples zip file will be installed.',       Dir('#.').abspath+"/release/doc/escript_examples.zip"),
188      ('guide_pdf', 'name of the user guide in pdf format',                  Dir('#.').abspath+"/release/doc/user/guide.pdf"),
189      ('api_epydoc', 'name of the epydoc api docs directory',                Dir('#.').abspath+"/release/doc/epydoc"),
190      ('guide_html', 'name of the directory for user guide in html format',  Dir('#.').abspath+"/release/doc/user/html"),
191      ('api_doxygen', 'name of the doxygen api docs directory',prefix+"/release/doc/doxygen"),
192  # Compilation options  # Compilation options
193    BoolOption('dodebug', 'Do you want a debug build?', 'no'),    BoolOption('dodebug', 'Do you want a debug build?', 'no'),
194    ('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),
195    ('cc_defines','C/C++ defines to use', None),    ('cc_defines','C/C++ defines to use', None),
196    ('cc_flags','C compiler flags to use (Release build)', '-O3 -std=c99 -ffast-math -fpic -Wno-unknown-pragmas'),    ('cc_flags','C compiler flags to use (Release build)', cc_flags_default),
197    ('cc_flags_debug', 'C compiler flags to use (Debug build)', '-g -O0 -ffast-math -std=c99 -fpic -Wno-unknown-pragmas'),    ('cc_flags_debug', 'C compiler flags to use (Debug build)', cc_flags_debug_default),
198    ('cxx_flags', 'C++ compiler flags to use (Release build)', '--no-warn -ansi'),    ('cxx_flags', 'C++ compiler flags to use (Release build)', cxx_flags_default),
199    ('cxx_flags_debug', 'C++ compiler flags to use (Debug build)', '--no-warn -ansi -DDOASSERT -DDOPROF'),    ('cxx_flags_debug', 'C++ compiler flags to use (Debug build)', cxx_flags_debug_default),
   ('cc_flags_MPI','C compiler flags to use (Release MPI build)', '-O3 -ftz -IPF_ftlacc- -IPF_fma -fno-alias -fno-alias -c99 -w1 -fpic -wd161'),  
   ('cc_flags_debug_MPI', 'C compiler flags to use (Debug MPI build)', '-g -O0 -c99 -w1 -fpic -wd161'),  
   ('cxx_flags_MPI', 'C++ compiler flags to use (Release MPI build)', '-ansi -wd1563 -wd161'),  
   ('cxx_flags_debug_MPI', 'C++ compiler flags to use (Debug MPI build)', '-ansi -DDOASSERT -DDOPROF -wd1563 -wd161'),  
200    ('ar_flags', 'Static library archiver flags to use', None),    ('ar_flags', 'Static library archiver flags to use', None),
201    ('sys_libs', 'System libraries to link with', None),    ('sys_libs', 'System libraries to link with', None),
202    ('tar_flags','flags for zip files','-c -z'),    ('tar_flags','flags for zip files','-c -z'),
# Line 115  opts.AddOptions( Line 222  opts.AddOptions(
222    PathOption('blas_path', 'Path to BLAS includes', None),    PathOption('blas_path', 'Path to BLAS includes', None),
223    PathOption('blas_lib_path', 'Path to BLAS libs', None),    PathOption('blas_lib_path', 'Path to BLAS libs', None),
224    ('blas_libs', 'BLAS libraries to link with', None),    ('blas_libs', 'BLAS libraries to link with', None),
225    # netCDF
226      ('useNetCDF', 'switch on/off the usage of netCDF', useNetCDF_default),
227      PathOption('netCDF_path', 'Path to netCDF includes', netCDF_path_default),
228      PathOption('netCDF_lib_path', 'Path to netCDF libs', netCDF_lib_path_default),
229      ('netCDF_libs', 'netCDF C++ libraries to link with', netCDF_libs_default),
230  # Python  # Python
231  # locations of include files for python  # locations of include files for python
232    PathOption('python_path', 'Path to Python includes', '/usr/include/python%s.%s'%(sys.version_info[0],sys.version_info[1])),  # FIXME: python_path should be python_inc_path and the same for boost etc.
233    PathOption('python_lib_path', 'Path to Python libs', '/usr/lib'),    PathOption('python_path', 'Path to Python includes', python_path_default),
234    ('python_lib', 'Python libraries to link with', ["python%s.%s"%(sys.version_info[0],sys.version_info[1]),]),    PathOption('python_lib_path', 'Path to Python libs', python_lib_path_default),
235      ('python_lib', 'Python libraries to link with', python_lib_default),
236      ('python_cmd', 'Python command', 'python'),
237  # Boost  # Boost
238    PathOption('boost_path', 'Path to Boost includes', '/usr/include'),    PathOption('boost_path', 'Path to Boost includes', boost_path_default),
239    PathOption('boost_lib_path', 'Path to Boost libs', '/usr/lib'),    PathOption('boost_lib_path', 'Path to Boost libs', boost_lib_path_default),
240    ('boost_lib', 'Boost libraries to link with', ['boost_python',]),    ('boost_lib', 'Boost libraries to link with', boost_lib_default),
241  # Doc building  # Doc building
242  #  PathOption('doxygen_path', 'Path to Doxygen executable', None),  #  PathOption('doxygen_path', 'Path to Doxygen executable', None),
243  #  PathOption('epydoc_path', 'Path to Epydoc executable', None),  #  PathOption('epydoc_path', 'Path to Epydoc executable', None),
# Line 134  opts.AddOptions( Line 248  opts.AddOptions(
248  # MPI  # MPI
249    BoolOption('useMPI', 'Compile parallel version using MPI', 'no'),    BoolOption('useMPI', 'Compile parallel version using MPI', 'no'),
250  )  )
251    #=================================================================================================
252    #
253    #   Note: On the Altix the intel compilers are not automatically
254    #   detected by scons intelc.py script. The Altix has a different directory
255    #   path and in some locations the "modules" facility is used to support
256    #   multiple compiler versions. This forces the need to import the users PATH
257    #   environment which isn't the "scons way"
258    #   This doesn't impact linux and windows which will use the default compiler (g++ or msvc, or the intel compiler if it is installed on both platforms)
259    #   FIXME: Perhaps a modification to intelc.py will allow better support for ia64 on altix
260    #
261    
262    if IS_WINDOWS_PLATFORM:
263          env = Environment(tools = ['default', 'msvc'], options = opts)
264    else:
265       if os.uname()[4]=='ia64':
266          env = Environment(tools = ['default', 'intelc'], options = opts)
267          if env['CXX'] == 'icpc':
268             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
269       else:
270          env = Environment(tools = ['default'], options = opts)
271    Help(opts.GenerateHelpText(env))
272    
273  # Initialise Scons Build Environment  #=================================================================================================
274  # check for user environment variables we are interested in  #
275    #     Initialise Scons Build Environment
276    #     check for user environment variables we are interested in
277  try:  try:
278     python_path = os.environ['PYTHONPATH']     tmp = os.environ['PYTHONPATH']
279       env['ENV']['PYTHONPATH'] = tmp
280  except KeyError:  except KeyError:
281     python_path = ''     pass
282    
283    env.PrependENVPath('PYTHONPATH', source_root)
284    
285  try:  try:
286     path = os.environ['PATH']     omp_num_threads = os.environ['OMP_NUM_THREADS']
287  except KeyError:  except KeyError:
288     path = ''     omp_num_threads = 1
 try:  
    ld_library_path = os.environ['LD_LIBRARY_PATH']  
 except KeyError:  
    ld_library_path = ''  
   
 # Note: On the Altix the intel compilers are not automatically  
 # detected by scons intelc.py script. The Altix has a different directory  
 # path and in some locations the "modules" facility is used to support  
 # multiple compiler versions. This forces the need to import the users PATH  
 # environment which isn't the "scons way"  
 # This doesn't impact linux and windows which will use the default compiler (g++ or msvc, or the intel compiler if it is installed on both platforms)  
 # FIXME: Perhaps a modification to intelc.py will allow better support for ia64 on altix  
   
 if os.name != "nt" and os.uname()[4]=='ia64':  
    env = Environment(ENV = {'PATH':path}, tools = ['default', 'intelc'], options = opts)  
    env['ENV']['PATH'] = path  
    env['ENV']['LD_LIBRARY_PATH'] = ld_library_path  
    env['ENV']['PYTHONPATH'] = python_path  
    if env['CXX'] == 'icpc':  
       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  
 elif os.name == "nt":  
    env = Environment(tools = ['default', 'intelc'], options = opts)  
    env['ENV']['PYTHONPATH'] = python_path  
 else:  
    env = Environment(tools = ['default'], options = opts)  
    env['ENV']['PATH'] = path  
    env['ENV']['LD_LIBRARY_PATH'] = ld_library_path  
    env['ENV']['PYTHONPATH'] = python_path  
289    
290  # Setup help for options  env['ENV']['OMP_NUM_THREADS'] = omp_num_threads
291  Help(opts.GenerateHelpText(env))  
292    try:
293       env['ENV']['DISPLAY'] = os.environ['DISPLAY']
294       env['ENV']['XAUTHORITY'] = os.environ['XAUTHORITY']
295    except KeyError:
296       pass
297    
298    try:
299       tmp = os.environ['PATH']
300       env['ENV']['PATH'] = tmp
301    except KeyError:
302       pass
303    
304  # Add some customer builders  try:
305       tmp = os.environ['LD_LIBRARY_PATH']
306       env['ENV']['LD_LIBRARY_PATH'] = tmp
307    except KeyError:
308       pass
309    #==========================================================================
310    #
311    #    Add some customer builders
312    #
313  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)
314  env.Append(BUILDERS = {'PyCompile' : py_builder});  env.Append(BUILDERS = {'PyCompile' : py_builder});
315    
316  if env['PLATFORM'] == "win32":  runUnitTest_builder = Builder(action = scons_extensions.runUnitTest, suffix = '.passed',
317     runUnitTest_builder = Builder(action = scons_extensions.runUnitTest, suffix = '.passed', src_suffix='.exe', single_source=True)                                src_suffix=env['PROGSUFFIX'], single_source=True)
318  else:  
    runUnitTest_builder = Builder(action = scons_extensions.runUnitTest, suffix = '.passed', single_source=True)  
319  env.Append(BUILDERS = {'RunUnitTest' : runUnitTest_builder});  env.Append(BUILDERS = {'RunUnitTest' : runUnitTest_builder});
320    
321  runPyUnitTest_builder = Builder(action = scons_extensions.runPyUnitTest, suffix = '.passed', src_suffic='.py', single_source=True)  runPyUnitTest_builder = Builder(action = scons_extensions.runPyUnitTest, suffix = '.passed', src_suffic='.py', single_source=True)
# Line 198  except KeyError: Line 329  except KeyError:
329     incinstall = None     incinstall = None
330  try:  try:
331     libinstall = env['libinstall']     libinstall = env['libinstall']
332     env.Append(LIBPATH = [libinstall,])     env.Append(LIBPATH = [libinstall,]) # Adds -L for building of libescript.so libfinley.so escriptcpp.so finleycpp.so
333     env.PrependENVPath('LD_LIBRARY_PATH', libinstall)     env.PrependENVPath('LD_LIBRARY_PATH', libinstall)
334     if env['PLATFORM'] == "win32":     if env['PLATFORM'] == "win32":
335        env.PrependENVPath('PATH', libinstall)        env.PrependENVPath('PATH', libinstall)
# Line 206  try: Line 337  try:
337  except KeyError:  except KeyError:
338     libinstall = None     libinstall = None
339  try:  try:
340     pyinstall = env['pyinstall']+'/esys' # 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'])  
341  except KeyError:  except KeyError:
342     pyinstall = None     pyinstall = None
343  try:  try:
344       exinstall = env['exinstall']
345    except KeyError:
346       exinstall = None
347    try:
348       sys_libinstall = env['sys_libinstall']
349    except KeyError:
350       sys_libinstall = None
351    try:
352       sys_pyinstall = env['sys_pyinstall']
353    except KeyError:
354       sys_pyinstall = None
355    try:
356       sys_exinstall = env['sys_exinstall']
357    except KeyError:
358       sys_exinstall = None
359    try:
360     dodebug = env['dodebug']     dodebug = env['dodebug']
361  except KeyError:  except KeyError:
362     dodebug = None     dodebug = None
# Line 224  try: Line 370  try:
370  except KeyError:  except KeyError:
371     pass     pass
372    
 if 'shake71' == socket.gethostname().split('.')[0]:  
   if useMPI:  
     env['CC'] = 'mpicc'  
     env['CXX'] = 'mpiCC'  
373    
374  if dodebug:  if dodebug:
375    if useMPI:    if useMPI:
# Line 289  except KeyError: Line 431  except KeyError:
431  try:  try:
432     sys_libs = env['sys_libs']     sys_libs = env['sys_libs']
433  except KeyError:  except KeyError:
434     sys_libs = ''     sys_libs = []
435    
436  try:  try:
437     tar_flags = env['tar_flags']     tar_flags = env['tar_flags']
# Line 310  except KeyError: Line 452  except KeyError:
452     pass     pass
453    
454  if useMPI:  if useMPI:
455     mkl_libs = ''     mkl_libs = []
456  else:  else:
457     try:     try:
458        mkl_libs = env['mkl_libs']        mkl_libs = env['mkl_libs']
459     except KeyError:     except KeyError:
460        mkl_libs = ''        mkl_libs = []
461    
462  try:  try:
463     includes = env['scsl_path']     includes = env['scsl_path']
# Line 333  if useMPI: Line 475  if useMPI:
475    try:    try:
476      scsl_libs = env['scsl_libs_MPI']      scsl_libs = env['scsl_libs_MPI']
477    except KeyError:    except KeyError:
478      scsl_libs = ''      scsl_libs = []
479  else:  else:
480    try:    try:
481      scsl_libs = env['scsl_libs']      scsl_libs = env['scsl_libs']
482    except KeyError:    except KeyError:
483      scsl_libs = ''      scsl_libs = []
484    
485  try:  try:
486     includes = env['umf_path']     includes = env['umf_path']
# Line 353  except KeyError: Line 495  except KeyError:
495     pass     pass
496    
497  if useMPI:  if useMPI:
498      umf_libs = ''      umf_libs = []
499  else:  else:
500     try:     try:
501        umf_libs = env['umf_libs']        umf_libs = env['umf_libs']
502     except KeyError:     except KeyError:
503        umf_libs = ''        umf_libs = []
504    
505  try:  try:
506     includes = env['ufc_path']     includes = env['ufc_path']
# Line 379  except KeyError: Line 521  except KeyError:
521     pass     pass
522    
523  if useMPI:  if useMPI:
524      amd_libs = ''      amd_libs = []
525  else:  else:
526     try:     try:
527        amd_libs = env['amd_libs']        amd_libs = env['amd_libs']
528     except KeyError:     except KeyError:
529        amd_libs = ''        amd_libs = []
530    
531  try:  try:
532     includes = env['blas_path']     includes = env['blas_path']
# Line 401  except KeyError: Line 543  except KeyError:
543  try:  try:
544     blas_libs = env['blas_libs']     blas_libs = env['blas_libs']
545  except KeyError:  except KeyError:
546     blas_libs = ''     blas_libs = []
547    
548    try:
549       useNetCDF = env['useNetCDF']
550    except KeyError:
551       useNetCDF = 'yes'
552       pass
553    
554    if useNetCDF == 'yes':
555       try:
556          netCDF_libs = env['netCDF_libs']
557       except KeyError:
558          pass
559    
560       env.Append(LIBS = netCDF_libs)
561       env.Append(CPPDEFINES = [ 'USE_NETCDF' ])
562       try:
563          includes = env['netCDF_path']
564          env.Append(CPPPATH = [includes,])
565       except KeyError:
566          pass
567    
568       try:
569          lib_path = env['netCDF_lib_path']
570          if IS_WINDOWS_PLATFORM: env['ENV']['PATH']+=";"+lib_path
571          env.Append(LIBPATH = [ lib_path, ])
572       except KeyError:
573          pass
574    else:
575       print "Warning: Installation is not configured with netCDF. Some I/O function may not be available."
576       netCDF_libs=[ ]
577    
578  try:  try:
579     includes = env['boost_path']     includes = env['boost_path']
# Line 496  try: Line 668  try:
668  except KeyError:  except KeyError:
669     api_epydoc = None     api_epydoc = None
670    
671  # Zipgets  try:
672       api_doxygen = env.Dir(env['api_doxygen'])
673    except KeyError:
674       api_doxygen = None
675    
676    # Python install - esys __init__.py
677    init_target = env.Command(pyinstall+'/__init__.py', None, Touch('$TARGET'))
678    
679  env.Default(libinstall)  # FIXME: exinstall and friends related to examples are not working.
680  env.Default(incinstall)  build_target = env.Alias('build',[libinstall,incinstall,pyinstall,init_target])
681  env.Default(pyinstall)  
682    env.Default(build_target)
683    
684    # Zipgets
685  env.Alias('release_src',[ src_zipfile, src_tarfile ])  env.Alias('release_src',[ src_zipfile, src_tarfile ])
686  env.Alias('release_tests',[ test_zipfile, test_tarfile])  env.Alias('release_tests',[ test_zipfile, test_tarfile])
687  env.Alias('release_examples',[ examples_zipfile, examples_tarfile])  env.Alias('release_examples',[ examples_zipfile, examples_tarfile])
688    env.Alias('examples_zipfile',examples_zipfile)
689    env.Alias('examples_tarfile',examples_tarfile)
690  env.Alias('api_epydoc',api_epydoc)  env.Alias('api_epydoc',api_epydoc)
691    env.Alias('api_doxygen',api_doxygen)
692    env.Alias('guide_html_index',guide_html_index)
693  env.Alias('guide_pdf', guide_pdf)  env.Alias('guide_pdf', guide_pdf)
694  env.Alias('docs',[ 'release_examples', 'guide_pdf', guide_html_index, api_epydoc])  env.Alias('docs',[ 'release_examples', 'guide_pdf', api_epydoc, api_doxygen, guide_html_index])
695  env.Alias('release', ['release_src', 'release_tests', 'docs'])  env.Alias('release', ['release_src', 'release_tests', 'docs'])
696  env.Alias('build_tests')    # target to build all C++ tests  
697  env.Alias('build_py_tests') # target to build all python tests  env.Alias('build_tests',build_target)    # target to build all C++ tests
698    env.Alias('build_py_tests',build_target) # target to build all python tests
699  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
700  env.Alias('run_tests', 'build_tests')   # target to run all C++ test  env.Alias('run_tests', 'build_tests')   # target to run all C++ test
701  env.Alias('py_tests', 'build_py_tests') # taget to run all released python tests  env.Alias('py_tests', 'build_py_tests') # taget to run all released python tests
702  env.Alias('all_tests', ['run_tests', 'py_tests']) # target to run all C++ and released python tests  env.Alias('all_tests', ['run_tests', 'py_tests']) # target to run all C++ and released python tests
703    
 # Python install - esys __init__.py  
 init_target = env.Command(pyinstall+'/__init__.py', None, Touch('$TARGET'))  
 env.Alias(init_target)  
704    
705  # Allow sconscripts to see the env  # Allow sconscripts to see the env
706  Export(["env", "incinstall", "libinstall", "pyinstall", "dodebug", "mkl_libs", "scsl_libs", "umf_libs", "amd_libs", "blas_libs",  Export(["env", "incinstall", "libinstall", "pyinstall", "exinstall", "dodebug",
707            "mkl_libs", "scsl_libs", "umf_libs", "amd_libs", "blas_libs",
708            "netCDF_libs",
709      "boost_lib", "python_lib", "doxygen_path", "epydoc_path", "papi_libs",      "boost_lib", "python_lib", "doxygen_path", "epydoc_path", "papi_libs",
710          "sys_libs", "test_zipfile", "src_zipfile", "test_tarfile", "src_tarfile", "examples_tarfile", "examples_zipfile",          "sys_libs", "test_zipfile", "src_zipfile", "test_tarfile",
711          "guide_pdf", "guide_html_index", "api_epydoc", "useMPI"])          "src_tarfile", "examples_tarfile", "examples_zipfile",
712            "guide_pdf", "guide_html_index", "api_epydoc", "api_doxygen", "useMPI"
713            ])
714    
715  # End initialisation section  # End initialisation section
716  # Begin configuration section  # Begin configuration section
# Line 532  release_srcfiles=[env.File('SConstruct') Line 719  release_srcfiles=[env.File('SConstruct')
719  release_testfiles=[env.File('README_TESTS'),]  release_testfiles=[env.File('README_TESTS'),]
720  env.Zip(src_zipfile, release_srcfiles)  env.Zip(src_zipfile, release_srcfiles)
721  env.Zip(test_zipfile, release_testfiles)  env.Zip(test_zipfile, release_testfiles)
722  env.Tar(src_tarfile, release_srcfiles)  try:
723  env.Tar(test_tarfile, release_testfiles)     env.Tar(src_tarfile, release_srcfiles)
724       env.Tar(test_tarfile, release_testfiles)
725    except AttributeError:
726       pass
727  # Insert new components to be build here  # Insert new components to be build here
728  # 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
729  # 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 542  env.Tar(test_tarfile, release_testfiles) Line 731  env.Tar(test_tarfile, release_testfiles)
731  env.SConscript(dirs = ['tools/CppUnitTest/src'], build_dir='build/$PLATFORM/tools/CppUnitTest', duplicate=0)  env.SConscript(dirs = ['tools/CppUnitTest/src'], build_dir='build/$PLATFORM/tools/CppUnitTest', duplicate=0)
732  # C/C++ Libraries  # C/C++ Libraries
733  env.SConscript(dirs = ['paso/src'], build_dir='build/$PLATFORM/paso', duplicate=0)  env.SConscript(dirs = ['paso/src'], build_dir='build/$PLATFORM/paso', duplicate=0)
734  env.SConscript(dirs = ['bruce/src'], build_dir='build/$PLATFORM/bruce', duplicate=0)  # bruce is removed for now as it doesn't really do anything
735    # env.SConscript(dirs = ['bruce/src'], build_dir='build/$PLATFORM/bruce', duplicate=0)
736  env.SConscript(dirs = ['escript/src'], build_dir='build/$PLATFORM/escript', duplicate=0)  env.SConscript(dirs = ['escript/src'], build_dir='build/$PLATFORM/escript', duplicate=0)
737  env.SConscript(dirs = ['esysUtils/src'], build_dir='build/$PLATFORM/esysUtils', duplicate=0)  env.SConscript(dirs = ['esysUtils/src'], build_dir='build/$PLATFORM/esysUtils', duplicate=0)
738  env.SConscript(dirs = ['finley/src'], build_dir='build/$PLATFORM/finley', duplicate=0)  env.SConscript(dirs = ['finley/src'], build_dir='build/$PLATFORM/finley', duplicate=0)
# Line 554  env.SConscript(dirs = ['pycad/py_src'], Line 744  env.SConscript(dirs = ['pycad/py_src'],
744  # added by Ben Cumming  # added by Ben Cumming
745  env.SConscript(dirs = ['pythonMPI/src'], build_dir='build/$PLATFORM/pythonMPI', duplicate=0)  env.SConscript(dirs = ['pythonMPI/src'], build_dir='build/$PLATFORM/pythonMPI', duplicate=0)
746  #env.SConscript(dirs = ['../test'], build_dir='../test/build', duplicate=0)  #env.SConscript(dirs = ['../test'], build_dir='../test/build', duplicate=0)
747    
748    
749    syslib_install_target = env.installDirectory(sys_libinstall,libinstall)
750    syspy_install_target = env.installDirectory(sys_pyinstall,pyinstall,recursive=True)
751    
752    install_target = env.Alias("install", env.Flatten([syslib_install_target, syspy_install_target]) )

Legend:
Removed from v.898  
changed lines
  Added in v.1246

  ViewVC Help
Powered by ViewVC 1.1.26