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

Annotation of /branches/diaplayground/SConstruct

Parent Directory Parent Directory | Revision Log Revision Log


Revision 1217 - (hide annotations)
Wed Jul 18 00:47:01 2007 UTC (11 years, 9 months ago) by ksteube
Original Path: trunk/SConstruct
File size: 26417 byte(s)
Can now install into /usr with scons prefix=/usr and get a typical
python package install. Setting PYTHONPATH and LD_LIBRARY_PATH is
not necessary.

1 jongui 961 # Copyright 2006 by ACcESS MNRF
2 jgs 214 #
3 matt 863 # 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 jgs 455
8 robwdcock 682 # top-level Scons configuration file for all esys13 modules
9     # Begin initialisation Section
10 matt 863 # all of this section just intialises default environments and helper
11 robwdcock 682 # scripts. You shouldn't need to modify this section.
12     EnsureSConsVersion(0,96,91)
13     EnsurePythonVersion(2,3)
14 jgs 214
15 gross 1133 #===============================================================
16     # import tools:
17 gross 700 import glob
18 robwdcock 682 import sys, os
19 matt 863 import socket
20 robwdcock 682 # Add our extensions
21     if sys.path.count('scons')==0: sys.path.append('scons')
22     import scons_extensions
23 jgs 192
24 gross 1133 #===============================================================
25     # check on windows or linux platform
26     #
27     IS_WINDOWS_PLATFORM = (os.name== "nt")
28 gross 806
29 gross 1133 if IS_WINDOWS_PLATFORM:
30     tools_prefix="C:\\Program Files\\"
31 gross 805 else:
32 gross 1149 tools_prefix="/usr"
33 gross 806
34 gross 1133 #==============================================================================================
35     #
36 ksteube 1215 # get the installation prefix
37 gross 1133 #
38     prefix = ARGUMENTS.get('prefix', Dir('#.').abspath)
39 ksteube 1217
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 gross 1133 print "Install prefix is: ", prefix
65 ksteube 1217 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 gross 806
69 ksteube 1217 #==============================================================================================
70    
71 robwdcock 682 # Default options and options help text
72     # 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
74     # DO NOT CHANGE THEM HERE
75 ksteube 1083 # Where to install?
76 gross 1133 #==============================================================================================
77     #
78     # get the options file if present:
79     #
80 robwdcock 682 if ARGUMENTS.get('options_file',0):
81     options_file = ARGUMENTS.get('options_file',0)
82     else:
83     from string import ascii_letters,digits
84     hostname=""
85     for s in socket.gethostname().split('.')[0]:
86     if s in ascii_letters+digits:
87     hostname+=s
88     else:
89     hostname+="_"
90 gross 1141 options_file = os.path.join("scons",hostname+"_options.py")
91 gross 1133
92 gross 1028 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 gross 1133 # and load it
97     opts = Options(options_file, ARGUMENTS)
98     #================================================================
99     #
100     # check if UMFPACK is installed on the system:
101     #
102 gross 1149 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 gross 1133 else:
117 gross 1149 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 gross 1133 #==========================================================================
126     #
127     # python installation:
128     #
129     if IS_WINDOWS_PLATFORM:
130 gross 1149 python_path_default=os.path.join(tools_prefix,'python%s%s'%(sys.version_info[0],sys.version_info[1]),"include")
131 gross 1185 python_lib_path_default=os.path.join(tools_prefix,'python%s%s'%(sys.version_info[0],sys.version_info[1]),"libs")
132 gross 1133 python_libs_default=["python%s%s"%(sys.version_info[0],sys.version_info[1])]
133     else:
134 gross 1149 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 gross 1133 python_libs_default=["python%s.%s"%(sys.version_info[0],sys.version_info[1])]
137 gross 1149
138 gross 1133 #==========================================================================
139     #
140     # boost installation:
141     #
142     if IS_WINDOWS_PLATFORM:
143 gross 1149 boost_libs_path_default=os.path.join(tools_prefix,'boost','lib')
144 gross 1133 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 gross 1149 boost_path_default=os.path.join(tools_prefix,'boost','include','boost-%s'%(boost_libs_default[0].split("-")[-1],))
153 gross 1133 else:
154 gross 1149 boost_path_default=os.path.join(tools_prefix,'include')
155     boost_libs_path_default=os.path.join(tools_prefix,'lib')
156 gross 1133 boost_libs_default=['boost_python']
157     #==========================================================================
158     #
159     # check if netCDF is installed on the system:
160     #
161 gross 1149 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 gross 1141 useNetCDF_default='no' # be default netcdf is not supported on windows.
180 gross 1133 #==========================================================================
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 gross 1141 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 gross 1133 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 robwdcock 682 opts.AddOptions(
206     # Where to install esys stuff
207 ksteube 1217 ('incinstall', 'where the esys headers will be installed', Dir('#.').abspath+'/include'),
208     ('libinstall', 'where the esys libraries will be installed', dir_libraries),
209     ('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 ksteube 1215 ('api_doxygen', 'name of the doxygen api docs directory',prefix+"/release/doc/doxygen"),
221 robwdcock 682 # Compilation options
222 gross 700 BoolOption('dodebug', 'Do you want a debug build?', 'no'),
223 gross 1133 ('options_file', "Optional file containing preferred options. Ignored if it doesn't exist (default: scons/<hostname>_options.py)", options_file),
224 robwdcock 682 ('cc_defines','C/C++ defines to use', None),
225 gross 1133 ('cc_flags','C compiler flags to use (Release build)', cc_flags_default),
226     ('cc_flags_debug', 'C compiler flags to use (Debug build)', cc_flags_debug_default),
227     ('cxx_flags', 'C++ compiler flags to use (Release build)', cxx_flags_default),
228     ('cxx_flags_debug', 'C++ compiler flags to use (Debug build)', cxx_flags_debug_default),
229 robwdcock 682 ('ar_flags', 'Static library archiver flags to use', None),
230     ('sys_libs', 'System libraries to link with', None),
231 gross 700 ('tar_flags','flags for zip files','-c -z'),
232 robwdcock 682 # MKL
233 matt 863 PathOption('mkl_path', 'Path to MKL includes', None),
234     PathOption('mkl_lib_path', 'Path to MKL libs', None),
235 robwdcock 682 ('mkl_libs', 'MKL libraries to link with', None),
236     # SCSL
237 matt 863 PathOption('scsl_path', 'Path to SCSL includes', None),
238     PathOption('scsl_lib_path', 'Path to SCSL libs', None),
239 robwdcock 682 ('scsl_libs', 'SCSL libraries to link with', None),
240 bcumming 759 ('scsl_libs_MPI', 'SCSL libraries to link with for MPI build', None),
241 matt 863 # UMFPACK
242     PathOption('ufc_path', 'Path to UFconfig includes', ufc_path_default),
243     PathOption('umf_path', 'Path to UMFPACK includes', umf_path_default),
244     PathOption('umf_lib_path', 'Path to UMFPACK libs', umf_lib_path_default),
245 gross 806 ('umf_libs', 'UMFPACK libraries to link with', umf_libs_default),
246     # AMD (used by UMFPACK)
247 matt 863 PathOption('amd_path', 'Path to AMD includes', amd_path_default),
248     PathOption('amd_lib_path', 'Path to AMD libs', amd_lib_path_default),
249 gross 806 ('amd_libs', 'AMD libraries to link with', amd_libs_default),
250 gross 805 # BLAS
251 matt 863 PathOption('blas_path', 'Path to BLAS includes', None),
252     PathOption('blas_lib_path', 'Path to BLAS libs', None),
253 gross 806 ('blas_libs', 'BLAS libraries to link with', None),
254 gross 950 # netCDF
255 gross 1133 ('useNetCDF', 'switch on/off the usage of netCDF', useNetCDF_default),
256 gross 1028 PathOption('netCDF_path', 'Path to netCDF includes', netCDF_path_default),
257     PathOption('netCDF_lib_path', 'Path to netCDF libs', netCDF_lib_path_default),
258 gross 1133 ('netCDF_libs', 'netCDF C++ libraries to link with', netCDF_libs_default),
259 robwdcock 682 # Python
260 gross 685 # locations of include files for python
261 gross 1133 PathOption('python_path', 'Path to Python includes', python_path_default),
262     PathOption('python_lib_path', 'Path to Python libs', python_lib_path_default),
263     ('python_libs', 'Python libraries to link with', python_libs_default),
264 robwdcock 682 # Boost
265 gross 1133 PathOption('boost_path', 'Path to Boost includes', boost_path_default),
266     PathOption('boost_libs_path', 'Path to Boost libs', boost_libs_path_default),
267     ('boost_libs', 'Boost libraries to link with', boost_libs_default),
268 robwdcock 682 # Doc building
269 ksteube 1216 # PathOption('doxygen_path', 'Path to Doxygen executable', None),
270 matt 863 # PathOption('epydoc_path', 'Path to Epydoc executable', None),
271 robwdcock 682 # PAPI
272 matt 863 PathOption('papi_path', 'Path to PAPI includes', None),
273     PathOption('papi_lib_path', 'Path to PAPI libs', None),
274 robwdcock 682 ('papi_libs', 'PAPI libraries to link with', None),
275 bcumming 759 # MPI
276     BoolOption('useMPI', 'Compile parallel version using MPI', 'no'),
277 robwdcock 682 )
278 gross 1133 #=================================================================================================
279     #
280     # 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 robwdcock 682 else:
291 gross 1133 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 gross 1024 try:
303     python_path = os.environ['PYTHONPATH']
304     env['ENV']['PYTHONPATH'] = python_path
305     except KeyError:
306     python_path = ''
307    
308     try:
309 gross 1160 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 gross 1163 env['ENV']['DISPLAY'] = os.environ['DISPLAY']
316 jongui 1164 env['ENV']['XAUTHORITY'] = os.environ['XAUTHORITY']
317 gross 1163 except KeyError:
318     pass
319    
320     try:
321 gross 1024 path = os.environ['PATH']
322 robwdcock 684 env['ENV']['PATH'] = path
323 gross 1024 except KeyError:
324     path = ''
325     try:
326     ld_library_path = os.environ['LD_LIBRARY_PATH']
327 robwdcock 684 env['ENV']['LD_LIBRARY_PATH'] = ld_library_path
328 gross 1024 except KeyError:
329     ld_library_path = ''
330 gross 1133 #==========================================================================
331     #
332     # Add some customer builders
333     #
334 robwdcock 682 py_builder = Builder(action = scons_extensions.build_py, suffix = '.pyc', src_suffix = '.py', single_source=True)
335     env.Append(BUILDERS = {'PyCompile' : py_builder});
336    
337 gross 1133 if IS_WINDOWS_PLATFORM:
338 robwdcock 682 runUnitTest_builder = Builder(action = scons_extensions.runUnitTest, suffix = '.passed', src_suffix='.exe', single_source=True)
339     else:
340     runUnitTest_builder = Builder(action = scons_extensions.runUnitTest, suffix = '.passed', single_source=True)
341     env.Append(BUILDERS = {'RunUnitTest' : runUnitTest_builder});
342    
343     runPyUnitTest_builder = Builder(action = scons_extensions.runPyUnitTest, suffix = '.passed', src_suffic='.py', single_source=True)
344     env.Append(BUILDERS = {'RunPyUnitTest' : runPyUnitTest_builder});
345    
346     # Convert the options which are held in environment variable into python variables for ease of handling and configure compilation options
347     try:
348     incinstall = env['incinstall']
349     env.Append(CPPPATH = [incinstall,])
350     except KeyError:
351 matt 863 incinstall = None
352 robwdcock 682 try:
353     libinstall = env['libinstall']
354 ksteube 1215 env.Append(LIBPATH = [libinstall,]) # Adds -L for building of libescript.so libfinley.so escriptcpp.so finleycpp.so
355 robwdcock 682 env.PrependENVPath('LD_LIBRARY_PATH', libinstall)
356 woo409 757 if env['PLATFORM'] == "win32":
357     env.PrependENVPath('PATH', libinstall)
358 gross 1133 env.PrependENVPath('PATH', env['boost_libs_path'])
359 robwdcock 682 except KeyError:
360 matt 863 libinstall = None
361 robwdcock 682 try:
362 ksteube 1217 pyinstall = env['pyinstall'] # all targets will install into pyinstall/esys but PYTHONPATH points at straight pyinstall so you go import esys.escript etc
363 robwdcock 682 env.PrependENVPath('PYTHONPATH', env['pyinstall'])
364     except KeyError:
365 matt 863 pyinstall = None
366 robwdcock 682 try:
367 ksteube 1217 exinstall = env['exinstall']
368     except KeyError:
369     exinstall = None
370     try:
371 robwdcock 682 dodebug = env['dodebug']
372     except KeyError:
373 matt 863 dodebug = None
374 robwdcock 682 try:
375 bcumming 759 useMPI = env['useMPI']
376     except KeyError:
377 matt 863 useMPI = None
378 bcumming 759 try:
379 robwdcock 682 cc_defines = env['cc_defines']
380 woo409 757 env.Append(CPPDEFINES = cc_defines)
381 robwdcock 682 except KeyError:
382     pass
383 ksteube 817
384 robwdcock 682 if dodebug:
385 bcumming 759 if useMPI:
386     try:
387     flags = env['cc_flags_debug_MPI']
388     env.Append(CCFLAGS = flags)
389     except KeyError:
390     pass
391 matt 863 else:
392 bcumming 759 try:
393 robwdcock 682 flags = env['cc_flags_debug']
394     env.Append(CCFLAGS = flags)
395 bcumming 759 except KeyError:
396 robwdcock 682 pass
397     else:
398 bcumming 759 if useMPI:
399 robwdcock 682 try:
400 bcumming 759 flags = env['cc_flags_MPI']
401     env.Append(CCFLAGS = flags)
402     except KeyError:
403     pass
404     else:
405     try:
406 robwdcock 682 flags = env['cc_flags']
407     env.Append(CCFLAGS = flags)
408     except KeyError:
409     pass
410     if dodebug:
411 bcumming 759 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 robwdcock 682 else:
424 bcumming 759 if useMPI:
425     try:
426     flags = env['cxx_flags_MPI']
427     env.Append(CXXFLAGS = flags)
428     except KeyError:
429     pass
430     else:
431     try:
432     flags = env['cxx_flags']
433     env.Append(CXXFLAGS = flags)
434     except KeyError:
435     pass
436 robwdcock 682 try:
437     flags = env['ar_flags']
438     env.Append(ARFLAGS = flags)
439     except KeyError:
440 matt 863 ar_flags = None
441 robwdcock 682 try:
442     sys_libs = env['sys_libs']
443     except KeyError:
444 gross 1133 sys_libs = []
445 robwdcock 682
446     try:
447 gross 700 tar_flags = env['tar_flags']
448     env.Replace(TARFLAGS = tar_flags)
449     except KeyError:
450     pass
451    
452     try:
453 robwdcock 682 includes = env['mkl_path']
454     env.Append(CPPPATH = [includes,])
455     except KeyError:
456     pass
457 gross 700
458 robwdcock 682 try:
459     lib_path = env['mkl_lib_path']
460     env.Append(LIBPATH = [lib_path,])
461     except KeyError:
462     pass
463 gross 700
464 gross 806 if useMPI:
465 gross 1133 mkl_libs = []
466 gross 806 else:
467     try:
468     mkl_libs = env['mkl_libs']
469     except KeyError:
470 gross 1133 mkl_libs = []
471 gross 806
472 robwdcock 682 try:
473     includes = env['scsl_path']
474     env.Append(CPPPATH = [includes,])
475     except KeyError:
476     pass
477 gross 806
478 robwdcock 682 try:
479     lib_path = env['scsl_lib_path']
480     env.Append(LIBPATH = [lib_path,])
481     except KeyError:
482     pass
483 gross 806
484 matt 863 if useMPI:
485 bcumming 759 try:
486     scsl_libs = env['scsl_libs_MPI']
487     except KeyError:
488 gross 1133 scsl_libs = []
489 matt 863 else:
490 bcumming 759 try:
491     scsl_libs = env['scsl_libs']
492     except KeyError:
493 gross 1133 scsl_libs = []
494 gross 805
495 robwdcock 682 try:
496     includes = env['umf_path']
497     env.Append(CPPPATH = [includes,])
498     except KeyError:
499     pass
500 gross 805
501 robwdcock 682 try:
502     lib_path = env['umf_lib_path']
503     env.Append(LIBPATH = [lib_path,])
504     except KeyError:
505     pass
506 gross 805
507 matt 863 if useMPI:
508 gross 1133 umf_libs = []
509 gross 806 else:
510     try:
511     umf_libs = env['umf_libs']
512     except KeyError:
513 gross 1133 umf_libs = []
514 gross 806
515 robwdcock 682 try:
516 gross 806 includes = env['ufc_path']
517     env.Append(CPPPATH = [includes,])
518 gross 805 except KeyError:
519     pass
520    
521     try:
522 gross 806 includes = env['amd_path']
523     env.Append(CPPPATH = [includes,])
524 robwdcock 682 except KeyError:
525 gross 806 pass
526 gross 805
527 robwdcock 682 try:
528 gross 806 lib_path = env['amd_lib_path']
529     env.Append(LIBPATH = [lib_path,])
530     except KeyError:
531     pass
532    
533 matt 863 if useMPI:
534 gross 1133 amd_libs = []
535 gross 806 else:
536     try:
537     amd_libs = env['amd_libs']
538     except KeyError:
539 gross 1133 amd_libs = []
540 gross 806
541     try:
542 gross 805 includes = env['blas_path']
543     env.Append(CPPPATH = [includes,])
544     except KeyError:
545     pass
546 gross 806
547 gross 805 try:
548     lib_path = env['blas_lib_path']
549     env.Append(LIBPATH = [lib_path,])
550     except KeyError:
551     pass
552 gross 806
553 gross 805 try:
554     blas_libs = env['blas_libs']
555     except KeyError:
556 gross 1133 blas_libs = []
557 gross 805
558     try:
559 gross 1023 useNetCDF = env['useNetCDF']
560 gross 950 except KeyError:
561 gross 1023 useNetCDF = 'yes'
562 gross 950 pass
563    
564 gross 1023 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 gross 950
574 gross 1023 try:
575     lib_path = env['netCDF_lib_path']
576 gross 1133 if IS_WINDOWS_PLATFORM: env['ENV']['PATH']+=";"+lib_path
577     env.Append(LIBPATH = [ lib_path, ])
578 gross 1023 except KeyError:
579     pass
580 gross 950
581 gross 1023 try:
582 gross 1133 netCDF_libs = env['netCDF_libs']
583 gross 1023 except KeyError:
584 gross 1133 netCDF_libs = [ ]
585 gross 1023 else:
586 gross 1133 netCDF_libs=[ ]
587 gross 1023
588 gross 950 try:
589 robwdcock 682 includes = env['boost_path']
590     env.Append(CPPPATH = [includes,])
591     except KeyError:
592     pass
593     try:
594 gross 1133 lib_path = env['boost_libs_path']
595 robwdcock 682 env.Append(LIBPATH = [lib_path,])
596     except KeyError:
597     pass
598     try:
599 gross 1133 boost_libs = env['boost_libs']
600 robwdcock 682 except KeyError:
601 gross 1133 boost_libs = None
602 robwdcock 682 try:
603     includes = env['python_path']
604     env.Append(CPPPATH = [includes,])
605     except KeyError:
606     pass
607     try:
608     lib_path = env['python_lib_path']
609     env.Append(LIBPATH = [lib_path,])
610     except KeyError:
611     pass
612     try:
613 gross 1133 python_libs = env['python_libs']
614 robwdcock 682 except KeyError:
615 gross 1133 python_libs = None
616 robwdcock 682 try:
617     doxygen_path = env['doxygen_path']
618     except KeyError:
619 matt 863 doxygen_path = None
620 robwdcock 682 try:
621     epydoc_path = env['epydoc_path']
622     except KeyError:
623 matt 863 epydoc_path = None
624 robwdcock 682 try:
625     includes = env['papi_path']
626     env.Append(CPPPATH = [includes,])
627     except KeyError:
628     pass
629     try:
630     lib_path = env['papi_lib_path']
631     env.Append(LIBPATH = [lib_path,])
632     except KeyError:
633     pass
634     try:
635     papi_libs = env['papi_libs']
636     except KeyError:
637 matt 863 papi_libs = None
638 robwdcock 682
639 gross 707
640 gross 700 try:
641 gross 707 src_zipfile = env.File(env['src_zipfile'])
642 gross 700 except KeyError:
643 matt 863 src_zipfile = None
644 gross 700 try:
645 gross 707 test_zipfile = env.File(env['test_zipfile'])
646 gross 700 except KeyError:
647 matt 863 test_zipfile = None
648 gross 707 try:
649     examples_zipfile = env.File(env['examples_zipfile'])
650     except KeyError:
651 matt 863 examples_zipfile = None
652 gross 700
653     try:
654 gross 707 src_tarfile = env.File(env['src_tarfile'])
655 gross 700 except KeyError:
656 matt 863 src_tarfile = None
657 gross 700 try:
658 gross 707 test_tarfile = env.File(env['test_tarfile'])
659 gross 700 except KeyError:
660 matt 863 test_tarfile = None
661 gross 707 try:
662     examples_tarfile = env.File(env['examples_tarfile'])
663     except KeyError:
664 matt 863 examples_tarfile = None
665 gross 700
666     try:
667 gross 707 guide_pdf = env.File(env['guide_pdf'])
668 gross 700 except KeyError:
669 matt 863 guide_pdf = None
670 gross 700
671 gross 707 try:
672     guide_html_index = env.File('index.htm',env['guide_html'])
673     except KeyError:
674 matt 863 guide_html_index = None
675 gross 707
676 elspeth 712 try:
677     api_epydoc = env.Dir(env['api_epydoc'])
678     except KeyError:
679 matt 863 api_epydoc = None
680 elspeth 712
681 ksteube 1215 try:
682     api_doxygen = env.Dir(env['api_doxygen'])
683     except KeyError:
684     api_doxygen = None
685    
686 gross 700 # Zipgets
687 robwdcock 682 env.Default(libinstall)
688     env.Default(incinstall)
689     env.Default(pyinstall)
690 ksteube 1217 ### env.Default(exinstall) # ksteube this causes dependency error
691 matt 863 env.Alias('release_src',[ src_zipfile, src_tarfile ])
692 gross 700 env.Alias('release_tests',[ test_zipfile, test_tarfile])
693 gross 707 env.Alias('release_examples',[ examples_zipfile, examples_tarfile])
694 ksteube 1215 env.Alias('examples_zipfile',examples_zipfile)
695     env.Alias('examples_tarfile',examples_tarfile)
696 gross 720 env.Alias('api_epydoc',api_epydoc)
697 ksteube 1215 env.Alias('api_doxygen',api_doxygen)
698     env.Alias('guide_html_index',guide_html_index)
699 gross 807 env.Alias('guide_pdf', guide_pdf)
700 ksteube 1216 env.Alias('docs',[ 'release_examples', 'guide_pdf', api_epydoc, api_doxygen, guide_html_index])
701 gross 707 env.Alias('release', ['release_src', 'release_tests', 'docs'])
702 gross 705 env.Alias('build_tests') # target to build all C++ tests
703     env.Alias('build_py_tests') # target to build all python tests
704 gross 706 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 gross 705 env.Alias('all_tests', ['run_tests', 'py_tests']) # target to run all C++ and released python tests
708 robwdcock 682
709     # Python install - esys __init__.py
710 woo409 757 init_target = env.Command(pyinstall+'/__init__.py', None, Touch('$TARGET'))
711     env.Alias(init_target)
712 robwdcock 682
713     # Allow sconscripts to see the env
714 ksteube 1217 Export(["IS_WINDOWS_PLATFORM", "env", "incinstall", "libinstall", "pyinstall", "exinstall", "dodebug", "mkl_libs", "scsl_libs", "umf_libs", "amd_libs", "blas_libs", "netCDF_libs", "useNetCDF",
715 gross 1133 "boost_libs", "python_libs", "doxygen_path", "epydoc_path", "papi_libs",
716 gross 707 "sys_libs", "test_zipfile", "src_zipfile", "test_tarfile", "src_tarfile", "examples_tarfile", "examples_zipfile",
717 ksteube 1215 "guide_pdf", "guide_html_index", "api_epydoc", "api_doxygen", "useMPI" ])
718 robwdcock 682
719     # End initialisation section
720     # Begin configuration section
721 gross 700 # 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 gross 706 env.Zip(src_zipfile, release_srcfiles)
725 gross 700 env.Zip(test_zipfile, release_testfiles)
726 gross 1133 try:
727     env.Tar(src_tarfile, release_srcfiles)
728     env.Tar(test_tarfile, release_testfiles)
729     except AttributeError:
730     pass
731 robwdcock 682 # Insert new components to be build here
732     # 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
734     # Third Party libraries
735     env.SConscript(dirs = ['tools/CppUnitTest/src'], build_dir='build/$PLATFORM/tools/CppUnitTest', duplicate=0)
736     # C/C++ Libraries
737     env.SConscript(dirs = ['paso/src'], build_dir='build/$PLATFORM/paso', duplicate=0)
738 gross 958 # 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 robwdcock 682 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)
742     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)
744 gross 707 env.SConscript(dirs = ['doc'], build_dir='build/$PLATFORM/doc', duplicate=0)
745 matt 863 env.SConscript(dirs = ['pyvisi/py_src'], build_dir='build/$PLATFORM/pyvisi', duplicate=0)
746 gross 898 env.SConscript(dirs = ['pycad/py_src'], build_dir='build/$PLATFORM/pycad', duplicate=0)
747 bcumming 751
748     # added by Ben Cumming
749 matt 863 env.SConscript(dirs = ['pythonMPI/src'], build_dir='build/$PLATFORM/pythonMPI', duplicate=0)
750 bcumming 784 #env.SConscript(dirs = ['../test'], build_dir='../test/build', duplicate=0)

  ViewVC Help
Powered by ViewVC 1.1.26