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

Diff of /branches/windows_from_1456_trunk_1574_merged_in/SConstruct

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

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

Legend:
Removed from v.684  
changed lines
  Added in v.1217

  ViewVC Help
Powered by ViewVC 1.1.26