/[escript]/branches/csiropost2.0/SConstruct
ViewVC logotype

Diff of /branches/csiropost2.0/SConstruct

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

revision 722 by gross, Mon May 1 11:49:18 2006 UTC revision 1149 by gross, Thu May 17 00:30:15 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 tools:  #===============================================================
16    #   import tools:
17  import glob  import glob
18  import sys, os  import sys, os
19    import socket
20  # Add our extensions  # Add our extensions
21  if sys.path.count('scons')==0: sys.path.append('scons')  if sys.path.count('scons')==0: sys.path.append('scons')
22  import scons_extensions  import scons_extensions
23    
24    #===============================================================
25    #   check on windows or linux platform
26    #
27    IS_WINDOWS_PLATFORM = (os.name== "nt")
28    
29    if IS_WINDOWS_PLATFORM:
30       tools_prefix="C:\\Program Files\\"
31    else:
32       tools_prefix="/usr"
33    
34    #==============================================================================================    
35    #    
36    #    get the iinstallation prefix
37    #
38    prefix = ARGUMENTS.get('prefix', Dir('#.').abspath)
39    print "Install prefix is: ", prefix
40    
41  # Default options and options help text  # Default options and options help text
42  # 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.
43  # 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
44  # DO NOT CHANGE THEM HERE  # DO NOT CHANGE THEM HERE
45    # Where to install?
46    #==============================================================================================    
47    #    
48    #    get the options file if present:
49    #
50  if ARGUMENTS.get('options_file',0):  if ARGUMENTS.get('options_file',0):
51     options_file = ARGUMENTS.get('options_file',0)     options_file = ARGUMENTS.get('options_file',0)
52  else:  else:
    import socket  
53     from string import ascii_letters,digits     from string import ascii_letters,digits
54     hostname=""     hostname=""
55     for s in socket.gethostname().split('.')[0]:     for s in socket.gethostname().split('.')[0]:
# Line 37  else: Line 57  else:
57           hostname+=s           hostname+=s
58        else:        else:
59           hostname+="_"           hostname+="_"
60     options_file = "scons/"+hostname+"_options.py"     options_file = os.path.join("scons",hostname+"_options.py")
61      
62    if os.path.isfile(options_file):
63       print "option file is ",options_file,"."
64    else:
65       print "option file is ",options_file, "(not present)."
66    # and load it
67  opts = Options(options_file, ARGUMENTS)  opts = Options(options_file, ARGUMENTS)
68    #================================================================
69    #
70    #   check if UMFPACK is installed on the system:
71    #
72    uf_root=None
73    for i in [ 'UMFPACK', 'umfpack', 'ufsparse', 'UFSPARSE']:
74       if os.path.isdir(os.path.join(tools_prefix,'include',i)):
75           uf_root=i
76           print i," is used form ",tools_prefix
77           break
78    if not uf_root==None:
79       umf_path_default=os.path.join(tools_prefix,'include',uf_root)
80       umf_lib_path_default=os.path.join(tools_prefix,'lib')
81       umf_libs_default=['umfpack']
82       amd_path_default=os.path.join(tools_prefix,'include',uf_root)
83       amd_lib_path_default=os.path.join(tools_prefix,'lib')
84       amd_libs_default=['amd']
85       ufc_path_default=os.path.join(tools_prefix,'include',uf_root)
86    else:
87       umf_path_default=None
88       umf_lib_path_default=None
89       umf_libs_default=None
90       amd_path_default=None
91       amd_lib_path_default=None
92       amd_libs_default=None
93       ufc_path_default=None
94    #
95    #==========================================================================
96    #
97    #    python installation:
98    #
99    if IS_WINDOWS_PLATFORM:
100       python_path_default=os.path.join(tools_prefix,'python%s%s'%(sys.version_info[0],sys.version_info[1]),"include")
101       python_lib_path_default=os.path.join(tools_prefix,'python%s%s'%(sys.version_info[0],sys.version_info[1])+"libs")
102       python_libs_default=["python%s%s"%(sys.version_info[0],sys.version_info[1])]
103    else:
104       python_path_default=os.path.join(tools_prefix,'include','python%s.%s'%(sys.version_info[0],sys.version_info[1]))
105       python_lib_path_default=os.path.join(tools_prefix,'lib')
106       python_libs_default=["python%s.%s"%(sys.version_info[0],sys.version_info[1])]
107    
108    #==========================================================================
109    #
110    #    boost installation:
111    #
112    if IS_WINDOWS_PLATFORM:
113       boost_libs_path_default=os.path.join(tools_prefix,'boost','lib')
114       boost_libs_default=None
115       for i in os.listdir(boost_libs_path_default):
116          name=os.path.splitext(i)
117          if name[1] == ".dll" and name[0].startswith("boost_python"):
118              if boost_libs_default == None:
119             boost_libs_default= [ name[0] ]
120          else:
121             if not name[0].find("-gd-"): boost_libs_default=[ name[0] ]
122       boost_path_default=os.path.join(tools_prefix,'boost','include','boost-%s'%(boost_libs_default[0].split("-")[-1],))
123    else:
124       boost_path_default=os.path.join(tools_prefix,'include')
125       boost_libs_path_default=os.path.join(tools_prefix,'lib')
126       boost_libs_default=['boost_python']
127    #==========================================================================
128    #
129    #    check if netCDF is installed on the system:
130    #
131    if IS_WINDOWS_PLATFORM:
132        netcdf_dir=os.path.join(tools_prefix,'netcdf')
133        netCDF_path_default=os.path.join(netcdf_dir,'include')
134        netCDF_lib_path_default=os.path.join(netcdf_dir,'lib')
135    else:
136        netCDF_path_default=os.path.join(tools_prefix,'include','netcdf-3')
137        netCDF_lib_path_default=os.path.join(tools_prefix,'lib','netcdf-3')
138    
139    if os.path.isdir(netCDF_path_default) and os.path.isdir(netCDF_lib_path_default):
140         useNetCDF_default='yes'
141         netCDF_libs_default=[ 'netcdf_c++', 'netcdf' ]
142    else:
143         useNetCDF_default='no'
144         netCDF_path_default=None
145         netCDF_lib_path_default=None
146         netCDF_libs_default=None
147    
148    if IS_WINDOWS_PLATFORM:
149            useNetCDF_default='no' # be default netcdf is not supported on windows.
150    #==========================================================================
151    #
152    #    compile:
153    #
154    if IS_WINDOWS_PLATFORM:
155        # cc_flags_default  = '/GR /EHsc /MD /Qc99 /Qopenmp /Qopenmp-report1 /O3 /G7 /Qprec /Qpar-report1 /QxP /QaxP'
156        # cc_flags_debug_default  = '/Od /MDd /RTC1 /GR /EHsc /Qc99 /Qopenmp /Qopenmp-report1 /Qprec'
157        cc_flags_default  = '/nologo /EHsc /GR  /wd4068 /O2 /Op /MT /W3 /Ob0 /Z7'
158        cc_flags_debug_default  ='/nologo /EHsc /GR  /wd4068 /Od /RTC1 /MTd /ZI /Ob0 /Z7'
159        
160        cc_flags_default  = '/nologo /EHsc /GR  /O2 /MT /W3 /Ob0 /Z7 /wd4068'
161        cc_flags_debug_default  ='/nologo /EHsc /GR /Od /RTC1 /MTd /W3 /Ob0 /Z7/wd4068'
162        cxx_flags_default = ''
163        cxx_flags_debug_default = ''
164        cc_common_flags = '/FD /EHsc /GR /wd4068 '
165    else:
166       cc_flags_default='-O3 -std=c99 -ffast-math -fpic -Wno-unknown-pragmas -ansi -pedantic-errors'
167       cc_flags_debug_default='-g -O0 -ffast-math -std=c99 -fpic -Wno-unknown-pragmas -ansi -pedantic-errors'
168       cxx_flags_default='--no-warn -ansi'
169       cxx_flags_debug_default='--no-warn -ansi -DDOASSERT'
170    #==============================================================================================    
171    # Default options and options help text
172    # These are defaults and can be overridden using command line arguments or an options file.
173    # if the options_file or ARGUMENTS do not exist then the ones listed as default here are used
174    # DO NOT CHANGE THEM HERE
175  opts.AddOptions(  opts.AddOptions(
176  # Where to install esys stuff  # Where to install esys stuff
177    ('incinstall', 'where the esys headers will be installed', Dir('#.').abspath+'/include'),    ('incinstall', 'where the esys headers will be installed', prefix+'/include'),
178    ('libinstall', 'where the esys libraries will be installed', Dir('#.').abspath+'/lib'),    ('libinstall', 'where the esys libraries will be installed', prefix+'/lib'),
179    ('pyinstall', 'where the esys python modules will be installed', Dir('#.').abspath),    ('pyinstall', 'where the esys python modules will be installed', prefix),
180    ('src_zipfile', 'the source zip file will be installed.', Dir('#.').abspath+"/release/escript_src.zip"),    ('src_zipfile', 'the source zip file will be installed.', prefix+"/release/escript_src.zip"),
181    ('test_zipfile', 'the test zip file will be installed.', Dir('#.').abspath+"/release/escript_tests.zip"),    ('test_zipfile', 'the test zip file will be installed.', prefix+"/release/escript_tests.zip"),
182    ('src_tarfile', 'the source tar file will be installed.', Dir('#.').abspath+"/release/escript_src.tar.gz"),    ('src_tarfile', 'the source tar file will be installed.', prefix+"/release/escript_src.tar.gz"),
183    ('test_tarfile', 'the test tar file will be installed.', Dir('#.').abspath+"/release/escript_tests.tar.gz"),    ('test_tarfile', 'the test tar file will be installed.', prefix+"/release/escript_tests.tar.gz"),
184    ('examples_tarfile', 'the examples tar file will be installed.', Dir('#.').abspath+"/release/doc/escript_examples.tar.gz"),    ('examples_tarfile', 'the examples tar file will be installed.', prefix+"/release/doc/escript_examples.tar.gz"),
185    ('examples_zipfile', 'the examples zip file will be installed.', Dir('#.').abspath+"/release/doc/escript_examples.zip"),    ('examples_zipfile', 'the examples zip file will be installed.', prefix+"/release/doc/escript_examples.zip"),
186    ('guide_pdf', 'name of the user guide in pdf format', Dir('#.').abspath+"/release/doc/user/guide.pdf"),    ('guide_pdf', 'name of the user guide in pdf format', prefix+"/release/doc/user/guide.pdf"),
187    ('api_epydoc', 'name of the epydoc api docs directory',Dir('#.').abspath+"/release/doc/epydoc"),    ('api_epydoc', 'name of the epydoc api docs directory',prefix+"/release/doc/epydoc"),
188    ('guide_html', 'name of the directory for user guide in html format', Dir('#.').abspath+"/release/doc/user/html"),    ('guide_html', 'name of the directory for user guide in html format', prefix+"/release/doc/user/html"),
189  # Compilation options  # Compilation options
190    BoolOption('dodebug', 'Do you want a debug build?', 'no'),    BoolOption('dodebug', 'Do you want a debug build?', 'no'),
191    ('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),
192    ('cc_defines','C/C++ defines to use', None),    ('cc_defines','C/C++ defines to use', None),
193    ('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),
194    ('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),
195    ('cxx_flags', 'C++ compiler flags to use (Release build)', '--no-warn -ansi'),    ('cxx_flags', 'C++ compiler flags to use (Release build)', cxx_flags_default),
196    ('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),
197    ('ar_flags', 'Static library archiver flags to use', None),    ('ar_flags', 'Static library archiver flags to use', None),
198    ('sys_libs', 'System libraries to link with', None),    ('sys_libs', 'System libraries to link with', None),
199    ('tar_flags','flags for zip files','-c -z'),    ('tar_flags','flags for zip files','-c -z'),
200  # MKL  # MKL
201    PathOption('mkl_path', 'Path to MKL includes', None),    PathOption('mkl_path', 'Path to MKL includes', None),
202    PathOption('mkl_lib_path', 'Path to MKL libs', None),    PathOption('mkl_lib_path', 'Path to MKL libs', None),
203    ('mkl_libs', 'MKL libraries to link with', None),    ('mkl_libs', 'MKL libraries to link with', None),
204  # SCSL  # SCSL
205    PathOption('scsl_path', 'Path to SCSL includes', None),    PathOption('scsl_path', 'Path to SCSL includes', None),
206    PathOption('scsl_lib_path', 'Path to SCSL libs', None),    PathOption('scsl_lib_path', 'Path to SCSL libs', None),
207    ('scsl_libs', 'SCSL libraries to link with', None),    ('scsl_libs', 'SCSL libraries to link with', None),
208  # UMFPACK    ('scsl_libs_MPI', 'SCSL libraries to link with for MPI build', None),
209    PathOption('umf_path', 'Path to UMF includes', None),  # UMFPACK
210    PathOption('umf_lib_path', 'Path to UMF libs', None),    PathOption('ufc_path', 'Path to UFconfig includes', ufc_path_default),
211    ('umf_libs', 'UMF libraries to link with', None),    PathOption('umf_path', 'Path to UMFPACK includes', umf_path_default),
212      PathOption('umf_lib_path', 'Path to UMFPACK libs', umf_lib_path_default),
213      ('umf_libs', 'UMFPACK libraries to link with', umf_libs_default),
214    # AMD (used by UMFPACK)
215      PathOption('amd_path', 'Path to AMD includes', amd_path_default),
216      PathOption('amd_lib_path', 'Path to AMD libs', amd_lib_path_default),
217      ('amd_libs', 'AMD libraries to link with', amd_libs_default),
218    # BLAS
219      PathOption('blas_path', 'Path to BLAS includes', None),
220      PathOption('blas_lib_path', 'Path to BLAS libs', None),
221      ('blas_libs', 'BLAS libraries to link with', None),
222    # netCDF
223      ('useNetCDF', 'switch on/off the usage of netCDF', useNetCDF_default),
224      PathOption('netCDF_path', 'Path to netCDF includes', netCDF_path_default),
225      PathOption('netCDF_lib_path', 'Path to netCDF libs', netCDF_lib_path_default),
226      ('netCDF_libs', 'netCDF C++ libraries to link with', netCDF_libs_default),
227  # Python  # Python
228  # locations of include files for python  # locations of include files for python
229    PathOption('python_path', 'Path to Python includes', '/usr/include/python%s.%s'%(sys.version_info[0],sys.version_info[1])),    PathOption('python_path', 'Path to Python includes', python_path_default),
230    PathOption('python_lib_path', 'Path to Python libs', '/usr/lib'),    PathOption('python_lib_path', 'Path to Python libs', python_lib_path_default),
231    ('python_lib', 'Python libraries to link with', ["python%s.%s"%(sys.version_info[0],sys.version_info[1]),]),    ('python_libs', 'Python libraries to link with', python_libs_default),
232  # Boost  # Boost
233    PathOption('boost_path', 'Path to Boost includes', '/usr/include'),    PathOption('boost_path', 'Path to Boost includes', boost_path_default),
234    PathOption('boost_lib_path', 'Path to Boost libs', '/usr/lib'),    PathOption('boost_libs_path', 'Path to Boost libs', boost_libs_path_default),
235    ('boost_lib', 'Boost libraries to link with', ['boost_python',]),    ('boost_libs', 'Boost libraries to link with', boost_libs_default),
236  # Doc building  # Doc building
237  #  PathOption('doxygen_path', 'Path to Doxygen executable', None),  #  PathOption('doxygen_path', 'Path to Doxygen executable', None),
238  #  PathOption('epydoc_path', 'Path to Epydoc executable', None),  #  PathOption('epydoc_path', 'Path to Epydoc executable', None),
239  # PAPI  # PAPI
240    PathOption('papi_path', 'Path to PAPI includes', None),    PathOption('papi_path', 'Path to PAPI includes', None),
241    PathOption('papi_lib_path', 'Path to PAPI libs', None),    PathOption('papi_lib_path', 'Path to PAPI libs', None),
242    ('papi_libs', 'PAPI libraries to link with', None),    ('papi_libs', 'PAPI libraries to link with', None),
243    # MPI
244      BoolOption('useMPI', 'Compile parallel version using MPI', 'no'),
245  )  )
246    #=================================================================================================
247  # Initialise Scons Build Environment  #
248  # check for user environment variables we are interested in  #   Note: On the Altix the intel compilers are not automatically
249    #   detected by scons intelc.py script. The Altix has a different directory
250    #   path and in some locations the "modules" facility is used to support
251    #   multiple compiler versions. This forces the need to import the users PATH
252    #   environment which isn't the "scons way"
253    #   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)
254    #   FIXME: Perhaps a modification to intelc.py will allow better support for ia64 on altix
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    #
268    #     Initialise Scons Build Environment
269    #     check for user environment variables we are interested in
270  try:  try:
271     python_path = os.environ['PYTHONPATH']     python_path = os.environ['PYTHONPATH']
272       env['ENV']['PYTHONPATH'] = python_path
273  except KeyError:  except KeyError:
274     python_path = ''     python_path = ''
275    
276  try:  try:
277     path = os.environ['PATH']     path = os.environ['PATH']
278       env['ENV']['PATH'] = path
279  except KeyError:  except KeyError:
280     path = ''     path = ''
281  try:  try:
282     ld_library_path = os.environ['LD_LIBRARY_PATH']     ld_library_path = os.environ['LD_LIBRARY_PATH']
283       env['ENV']['LD_LIBRARY_PATH'] = ld_library_path
284  except KeyError:  except KeyError:
285     ld_library_path = ''     ld_library_path = ''
286    #==========================================================================
287  # Note: On the Altix the intel compilers are not automatically  #
288  # detected by scons intelc.py script. The Altix has a different directory  #    Add some customer builders
289  # 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":  
    # FIXME: Need to implement equivalent of ld library path for windoze  
    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  
   
 # Setup help for options  
 Help(opts.GenerateHelpText(env))  
   
 # Add some customer builders  
290  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)
291  env.Append(BUILDERS = {'PyCompile' : py_builder});  env.Append(BUILDERS = {'PyCompile' : py_builder});
292    
293  if env['PLATFORM'] == "win32":  if IS_WINDOWS_PLATFORM:
294     runUnitTest_builder = Builder(action = scons_extensions.runUnitTest, suffix = '.passed', src_suffix='.exe', single_source=True)     runUnitTest_builder = Builder(action = scons_extensions.runUnitTest, suffix = '.passed', src_suffix='.exe', single_source=True)
295  else:  else:
296     runUnitTest_builder = Builder(action = scons_extensions.runUnitTest, suffix = '.passed', single_source=True)     runUnitTest_builder = Builder(action = scons_extensions.runUnitTest, suffix = '.passed', single_source=True)
# Line 156  try: Line 304  try:
304     incinstall = env['incinstall']     incinstall = env['incinstall']
305     env.Append(CPPPATH = [incinstall,])     env.Append(CPPPATH = [incinstall,])
306  except KeyError:  except KeyError:
307     incinstall = None       incinstall = None
308  try:  try:
309     libinstall = env['libinstall']     libinstall = env['libinstall']
310     env.Append(LIBPATH = [libinstall,])     env.Append(LIBPATH = [libinstall,]) # ksteube adds -L for building of libescript.so libfinley.so escriptcpp.so finleycpp.so
311     env.PrependENVPath('LD_LIBRARY_PATH', libinstall)     env.PrependENVPath('LD_LIBRARY_PATH', libinstall)
312       if env['PLATFORM'] == "win32":
313          env.PrependENVPath('PATH', libinstall)
314          env.PrependENVPath('PATH', env['boost_libs_path'])
315  except KeyError:  except KeyError:
316     libinstall = None       libinstall = None
317  try:  try:
318     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']+'/esys' # all targets will install into pyinstall/esys but PYTHONPATH points at straight pyinstall so you go import esys.escript etc
319     env.PrependENVPath('PYTHONPATH', env['pyinstall'])     env.PrependENVPath('PYTHONPATH', env['pyinstall'])
320  except KeyError:  except KeyError:
321     pyinstall = None       pyinstall = None
322  try:  try:
323     dodebug = env['dodebug']     dodebug = env['dodebug']
324  except KeyError:  except KeyError:
325     dodebug = None       dodebug = None
326    try:
327       useMPI = env['useMPI']
328    except KeyError:
329       useMPI = None
330  try:  try:
331     cc_defines = env['cc_defines']     cc_defines = env['cc_defines']
332     env.Append(CPPDEFINES = [cc_defines,])     env.Append(CPPDEFINES = cc_defines)
333  except KeyError:  except KeyError:
334     pass     pass
335    
336  if dodebug:  if dodebug:
337     try:    if useMPI:
338        try:
339          flags = env['cc_flags_debug_MPI']
340          env.Append(CCFLAGS = flags)
341        except KeyError:
342          pass
343      else:
344        try:
345        flags = env['cc_flags_debug']        flags = env['cc_flags_debug']
346        env.Append(CCFLAGS = flags)        env.Append(CCFLAGS = flags)
347     except KeyError:      except KeyError:
348        pass        pass
349  else:  else:
350      if useMPI:
351     try:     try:
352        flags = env['cc_flags']       flags = env['cc_flags_MPI']
353        env.Append(CCFLAGS = flags)       env.Append(CCFLAGS = flags)
354     except KeyError:     except KeyError:
355        pass        pass
356      else:
 if dodebug:  
357     try:     try:
358        flags = env['cxx_flags_debug']        flags = env['cc_flags']
359        env.Append(CXXFLAGS = flags)        env.Append(CCFLAGS = flags)
360     except KeyError:     except KeyError:
361        pass        pass
362    if dodebug:
363       if useMPI:
364         try:
365            flags = env['cxx_flags_debug_MPI']
366            env.Append(CXXFLAGS = flags)
367         except KeyError:
368            pass
369       else:
370         try:
371            flags = env['cxx_flags_debug']
372            env.Append(CXXFLAGS = flags)
373         except KeyError:
374            pass
375  else:  else:
376     try:     if useMPI:
377        flags = env['cxx_flags']       try:
378        env.Append(CXXFLAGS = flags)          flags = env['cxx_flags_MPI']
379     except KeyError:          env.Append(CXXFLAGS = flags)
380        pass       except KeyError:
381            pass
382       else:
383         try:
384            flags = env['cxx_flags']
385            env.Append(CXXFLAGS = flags)
386         except KeyError:
387            pass
388  try:  try:
389     flags = env['ar_flags']     flags = env['ar_flags']
390     env.Append(ARFLAGS = flags)     env.Append(ARFLAGS = flags)
391  except KeyError:  except KeyError:
392     ar_flags = None       ar_flags = None
393  try:  try:
394     sys_libs = env['sys_libs']     sys_libs = env['sys_libs']
395  except KeyError:  except KeyError:
396     sys_libs = ''     sys_libs = []
397    
398  try:  try:
399     tar_flags = env['tar_flags']     tar_flags = env['tar_flags']
# Line 231  try: Line 413  try:
413  except KeyError:  except KeyError:
414     pass     pass
415    
416  try:  if useMPI:
417     mkl_libs = env['mkl_libs']     mkl_libs = []
418  except KeyError:  else:
419     mkl_libs = ''     try:
420          mkl_libs = env['mkl_libs']
421       except KeyError:
422          mkl_libs = []
423    
424  try:  try:
425     includes = env['scsl_path']     includes = env['scsl_path']
426     env.Append(CPPPATH = [includes,])     env.Append(CPPPATH = [includes,])
427  except KeyError:  except KeyError:
428     pass     pass
429    
430  try:  try:
431     lib_path = env['scsl_lib_path']     lib_path = env['scsl_lib_path']
432     env.Append(LIBPATH = [lib_path,])     env.Append(LIBPATH = [lib_path,])
433  except KeyError:  except KeyError:
434     pass     pass
435  try:  
436     scsl_libs = env['scsl_libs']  if useMPI:
437  except KeyError:    try:
438     scsl_libs = ''      scsl_libs = env['scsl_libs_MPI']
439      except KeyError:
440        scsl_libs = []
441    else:
442      try:
443        scsl_libs = env['scsl_libs']
444      except KeyError:
445        scsl_libs = []
446    
447  try:  try:
448     includes = env['umf_path']     includes = env['umf_path']
449     env.Append(CPPPATH = [includes,])     env.Append(CPPPATH = [includes,])
450  except KeyError:  except KeyError:
451     pass     pass
452    
453  try:  try:
454     lib_path = env['umf_lib_path']     lib_path = env['umf_lib_path']
455     env.Append(LIBPATH = [lib_path,])     env.Append(LIBPATH = [lib_path,])
456  except KeyError:  except KeyError:
457     pass     pass
458    
459    if useMPI:
460        umf_libs = []
461    else:
462       try:
463          umf_libs = env['umf_libs']
464       except KeyError:
465          umf_libs = []
466    
467  try:  try:
468     umf_libs = env['umf_libs']     includes = env['ufc_path']
469       env.Append(CPPPATH = [includes,])
470  except KeyError:  except KeyError:
471     umf_libs = ''     pass
472    
473    try:
474       includes = env['amd_path']
475       env.Append(CPPPATH = [includes,])
476    except KeyError:
477       pass
478    
479    try:
480       lib_path = env['amd_lib_path']
481       env.Append(LIBPATH = [lib_path,])
482    except KeyError:
483       pass
484    
485    if useMPI:
486        amd_libs = []
487    else:
488       try:
489          amd_libs = env['amd_libs']
490       except KeyError:
491          amd_libs = []
492    
493    try:
494       includes = env['blas_path']
495       env.Append(CPPPATH = [includes,])
496    except KeyError:
497       pass
498    
499    try:
500       lib_path = env['blas_lib_path']
501       env.Append(LIBPATH = [lib_path,])
502    except KeyError:
503       pass
504    
505    try:
506       blas_libs = env['blas_libs']
507    except KeyError:
508       blas_libs = []
509    
510    try:
511       useNetCDF = env['useNetCDF']
512    except KeyError:
513       useNetCDF = 'yes'
514       pass
515    
516    if not useNetCDF == 'yes':
517       print "Warning: Installation is not configured with netCDF. Some I/O function may not be available."
518      
519    if useNetCDF == 'yes':
520       try:
521          includes = env['netCDF_path']
522          env.Append(CPPPATH = [includes,])
523       except KeyError:
524          pass
525    
526       try:
527          lib_path = env['netCDF_lib_path']
528          if IS_WINDOWS_PLATFORM: env['ENV']['PATH']+=";"+lib_path
529          env.Append(LIBPATH = [ lib_path, ])
530       except KeyError:
531          pass
532    
533       try:
534          netCDF_libs = env['netCDF_libs']
535       except KeyError:
536          netCDF_libs = [ ]
537    else:
538       netCDF_libs=[ ]
539    
540  try:  try:
541     includes = env['boost_path']     includes = env['boost_path']
542     env.Append(CPPPATH = [includes,])     env.Append(CPPPATH = [includes,])
543  except KeyError:  except KeyError:
544     pass     pass
545  try:  try:
546     lib_path = env['boost_lib_path']     lib_path = env['boost_libs_path']
547     env.Append(LIBPATH = [lib_path,])     env.Append(LIBPATH = [lib_path,])
548  except KeyError:  except KeyError:
549     pass     pass
550  try:  try:
551     boost_lib = env['boost_lib']     boost_libs = env['boost_libs']
552  except KeyError:  except KeyError:
553     boost_lib = None       boost_libs = None
554  try:  try:
555     includes = env['python_path']     includes = env['python_path']
556     env.Append(CPPPATH = [includes,])     env.Append(CPPPATH = [includes,])
# Line 288  try: Line 562  try:
562  except KeyError:  except KeyError:
563     pass     pass
564  try:  try:
565     python_lib = env['python_lib']     python_libs = env['python_libs']
566  except KeyError:  except KeyError:
567     python_lib = None       python_libs = None
568  try:  try:
569     doxygen_path = env['doxygen_path']     doxygen_path = env['doxygen_path']
570  except KeyError:  except KeyError:
571     doxygen_path = None       doxygen_path = None
572  try:  try:
573     epydoc_path = env['epydoc_path']     epydoc_path = env['epydoc_path']
574  except KeyError:  except KeyError:
575     epydoc_path = None       epydoc_path = None
576  try:  try:
577     includes = env['papi_path']     includes = env['papi_path']
578     env.Append(CPPPATH = [includes,])     env.Append(CPPPATH = [includes,])
# Line 312  except KeyError: Line 586  except KeyError:
586  try:  try:
587     papi_libs = env['papi_libs']     papi_libs = env['papi_libs']
588  except KeyError:  except KeyError:
589     papi_libs = None       papi_libs = None
590    
591    
592  try:  try:
593     src_zipfile = env.File(env['src_zipfile'])     src_zipfile = env.File(env['src_zipfile'])
594  except KeyError:  except KeyError:
595     src_zipfile = None       src_zipfile = None
596  try:  try:
597     test_zipfile = env.File(env['test_zipfile'])     test_zipfile = env.File(env['test_zipfile'])
598  except KeyError:  except KeyError:
599     test_zipfile = None       test_zipfile = None
600  try:  try:
601     examples_zipfile = env.File(env['examples_zipfile'])     examples_zipfile = env.File(env['examples_zipfile'])
602  except KeyError:  except KeyError:
603     examples_zipfile = None       examples_zipfile = None
604    
605  try:  try:
606     src_tarfile = env.File(env['src_tarfile'])     src_tarfile = env.File(env['src_tarfile'])
607  except KeyError:  except KeyError:
608     src_tarfile = None       src_tarfile = None
609  try:  try:
610     test_tarfile = env.File(env['test_tarfile'])     test_tarfile = env.File(env['test_tarfile'])
611  except KeyError:  except KeyError:
612     test_tarfile = None       test_tarfile = None
613  try:  try:
614     examples_tarfile = env.File(env['examples_tarfile'])     examples_tarfile = env.File(env['examples_tarfile'])
615  except KeyError:  except KeyError:
616     examples_tarfile = None       examples_tarfile = None
617    
618  try:  try:
619     guide_pdf = env.File(env['guide_pdf'])     guide_pdf = env.File(env['guide_pdf'])
620  except KeyError:  except KeyError:
621     guide_pdf = None       guide_pdf = None
622    
623  try:  try:
624     guide_html_index = env.File('index.htm',env['guide_html'])     guide_html_index = env.File('index.htm',env['guide_html'])
625  except KeyError:  except KeyError:
626     guide_html_index = None       guide_html_index = None
627    
628  try:  try:
629     api_epydoc = env.Dir(env['api_epydoc'])     api_epydoc = env.Dir(env['api_epydoc'])
630  except KeyError:  except KeyError:
631     api_epydoc = None       api_epydoc = None
632    
633  # Zipgets  # Zipgets
     
634  env.Default(libinstall)  env.Default(libinstall)
635  env.Default(incinstall)  env.Default(incinstall)
636  env.Default(pyinstall)  env.Default(pyinstall)
637  env.Alias('release_src',[ src_zipfile, src_tarfile ])    env.Alias('release_src',[ src_zipfile, src_tarfile ])
638  env.Alias('release_tests',[ test_zipfile, test_tarfile])  env.Alias('release_tests',[ test_zipfile, test_tarfile])
639  env.Alias('release_examples',[ examples_zipfile, examples_tarfile])  env.Alias('release_examples',[ examples_zipfile, examples_tarfile])
640  env.Alias('api_epydoc',api_epydoc)  env.Alias('api_epydoc',api_epydoc)
641  env.Alias('docs',[ 'release_examples', guide_pdf, guide_html_index, api_epydoc])  env.Alias('guide_pdf', guide_pdf)
642    env.Alias('docs',[ 'release_examples', 'guide_pdf', guide_html_index, api_epydoc])
643  env.Alias('release', ['release_src', 'release_tests', 'docs'])  env.Alias('release', ['release_src', 'release_tests', 'docs'])
644  env.Alias('build_tests')    # target to build all C++ tests  env.Alias('build_tests')    # target to build all C++ tests
645  env.Alias('build_py_tests') # target to build all python tests  env.Alias('build_py_tests') # target to build all python tests
# Line 375  env.Alias('py_tests', 'build_py_tests') Line 649  env.Alias('py_tests', 'build_py_tests')
649  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
650    
651  # Python install - esys __init__.py  # Python install - esys __init__.py
652  # 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'))
653  # create the file if it doesn't exist  env.Alias(init_target)
 env.Command(pyinstall+'/__init__.py', None, 'touch $TARGET')  
654    
655  # Allow sconscripts to see the env  # Allow sconscripts to see the env
656  Export(["env", "incinstall", "libinstall", "pyinstall", "dodebug", "mkl_libs", "scsl_libs", "umf_libs",  Export(["IS_WINDOWS_PLATFORM", "env", "incinstall", "libinstall", "pyinstall", "dodebug", "mkl_libs", "scsl_libs", "umf_libs", "amd_libs", "blas_libs", "netCDF_libs", "useNetCDF",
657      "boost_lib", "python_lib", "doxygen_path", "epydoc_path", "papi_libs",      "boost_libs", "python_libs", "doxygen_path", "epydoc_path", "papi_libs",
658          "sys_libs", "test_zipfile", "src_zipfile", "test_tarfile", "src_tarfile", "examples_tarfile", "examples_zipfile",          "sys_libs", "test_zipfile", "src_zipfile", "test_tarfile", "src_tarfile", "examples_tarfile", "examples_zipfile",
659          "guide_pdf", "guide_html_index", "api_epydoc"])          "guide_pdf", "guide_html_index", "api_epydoc", "useMPI" ])
660    
661  # End initialisation section  # End initialisation section
662  # Begin configuration section  # Begin configuration section
# Line 392  release_srcfiles=[env.File('SConstruct') Line 665  release_srcfiles=[env.File('SConstruct')
665  release_testfiles=[env.File('README_TESTS'),]  release_testfiles=[env.File('README_TESTS'),]
666  env.Zip(src_zipfile, release_srcfiles)  env.Zip(src_zipfile, release_srcfiles)
667  env.Zip(test_zipfile, release_testfiles)  env.Zip(test_zipfile, release_testfiles)
668  env.Tar(src_tarfile, release_srcfiles)  try:
669  env.Tar(test_tarfile, release_testfiles)     env.Tar(src_tarfile, release_srcfiles)
670       env.Tar(test_tarfile, release_testfiles)
671    except AttributeError:
672       pass
673  # Insert new components to be build here  # Insert new components to be build here
674  # 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
675  # 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 402  env.Tar(test_tarfile, release_testfiles) Line 677  env.Tar(test_tarfile, release_testfiles)
677  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)
678  # C/C++ Libraries  # C/C++ Libraries
679  env.SConscript(dirs = ['paso/src'], build_dir='build/$PLATFORM/paso', duplicate=0)  env.SConscript(dirs = ['paso/src'], build_dir='build/$PLATFORM/paso', duplicate=0)
680  env.SConscript(dirs = ['bruce/src'], build_dir='build/$PLATFORM/bruce', duplicate=0)  # bruce is removed for now as it doesn't really do anything
681    # env.SConscript(dirs = ['bruce/src'], build_dir='build/$PLATFORM/bruce', duplicate=0)
682  env.SConscript(dirs = ['escript/src'], build_dir='build/$PLATFORM/escript', duplicate=0)  env.SConscript(dirs = ['escript/src'], build_dir='build/$PLATFORM/escript', duplicate=0)
683  env.SConscript(dirs = ['esysUtils/src'], build_dir='build/$PLATFORM/esysUtils', duplicate=0)  env.SConscript(dirs = ['esysUtils/src'], build_dir='build/$PLATFORM/esysUtils', duplicate=0)
684  env.SConscript(dirs = ['finley/src'], build_dir='build/$PLATFORM/finley', duplicate=0)  env.SConscript(dirs = ['finley/src'], build_dir='build/$PLATFORM/finley', duplicate=0)
685  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)
686  env.SConscript(dirs = ['doc'], build_dir='build/$PLATFORM/doc', duplicate=0)  env.SConscript(dirs = ['doc'], build_dir='build/$PLATFORM/doc', duplicate=0)
687  env.SConscript(dirs = ['pyvisi/py_src'], build_dir='build/$PLATFORM/pyvisi', duplicate=0)  env.SConscript(dirs = ['pyvisi/py_src'], build_dir='build/$PLATFORM/pyvisi', duplicate=0)
688    env.SConscript(dirs = ['pycad/py_src'], build_dir='build/$PLATFORM/pycad', duplicate=0)
689    
690    # added by Ben Cumming
691    env.SConscript(dirs = ['pythonMPI/src'], build_dir='build/$PLATFORM/pythonMPI', duplicate=0)
692    #env.SConscript(dirs = ['../test'], build_dir='../test/build', duplicate=0)

Legend:
Removed from v.722  
changed lines
  Added in v.1149

  ViewVC Help
Powered by ViewVC 1.1.26