/[escript]/trunk/SConstruct
ViewVC logotype

Diff of /trunk/SConstruct

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

revision 682 by robwdcock, Mon Mar 27 02:43:09 2006 UTC revision 1250 by ksteube, Thu Aug 16 02:54:42 2007 UTC
# Line 1  Line 1 
1  #          Copyright 2006 by ACcESS MNRF                    #         Copyright 2006 by ACcESS MNRF
 #                                                            
 #              http://www.access.edu.au                      
 #       Primary Business: Queensland, Australia              
 #  Licensed under the Open Software License version 3.0      
 #     http://www.opensource.org/licenses/osl-3.0.php        
 #                                                            
 #  
2  #  #
3    #              http://www.access.edu.au
4    #       Primary Business: Queensland, Australia
5    #  Licensed under the Open Software License version 3.0
6    #     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
10  # all of this section just intialises default environments and helper  # all of this section just intialises default environments and helper
11  # scripts. You shouldn't need to modify this section.  # scripts. You shouldn't need to modify this section.
12  EnsureSConsVersion(0,96,91)  EnsureSConsVersion(0,96,91)
13  EnsurePythonVersion(2,3)  EnsurePythonVersion(2,3)
14    
15  import sys, os  #===============================================================
16    #   import tools:
17    import glob
18    import sys, os, re
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    #===============================================================
24    
25    tools_prefix="/usr"
26    
27    #==============================================================================================    
28    #    
29    #    get the installation prefix
30    #
31    prefix = ARGUMENTS.get('prefix', '/usr')
32    
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    # Install as a standard python package in /usr/lib64 if available, else in /usr/lib
37    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:
41       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     import socket
78     from string import ascii_letters,digits     hostname = re.sub("[^0-9a-zA-Z]", "_", socket.gethostname().split('.')[0])
79     hostname=""     tmp = os.path.join("scons",hostname+"_options.py")
80     for s in socket.gethostname().split('.')[0]:  
81        if s in ascii_letters+digits:     if os.path.isfile(tmp) :
82           hostname+=s        options_file = tmp
83        else:  
84           hostname+="_"  IS_WINDOWS_PLATFORM = (os.name== "nt")
85     options_file = "scons/"+hostname+"_options.py"  
86    # If you're not going to tell me then......
87    # FIXME: add one for the altix too.
88    if not options_file :
89       if IS_WINDOWS_PLATFORM :
90          options_file = "scons/windows_mscv71_options.py"
91       else:
92          options_file = "scons/linux_gcc_eg_options.py"
93    
94    # and load it
95  opts = Options(options_file, ARGUMENTS)  opts = Options(options_file, ARGUMENTS)
96    #================================================================
97    #
98    #   check if UMFPACK is installed on the system:
99    #
100    uf_root=None
101    for i in [ 'UMFPACK', 'umfpack', 'ufsparse', 'UFSPARSE']:
102       if os.path.isdir(os.path.join(tools_prefix,'include',i)):
103           uf_root=i
104           print i," is used form ",tools_prefix
105           break
106    if not uf_root==None:
107       umf_path_default=os.path.join(tools_prefix,'include',uf_root)
108       umf_lib_path_default=os.path.join(tools_prefix,'lib')
109       umf_libs_default=['umfpack']
110       amd_path_default=os.path.join(tools_prefix,'include',uf_root)
111       amd_lib_path_default=os.path.join(tools_prefix,'lib')
112       amd_libs_default=['amd']
113       ufc_path_default=os.path.join(tools_prefix,'include',uf_root)
114    else:
115       umf_path_default=None
116       umf_lib_path_default=None
117       umf_libs_default=None
118       amd_path_default=None
119       amd_lib_path_default=None
120       amd_libs_default=None
121       ufc_path_default=None
122    #
123    #==========================================================================
124    #
125    #    python installation:
126    #
127    python_path_default=os.path.join(tools_prefix,'include','python%s.%s'%(sys.version_info[0],sys.version_info[1]))
128    python_lib_path_default=os.path.join(tools_prefix,'lib')
129    python_lib_default="python%s.%s"%(sys.version_info[0],sys.version_info[1])
130    
131    #==========================================================================
132    #
133    #    boost installation:
134    #
135    boost_path_default=os.path.join(tools_prefix,'include')
136    boost_lib_path_default=os.path.join(tools_prefix,'lib')
137    boost_lib_default=['boost_python']
138    #==========================================================================
139    #
140    #    check if netCDF is installed on the system:
141    #
142    netCDF_path_default=os.path.join(tools_prefix,'include','netcdf-3')
143    netCDF_lib_path_default=os.path.join(tools_prefix,'lib','netcdf-3')
144    
145    if os.path.isdir(netCDF_path_default) and os.path.isdir(netCDF_lib_path_default):
146         useNetCDF_default='yes'
147         netCDF_libs_default=[ 'netcdf_c++', 'netcdf' ]
148    else:
149         useNetCDF_default='no'
150         netCDF_path_default=None
151         netCDF_lib_path_default=None
152         netCDF_libs_default=None
153    
154    #==========================================================================
155    #
156    #    compile:
157    #
158    cc_flags_default='-O3 -std=c99 -ffast-math -fpic -Wno-unknown-pragmas -ansi -pedantic-errors'
159    cc_flags_debug_default='-g -O0 -ffast-math -std=c99 -fpic -Wno-unknown-pragmas -ansi -pedantic-errors'
160    cxx_flags_default='--no-warn -ansi'
161    cxx_flags_debug_default='--no-warn -ansi -DDOASSERT'
162    #==============================================================================================    
163    # Default options and options help text
164    # These are defaults and can be overridden using command line arguments or an options file.
165    # if the options_file or ARGUMENTS do not exist then the ones listed as default here are used
166    # DO NOT CHANGE THEM HERE
167  opts.AddOptions(  opts.AddOptions(
168  # Where to install esys stuff  # Where to install esys stuff
169    ('incinstall', 'where the esys headers will be installed', Dir('#.').abspath+'/include'),    ('incinstall', 'where the esys headers will be installed',             Dir('#.').abspath+'/include'),
170    ('libinstall', 'where the esys libraries will be installed', Dir('#.').abspath+'/lib'),    ('libinstall', 'where the esys libraries will be installed',           dir_libraries),
171    ('pyinstall', 'where the esys python modules will be installed', Dir('#.').abspath),    ('pyinstall', 'where the esys python modules will be installed',       dir_packages),
172      ('exinstall', 'where the esys examples will be installed',             dir_examples),
173      ('sys_libinstall', 'where the system esys libraries will be installed',       sys_dir_libraries),
174      ('sys_pyinstall', 'where the system esys python modules will be installed',   sys_dir_packages),
175      ('sys_exinstall', 'where the system esys examples will be installed',         sys_dir_examples),
176      ('src_zipfile', 'the source zip file will be installed.',              Dir('#.').abspath+"/release/escript_src.zip"),
177      ('test_zipfile', 'the test zip file will be installed.',               Dir('#.').abspath+"/release/escript_tests.zip"),
178      ('src_tarfile', 'the source tar file will be installed.',              Dir('#.').abspath+"/release/escript_src.tar.gz"),
179      ('test_tarfile', 'the test tar file will be installed.',               Dir('#.').abspath+"/release/escript_tests.tar.gz"),
180      ('examples_tarfile', 'the examples tar file will be installed.',       Dir('#.').abspath+"/release/doc/escript_examples.tar.gz"),
181      ('examples_zipfile', 'the examples zip file will be installed.',       Dir('#.').abspath+"/release/doc/escript_examples.zip"),
182      ('guide_pdf', 'name of the user guide in pdf format',                  Dir('#.').abspath+"/release/doc/user/guide.pdf"),
183      ('api_epydoc', 'name of the epydoc api docs directory',                Dir('#.').abspath+"/release/doc/epydoc"),
184      ('guide_html', 'name of the directory for user guide in html format',  Dir('#.').abspath+"/release/doc/user/html"),
185      ('api_doxygen', 'name of the doxygen api docs directory',prefix+"/release/doc/doxygen"),
186  # Compilation options  # Compilation options
187    BoolOption('dodebug', 'Do you want a debug build?', 'yes'),    BoolOption('dodebug', 'Do you want a debug build?', 'no'),
188    ('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),
189    ('cc_defines','C/C++ defines to use', None),    ('cc_defines','C/C++ defines to use', None),
190    ('cc_flags','C compiler flags to use (Release build)', None),    ('cc_flags','C compiler flags to use (Release build)', cc_flags_default),
191    ('cc_flags_debug', 'C compiler flags to use (Debug build)', None),    ('cc_flags_debug', 'C compiler flags to use (Debug build)', cc_flags_debug_default),
192    ('cxx_flags', 'C++ compiler flags to use (Release build)', None),    ('cxx_flags', 'C++ compiler flags to use (Release build)', cxx_flags_default),
193    ('cxx_flags_debug', 'C++ compiler flags to use (Debug build)', None),    ('cxx_flags_debug', 'C++ compiler flags to use (Debug build)', cxx_flags_debug_default),
194    ('ar_flags', 'Static library archiver flags to use', None),    ('ar_flags', 'Static library archiver flags to use', None),
195    ('sys_libs', 'System libraries to link with', None),    ('sys_libs', 'System libraries to link with', None),
196      ('tar_flags','flags for zip files','-c -z'),
197  # MKL  # MKL
198    PathOption('mkl_path', 'Path to MKL includes', None),    PathOption('mkl_path', 'Path to MKL includes', None),
199    PathOption('mkl_lib_path', 'Path to MKL libs', None),    PathOption('mkl_lib_path', 'Path to MKL libs', None),
200    ('mkl_libs', 'MKL libraries to link with', None),    ('mkl_libs', 'MKL libraries to link with', None),
201  # SCSL  # SCSL
202    PathOption('scsl_path', 'Path to SCSL includes', None),    PathOption('scsl_path', 'Path to SCSL includes', None),
203    PathOption('scsl_lib_path', 'Path to SCSL libs', None),    PathOption('scsl_lib_path', 'Path to SCSL libs', None),
204    ('scsl_libs', 'SCSL libraries to link with', None),    ('scsl_libs', 'SCSL libraries to link with', None),
205  # UMFPACK    ('scsl_libs_MPI', 'SCSL libraries to link with for MPI build', None),
206    PathOption('umf_path', 'Path to UMF includes', None),  # UMFPACK
207    PathOption('umf_lib_path', 'Path to UMF libs', None),    PathOption('ufc_path', 'Path to UFconfig includes', ufc_path_default),
208    ('umf_libs', 'UMF libraries to link with', None),    PathOption('umf_path', 'Path to UMFPACK includes', umf_path_default),
209      PathOption('umf_lib_path', 'Path to UMFPACK libs', umf_lib_path_default),
210      ('umf_libs', 'UMFPACK libraries to link with', umf_libs_default),
211    # AMD (used by UMFPACK)
212      PathOption('amd_path', 'Path to AMD includes', amd_path_default),
213      PathOption('amd_lib_path', 'Path to AMD libs', amd_lib_path_default),
214      ('amd_libs', 'AMD libraries to link with', amd_libs_default),
215    # BLAS
216      PathOption('blas_path', 'Path to BLAS includes', None),
217      PathOption('blas_lib_path', 'Path to BLAS libs', None),
218      ('blas_libs', 'BLAS libraries to link with', None),
219    # netCDF
220      ('useNetCDF', 'switch on/off the usage of netCDF', useNetCDF_default),
221      PathOption('netCDF_path', 'Path to netCDF includes', netCDF_path_default),
222      PathOption('netCDF_lib_path', 'Path to netCDF libs', netCDF_lib_path_default),
223      ('netCDF_libs', 'netCDF C++ libraries to link with', netCDF_libs_default),
224  # Python  # Python
225    PathOption('python_path', 'Path to Python includes', '/usr/include'),  # locations of include files for python
226    PathOption('python_lib_path', 'Path to Python libs', '/usr/lib'),  # FIXME: python_path should be python_inc_path and the same for boost etc.
227    ('python_lib', 'Python libraries to link with', ['python2.3',]),    PathOption('python_path', 'Path to Python includes', python_path_default),
228      PathOption('python_lib_path', 'Path to Python libs', python_lib_path_default),
229      ('python_lib', 'Python libraries to link with', python_lib_default),
230      ('python_cmd', 'Python command', 'python'),
231  # Boost  # Boost
232    PathOption('boost_path', 'Path to Boost includes', '/usr/include'),    PathOption('boost_path', 'Path to Boost includes', boost_path_default),
233    PathOption('boost_lib_path', 'Path to Boost libs', '/usr/lib'),    PathOption('boost_lib_path', 'Path to Boost libs', boost_lib_path_default),
234    ('boost_lib', 'Boost libraries to link with', ['boost_python',]),    ('boost_lib', 'Boost libraries to link with', boost_lib_default),
 # 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',]),  
235  # Doc building  # Doc building
236    PathOption('doxygen_path', 'Path to Doxygen executable', None),  #  PathOption('doxygen_path', 'Path to Doxygen executable', None),
237    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),  
238  # PAPI  # PAPI
239    PathOption('papi_path', 'Path to PAPI includes', None),    PathOption('papi_path', 'Path to PAPI includes', None),
240    PathOption('papi_lib_path', 'Path to PAPI libs', None),    PathOption('papi_lib_path', 'Path to PAPI libs', None),
241    ('papi_libs', 'PAPI libraries to link with', None),    ('papi_libs', 'PAPI libraries to link with', None),
242    # MPI
243      BoolOption('useMPI', 'Compile parallel version using MPI', 'no'),
244  )  )
245    #=================================================================================================
246    #
247    #   Note: On the Altix the intel compilers are not automatically
248    #   detected by scons intelc.py script. The Altix has a different directory
249    #   path and in some locations the "modules" facility is used to support
250    #   multiple compiler versions. This forces the need to import the users PATH
251    #   environment which isn't the "scons way"
252    #   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)
253    #   FIXME: Perhaps a modification to intelc.py will allow better support for ia64 on altix
254    #
255    
256    if IS_WINDOWS_PLATFORM:
257          env = Environment(tools = ['default', 'msvc'], options = opts)
258    else:
259       if os.uname()[4]=='ia64':
260          env = Environment(tools = ['default', 'intelc'], options = opts)
261          if env['CXX'] == 'icpc':
262             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
263       else:
264          env = Environment(tools = ['default'], options = opts)
265    Help(opts.GenerateHelpText(env))
266    
267  # Initialise Scons Build Environment  #=================================================================================================
268  # check for user environment variables we are interested in  #
269    #     Initialise Scons Build Environment
270    #     check for user environment variables we are interested in
271  try:  try:
272     python_path = os.environ['PYTHONPATH']     tmp = os.environ['PYTHONPATH']
273       env['ENV']['PYTHONPATH'] = tmp
274  except KeyError:  except KeyError:
275     python_path = ''     pass
276    
277    env.PrependENVPath('PYTHONPATH', source_root)
278    
279  try:  try:
280     path = os.environ['PATH']     omp_num_threads = os.environ['OMP_NUM_THREADS']
281  except KeyError:  except KeyError:
282     path = ''     omp_num_threads = 1
283    
284    env['ENV']['OMP_NUM_THREADS'] = omp_num_threads
285    
286  try:  try:
287     ld_library_path = os.environ['LD_LIBRARY_PATH']     env['ENV']['DISPLAY'] = os.environ['DISPLAY']
288       env['ENV']['XAUTHORITY'] = os.environ['XAUTHORITY']
289  except KeyError:  except KeyError:
290     ld_library_path = ''     pass
   
 # 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, 'LD_LIBRARY_PATH':ld_library_path, 'PYTHONPATH':python_path}, tools = ['default', 'intelc'], options = opts)  
    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":  
    # FIXME: Need to implement equivalent of ld library path for windoze  
    env = Environment(ENV = {'PYTHONPATH':python_path}, tools = ['default', 'intelc'], options = opts)  
 else:  
    env = Environment(ENV = {'PATH':path, 'LD_LIBRARY_PATH':ld_library_path, 'PYTHONPATH':python_path}, tools = ['default'], options = opts)  
291    
292  # Setup help for options  try:
293  Help(opts.GenerateHelpText(env))     tmp = os.environ['PATH']
294       env['ENV']['PATH'] = tmp
295    except KeyError:
296       pass
297    
298  # Add some customer builders  try:
299       tmp = os.environ['LD_LIBRARY_PATH']
300       env['ENV']['LD_LIBRARY_PATH'] = tmp
301    except KeyError:
302       pass
303    #==========================================================================
304    #
305    #    Add some customer builders
306    #
307  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)
308  env.Append(BUILDERS = {'PyCompile' : py_builder});  env.Append(BUILDERS = {'PyCompile' : py_builder});
309    
310  if env['PLATFORM'] == "win32":  runUnitTest_builder = Builder(action = scons_extensions.runUnitTest, suffix = '.passed',
311     runUnitTest_builder = Builder(action = scons_extensions.runUnitTest, suffix = '.passed', src_suffix='.exe', single_source=True)                                src_suffix=env['PROGSUFFIX'], single_source=True)
312  else:  
    runUnitTest_builder = Builder(action = scons_extensions.runUnitTest, suffix = '.passed', single_source=True)  
313  env.Append(BUILDERS = {'RunUnitTest' : runUnitTest_builder});  env.Append(BUILDERS = {'RunUnitTest' : runUnitTest_builder});
314    
315  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 141  try: Line 320  try:
320     incinstall = env['incinstall']     incinstall = env['incinstall']
321     env.Append(CPPPATH = [incinstall,])     env.Append(CPPPATH = [incinstall,])
322  except KeyError:  except KeyError:
323     incinstall = None       incinstall = None
324  try:  try:
325     libinstall = env['libinstall']     libinstall = env['libinstall']
326     env.Append(LIBPATH = [libinstall,])     env.Append(LIBPATH = [libinstall,]) # Adds -L for building of libescript.so libfinley.so escriptcpp.so finleycpp.so
327     env.PrependENVPath('LD_LIBRARY_PATH', libinstall)     env.PrependENVPath('LD_LIBRARY_PATH', libinstall)
328       if IS_WINDOWS_PLATFORM :
329          env.PrependENVPath('PATH', libinstall)
330    except KeyError:
331       libinstall = None
332    try:
333       pyinstall = env['pyinstall'] # all targets will install into pyinstall/esys but PYTHONPATH points at straight pyinstall so you go import esys.escript etc
334    except KeyError:
335       pyinstall = None
336    try:
337       exinstall = env['exinstall']
338  except KeyError:  except KeyError:
339     libinstall = None       exinstall = None
340  try:  try:
341     pyinstall = env['pyinstall']+'/esys' # all targets will install into pyinstall/esys but PYTHONPATH points at straight pyinstall so you go import esys.escript etc     sys_libinstall = env['sys_libinstall']
    env.PrependENVPath('PYTHONPATH', env['pyinstall'])  
342  except KeyError:  except KeyError:
343     pyinstall = None       sys_libinstall = None
344    try:
345       sys_pyinstall = env['sys_pyinstall']
346    except KeyError:
347       sys_pyinstall = None
348    try:
349       sys_exinstall = env['sys_exinstall']
350    except KeyError:
351       sys_exinstall = None
352  try:  try:
353     dodebug = env['dodebug']     dodebug = env['dodebug']
354  except KeyError:  except KeyError:
355     dodebug = None       dodebug = None
356    try:
357       useMPI = env['useMPI']
358    except KeyError:
359       useMPI = None
360  try:  try:
361     cc_defines = env['cc_defines']     cc_defines = env['cc_defines']
362     env.Append(CPPDEFINES = [cc_defines,])     env.Append(CPPDEFINES = cc_defines)
363  except KeyError:  except KeyError:
364     pass     pass
365    
366    
367  if dodebug:  if dodebug:
368     try:    if useMPI:
369        try:
370          flags = env['cc_flags_debug_MPI']
371          env.Append(CCFLAGS = flags)
372        except KeyError:
373          pass
374      else:
375        try:
376        flags = env['cc_flags_debug']        flags = env['cc_flags_debug']
377        env.Append(CCFLAGS = flags)        env.Append(CCFLAGS = flags)
378     except KeyError:      except KeyError:
379        pass        pass
380  else:  else:
381      if useMPI:
382     try:     try:
383        flags = env['cc_flags']       flags = env['cc_flags_MPI']
384        env.Append(CCFLAGS = flags)       env.Append(CCFLAGS = flags)
385     except KeyError:     except KeyError:
386        pass        pass
387      else:
 if dodebug:  
388     try:     try:
389        flags = env['cxx_flags_debug']        flags = env['cc_flags']
390        env.Append(CXXFLAGS = flags)        env.Append(CCFLAGS = flags)
391     except KeyError:     except KeyError:
392        pass        pass
393    if dodebug:
394       if useMPI:
395         try:
396            flags = env['cxx_flags_debug_MPI']
397            env.Append(CXXFLAGS = flags)
398         except KeyError:
399            pass
400       else:
401         try:
402            flags = env['cxx_flags_debug']
403            env.Append(CXXFLAGS = flags)
404         except KeyError:
405            pass
406  else:  else:
407     try:     if useMPI:
408        flags = env['cxx_flags']       try:
409        env.Append(CXXFLAGS = flags)          flags = env['cxx_flags_MPI']
410     except KeyError:          env.Append(CXXFLAGS = flags)
411        pass       except KeyError:
412            pass
413       else:
414         try:
415            flags = env['cxx_flags']
416            env.Append(CXXFLAGS = flags)
417         except KeyError:
418            pass
419  try:  try:
420     flags = env['ar_flags']     flags = env['ar_flags']
421     env.Append(ARFLAGS = flags)     env.Append(ARFLAGS = flags)
422  except KeyError:  except KeyError:
423     ar_flags = None       ar_flags = None
424  try:  try:
425     sys_libs = env['sys_libs']     sys_libs = env['sys_libs']
426  except KeyError:  except KeyError:
427     sys_libs = ''     sys_libs = []
428    
429    try:
430       tar_flags = env['tar_flags']
431       env.Replace(TARFLAGS = tar_flags)
432    except KeyError:
433       pass
434    
435  try:  try:
436     includes = env['mkl_path']     includes = env['mkl_path']
437     env.Append(CPPPATH = [includes,])     env.Append(CPPPATH = [includes,])
438  except KeyError:  except KeyError:
439     pass     pass
440    
441  try:  try:
442     lib_path = env['mkl_lib_path']     lib_path = env['mkl_lib_path']
443     env.Append(LIBPATH = [lib_path,])     env.Append(LIBPATH = [lib_path,])
444  except KeyError:  except KeyError:
445     pass     pass
446  try:  
447     mkl_libs = env['mkl_libs']  if useMPI:
448  except KeyError:     mkl_libs = []
449     mkl_libs = ''  else:
450       try:
451          mkl_libs = env['mkl_libs']
452       except KeyError:
453          mkl_libs = []
454    
455  try:  try:
456     includes = env['scsl_path']     includes = env['scsl_path']
457     env.Append(CPPPATH = [includes,])     env.Append(CPPPATH = [includes,])
458  except KeyError:  except KeyError:
459     pass     pass
460    
461  try:  try:
462     lib_path = env['scsl_lib_path']     lib_path = env['scsl_lib_path']
463     env.Append(LIBPATH = [lib_path,])     env.Append(LIBPATH = [lib_path,])
464  except KeyError:  except KeyError:
465     pass     pass
466  try:  
467     scsl_libs = env['scsl_libs']  if useMPI:
468  except KeyError:    try:
469     scsl_libs = ''      scsl_libs = env['scsl_libs_MPI']
470      except KeyError:
471        scsl_libs = []
472    else:
473      try:
474        scsl_libs = env['scsl_libs']
475      except KeyError:
476        scsl_libs = []
477    
478  try:  try:
479     includes = env['umf_path']     includes = env['umf_path']
480     env.Append(CPPPATH = [includes,])     env.Append(CPPPATH = [includes,])
481  except KeyError:  except KeyError:
482     pass     pass
483    
484  try:  try:
485     lib_path = env['umf_lib_path']     lib_path = env['umf_lib_path']
486     env.Append(LIBPATH = [lib_path,])     env.Append(LIBPATH = [lib_path,])
487  except KeyError:  except KeyError:
488     pass     pass
489    
490    if useMPI:
491        umf_libs = []
492    else:
493       try:
494          umf_libs = env['umf_libs']
495       except KeyError:
496          umf_libs = []
497    
498  try:  try:
499     umf_libs = env['umf_libs']     includes = env['ufc_path']
500       env.Append(CPPPATH = [includes,])
501  except KeyError:  except KeyError:
502     umf_libs = ''     pass
503    
504  try:  try:
505     includes = env['boost_path']     includes = env['amd_path']
506     env.Append(CPPPATH = [includes,])     env.Append(CPPPATH = [includes,])
507  except KeyError:  except KeyError:
508     pass     pass
509    
510  try:  try:
511     lib_path = env['boost_lib_path']     lib_path = env['amd_lib_path']
512     env.Append(LIBPATH = [lib_path,])     env.Append(LIBPATH = [lib_path,])
513  except KeyError:  except KeyError:
514     pass     pass
515    
516    if useMPI:
517        amd_libs = []
518    else:
519       try:
520          amd_libs = env['amd_libs']
521       except KeyError:
522          amd_libs = []
523    
524  try:  try:
525     boost_lib = env['boost_lib']     includes = env['blas_path']
526       env.Append(CPPPATH = [includes,])
527    except KeyError:
528       pass
529    
530    try:
531       lib_path = env['blas_lib_path']
532       env.Append(LIBPATH = [lib_path,])
533    except KeyError:
534       pass
535    
536    try:
537       blas_libs = env['blas_libs']
538    except KeyError:
539       blas_libs = []
540    
541    try:
542       useNetCDF = env['useNetCDF']
543  except KeyError:  except KeyError:
544     boost_lib = None       useNetCDF = 'yes'
545       pass
546    
547    if useNetCDF == 'yes':
548       try:
549          netCDF_libs = env['netCDF_libs']
550       except KeyError:
551          pass
552    
553       env.Append(LIBS = netCDF_libs)
554       env.Append(CPPDEFINES = [ 'USE_NETCDF' ])
555       try:
556          includes = env['netCDF_path']
557          env.Append(CPPPATH = [includes,])
558       except KeyError:
559          pass
560    
561       try:
562          lib_path = env['netCDF_lib_path']
563          env.Append(LIBPATH = [ lib_path, ])
564          if IS_WINDOWS_PLATFORM :
565             env.PrependENVPath('PATH', lib_path)
566       except KeyError:
567          pass
568    else:
569       print "Warning: Installation is not configured with netCDF. Some I/O function may not be available."
570       netCDF_libs=[ ]
571    
572  try:  try:
573     includes = env['cppunit_path']     includes = env['boost_path']
574     env.Append(CPPPATH = [includes,])     env.Append(CPPPATH = [includes,])
575  except KeyError:  except KeyError:
576     pass     pass
577  try:  try:
578     lib_path = env['cppunit_lib_path']     lib_path = env['boost_lib_path']
579     env.Append(LIBPATH = [lib_path,])     env.Append(LIBPATH = [lib_path,])
580       if IS_WINDOWS_PLATFORM :
581          env.PrependENVPath('PATH', lib_path)
582  except KeyError:  except KeyError:
583     pass     pass
584  try:  try:
585     cppunit_lib = env['cppunit_lib']     boost_lib = env['boost_lib']
586  except KeyError:  except KeyError:
587     boost_lib = None       boost_lib = None
588  try:  try:
589     includes = env['python_path']     includes = env['python_path']
590     env.Append(CPPPATH = [includes,])     env.Append(CPPPATH = [includes,])
# Line 281  except KeyError: Line 598  except KeyError:
598  try:  try:
599     python_lib = env['python_lib']     python_lib = env['python_lib']
600  except KeyError:  except KeyError:
601     python_lib = None       python_lib = None
602  try:  try:
603     doxygen_path = env['doxygen_path']     doxygen_path = env['doxygen_path']
604  except KeyError:  except KeyError:
605     doxygen_path = None       doxygen_path = None
606  try:  try:
607     epydoc_path = env['epydoc_path']     epydoc_path = env['epydoc_path']
608  except KeyError:  except KeyError:
609     epydoc_path = None       epydoc_path = None
 try:  
    epydoc_pythonpath = env['epydoc_pythonpath']  
 except KeyError:  
    epydoc_pythonpath = None    
610  try:  try:
611     includes = env['papi_path']     includes = env['papi_path']
612     env.Append(CPPPATH = [includes,])     env.Append(CPPPATH = [includes,])
# Line 307  except KeyError: Line 620  except KeyError:
620  try:  try:
621     papi_libs = env['papi_libs']     papi_libs = env['papi_libs']
622  except KeyError:  except KeyError:
623     papi_libs = None       papi_libs = None
624    
625  # Targets  
626  env.Default(libinstall)  try:
627  env.Default(incinstall)     src_zipfile = env.File(env['src_zipfile'])
628  env.Default(pyinstall)  except KeyError:
629  env.Alias('build_tests')     src_zipfile = None
630  env.Alias('run_tests')  try:
631  env.Alias('py_tests')     test_zipfile = env.File(env['test_zipfile'])
632  env.Alias('all_tests', ['run_tests', 'py_tests'])  except KeyError:
633       test_zipfile = None
634    try:
635       examples_zipfile = env.File(env['examples_zipfile'])
636    except KeyError:
637       examples_zipfile = None
638    
639    try:
640       src_tarfile = env.File(env['src_tarfile'])
641    except KeyError:
642       src_tarfile = None
643    try:
644       test_tarfile = env.File(env['test_tarfile'])
645    except KeyError:
646       test_tarfile = None
647    try:
648       examples_tarfile = env.File(env['examples_tarfile'])
649    except KeyError:
650       examples_tarfile = None
651    
652    try:
653       guide_pdf = env.File(env['guide_pdf'])
654    except KeyError:
655       guide_pdf = None
656    
657    try:
658       guide_html_index = env.File('index.htm',env['guide_html'])
659    except KeyError:
660       guide_html_index = None
661    
662    try:
663       api_epydoc = env.Dir(env['api_epydoc'])
664    except KeyError:
665       api_epydoc = None
666    
667    try:
668       api_doxygen = env.Dir(env['api_doxygen'])
669    except KeyError:
670       api_doxygen = None
671    
672    try:
673       svn_pipe = os.popen("svnversion -n")
674       global_revision = svn_pipe.readlines()
675       svn_pipe.close()
676       global_revision = re.sub("[^0-9]", "", global_revision)
677    except:
678       global_revision = "0"
679    env.Append(CPPDEFINES = "SVN_VERSION="+global_revision[0])
680    
681  # Python install - esys __init__.py  # Python install - esys __init__.py
682  # 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'))
683  # create the file if it doesn't exist  
684  env.Command('esys/__init__.py', None, 'touch $TARGET')  # FIXME: exinstall and friends related to examples are not working.
685    build_target = env.Alias('build',[libinstall,incinstall,pyinstall,init_target])
686    
687    env.Default(build_target)
688    
689    # Zipgets
690    env.Alias('release_src',[ src_zipfile, src_tarfile ])
691    env.Alias('release_tests',[ test_zipfile, test_tarfile])
692    env.Alias('release_examples',[ examples_zipfile, examples_tarfile])
693    env.Alias('examples_zipfile',examples_zipfile)
694    env.Alias('examples_tarfile',examples_tarfile)
695    env.Alias('api_epydoc',api_epydoc)
696    env.Alias('api_doxygen',api_doxygen)
697    env.Alias('guide_html_index',guide_html_index)
698    env.Alias('guide_pdf', guide_pdf)
699    env.Alias('docs',[ 'release_examples', 'guide_pdf', api_epydoc, api_doxygen, guide_html_index])
700    env.Alias('release', ['release_src', 'release_tests', 'docs'])
701    
702    env.Alias('build_tests',build_target)    # target to build all C++ tests
703    env.Alias('build_py_tests',build_target) # target to build all python tests
704    env.Alias('build_all_tests', [ 'build_tests', 'build_py_tests' ] ) # target to build all python tests
705    env.Alias('run_tests', 'build_tests')   # target to run all C++ test
706    env.Alias('py_tests', 'build_py_tests') # taget to run all released python tests
707    env.Alias('all_tests', ['run_tests', 'py_tests']) # target to run all C++ and released python tests
708    
709    
710  # Allow sconscripts to see the env  # Allow sconscripts to see the env
711  Export(["env", "incinstall", "libinstall", "pyinstall", "dodebug", "mkl_libs", "scsl_libs", "umf_libs",  Export(["env", "incinstall", "libinstall", "pyinstall", "exinstall", "dodebug",
712      "boost_lib", "python_lib", "doxygen_path", "epydoc_path", "epydoc_pythonpath", "papi_libs", "cppunit_lib", "sys_libs" ])          "mkl_libs", "scsl_libs", "umf_libs", "amd_libs", "blas_libs",
713            "netCDF_libs",
714        "boost_lib", "python_lib", "doxygen_path", "epydoc_path", "papi_libs",
715            "sys_libs", "test_zipfile", "src_zipfile", "test_tarfile",
716            "src_tarfile", "examples_tarfile", "examples_zipfile",
717            "guide_pdf", "guide_html_index", "api_epydoc", "api_doxygen", "useMPI"
718            ])
719    
720  # End initialisation section  # End initialisation section
721  # Begin configuration section  # Begin configuration section
722    # adds this file and the scons option directore to the source tar
723    release_srcfiles=[env.File('SConstruct'),]+[ env.File(x) for x in glob.glob('scons/*.py') ]
724    release_testfiles=[env.File('README_TESTS'),]
725    env.Zip(src_zipfile, release_srcfiles)
726    env.Zip(test_zipfile, release_testfiles)
727    try:
728       env.Tar(src_tarfile, release_srcfiles)
729       env.Tar(test_tarfile, release_testfiles)
730    except AttributeError:
731       pass
732  # Insert new components to be build here  # Insert new components to be build here
733  # 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
734  # 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 336  Export(["env", "incinstall", "libinstall Line 736  Export(["env", "incinstall", "libinstall
736  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)
737  # C/C++ Libraries  # C/C++ Libraries
738  env.SConscript(dirs = ['paso/src'], build_dir='build/$PLATFORM/paso', duplicate=0)  env.SConscript(dirs = ['paso/src'], build_dir='build/$PLATFORM/paso', duplicate=0)
739  env.SConscript(dirs = ['bruce/src'], build_dir='build/$PLATFORM/bruce', duplicate=0)  # bruce is removed for now as it doesn't really do anything
740    # env.SConscript(dirs = ['bruce/src'], build_dir='build/$PLATFORM/bruce', duplicate=0)
741  env.SConscript(dirs = ['escript/src'], build_dir='build/$PLATFORM/escript', duplicate=0)  env.SConscript(dirs = ['escript/src'], build_dir='build/$PLATFORM/escript', duplicate=0)
742  env.SConscript(dirs = ['esysUtils/src'], build_dir='build/$PLATFORM/esysUtils', duplicate=0)  env.SConscript(dirs = ['esysUtils/src'], build_dir='build/$PLATFORM/esysUtils', duplicate=0)
743  env.SConscript(dirs = ['finley/src'], build_dir='build/$PLATFORM/finley', duplicate=0)  env.SConscript(dirs = ['finley/src'], build_dir='build/$PLATFORM/finley', duplicate=0)
744  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)
745    env.SConscript(dirs = ['doc'], build_dir='build/$PLATFORM/doc', duplicate=0)
746    env.SConscript(dirs = ['pyvisi/py_src'], build_dir='build/$PLATFORM/pyvisi', duplicate=0)
747    env.SConscript(dirs = ['pycad/py_src'], build_dir='build/$PLATFORM/pycad', duplicate=0)
748    
749    # added by Ben Cumming
750    env.SConscript(dirs = ['pythonMPI/src'], build_dir='build/$PLATFORM/pythonMPI', duplicate=0)
751    #env.SConscript(dirs = ['../test'], build_dir='../test/build', duplicate=0)
752    
753    
754    syslib_install_target = env.installDirectory(sys_libinstall,libinstall)
755    syspy_install_target = env.installDirectory(sys_pyinstall,pyinstall,recursive=True)
756    
757  # FIXME:need to be incorporated into build system  install_target = env.Alias("install", env.Flatten([syslib_install_target, syspy_install_target]) )
 # FIXME: 'pyvisi/SConstruct']  
 # FIXME: 'doc/SConstruct']  
 # FIXME: 'doc/SConstruct']  

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

  ViewVC Help
Powered by ViewVC 1.1.26