/[escript]/branches/scons-dev/SConstruct
ViewVC logotype

Contents of /branches/scons-dev/SConstruct

Parent Directory Parent Directory | Revision Log Revision Log


Revision 1671 - (show annotations)
Thu Jul 24 04:33:41 2008 UTC (14 years ago) by ksteube
File size: 23281 byte(s)
Now detecting and using UMFPACK, MKL

1 # Copyright 2006 by ACcESS MNRF
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 # TODO How to modify CCFLAGS for only one file? Look for example with Program(...)
9
10 EnsureSConsVersion(0,96,91)
11 EnsurePythonVersion(2,3)
12
13 import sys, os, re, socket
14
15 # Add our extensions
16 if os.path.isdir('scons'): sys.path.append('scons')
17 import scons_extensions
18
19 # The string python2.4 or python2.5
20 python_version = 'python%s.%s' % (sys.version_info[0], sys.version_info[1])
21
22 # MS Windows support, many thanks to PH
23 IS_WINDOWS_PLATFORM = (os.name== "nt")
24
25 prefix = ARGUMENTS.get('prefix', Dir('#.').abspath)
26
27 # Read configuration options from file scons/<hostname>_options.py
28 hostname = re.sub("[^0-9a-zA-Z]", "_", socket.gethostname().split('.')[0])
29 tmp = os.path.join("scons",hostname+"_options.py")
30 options_file = ARGUMENTS.get('options_file', tmp)
31 if not os.path.isfile(options_file): options_file = False
32
33 # Load options file and command-line arguments
34 opts = Options(options_file, ARGUMENTS)
35
36 ############ Load build options ################################
37
38 opts.AddOptions(
39 # Where to install esys stuff
40 ('prefix', 'where everything will be installed', Dir('#.').abspath),
41 ('incinstall', 'where the esys headers will be installed', Dir('#.').abspath+'/include'),
42 ('libinstall', 'where the esys libraries will be installed', os.path.join(prefix,"lib")),
43 ('pyinstall', 'where the esys python modules will be installed', os.path.join(prefix,"esys")),
44 # Compilation options
45 BoolOption('dodebug', 'For backwards compatibility', 'no'),
46 BoolOption('usedebug', 'Do you want a debug build?', 'no'),
47 BoolOption('usevtk', 'Do you want to use VTK?', 'yes'),
48 ('options_file', "File of paths/options. Default: scons/<hostname>_options.py", options_file),
49 # The strings -DDEFAULT_ get replaced by scons/<hostname>_options.py or by defaults below
50 ('cc_flags', 'C compiler flags to use', '-DEFAULT_1'),
51 ('cc_optim', 'C compiler optimization flags to use', '-DEFAULT_2'),
52 ('cc_debug', 'C compiler debug flags to use', '-DEFAULT_3'),
53 ('omp_optim', 'OpenMP compiler flags to use (Release build)', '-DEFAULT_4'),
54 ('omp_debug', 'OpenMP compiler flags to use (Debug build)', '-DEFAULT_5'),
55 ('sys_libs', 'System libraries to link with', []),
56 ('ar_flags', 'Static library archiver flags to use', ''),
57 BoolOption('useopenmp', 'Compile parallel version using OpenMP', 'yes'),
58 # Python
59 ('python_path', 'Path to Python includes', '/usr/include/'+python_version),
60 ('python_lib_path', 'Path to Python libs', '/usr/lib'),
61 ('python_libs', 'Python libraries to link with', [python_version]),
62 ('python_cmd', 'Python command', 'python'),
63 # Boost
64 ('boost_path', 'Path to Boost includes', "/usr/include"),
65 ('boost_lib_path', 'Path to Boost libs', '/usr/lib'),
66 ('boost_libs', 'Boost libraries to link with', ['boost_python']),
67 # NetCDF
68 BoolOption('usenetcdf', 'switch on/off the usage of netCDF', 'yes'),
69 ('netCDF_path', 'Path to netCDF includes', '/usr/include'),
70 ('netCDF_lib_path', 'Path to netCDF libs', '/usr/lib'),
71 ('netCDF_libs', 'netCDF C++ libraries to link with', ['netcdf_c++', 'netcdf']),
72 # MPI
73 BoolOption('useMPI', 'For backwards compatibility', 'no'),
74 BoolOption('usempi', 'Compile parallel version using MPI', 'no'),
75 ('MPICH_IGNORE_CXX_SEEK', 'name of macro to ignore MPI settings of C++ SEEK macro (for MPICH)' , 'MPICH_IGNORE_CXX_SEEK'),
76 ('mpi_path', 'Path to MPI includes', '/usr/include'),
77 ('mpi_run', 'mpirun name' , 'mpiexec -np 1'),
78 ('mpi_lib_path', 'Path to MPI libs (needs to be added to the LD_LIBRARY_PATH)', '/usr/lib'),
79 ('mpi_libs', 'MPI libraries to link with (needs to be shared!)', ['mpich' , 'pthread', 'rt']),
80 # ParMETIS
81 BoolOption('useparmetis', 'Compile parallel version using ParMETIS', 'yes'),
82 ('parmetis_path', 'Path to ParMETIS includes', '/usr/include'),
83 ('parmetis_lib_path', 'Path to ParMETIS library', '/usr/lib'),
84 ('parmetis_libs', 'ParMETIS library to link with', []),
85 # PAPI
86 BoolOption('usepapi', 'switch on/off the usage of PAPI', 'no'),
87 ('papi_path', 'Path to PAPI includes', '/usr/include'),
88 ('papi_lib_path', 'Path to PAPI libs', '/usr/lib'),
89 ('papi_libs', 'PAPI libraries to link with', ['papi']),
90 BoolOption('papi_instrument_solver', 'use PAPI in Solver.c to instrument each iteration of the solver', False),
91 # MKL
92 BoolOption('usemkl', 'switch on/off the usage of MKL', 'yes'),
93 ('mkl_path', 'Path to MKL includes', '/opt/intel/mkl80.019/include'),
94 ('mkl_lib_path', 'Path to MKL libs', '/opt/intel/mkl80.019/lib/64'),
95 ('mkl_libs', 'MKL libraries to link with', ['mkl_solver', 'mkl_lapack', 'mkl_em64t']),
96 # UMFPACK
97 BoolOption('useumfpack', 'switch on/off the usage of UMFPACK', 'yes'),
98 ('ufc_path', 'Path to UFconfig includes', '/usr/include/suitesparse'),
99 ('umf_path', 'Path to UMFPACK includes', '/usr/include/suitesparse'),
100 ('umf_lib_path', 'Path to UMFPACK libs', '/usr/lib'),
101 ('umf_libs', 'UMFPACK libraries to link with', ['umfpack']),
102 # AMD (used by UMFPACK)
103 ('amd_path', 'Path to AMD includes', '/usr/include/suitesparse'),
104 ('amd_lib_path', 'Path to AMD libs', '/usr/lib'),
105 ('amd_libs', 'AMD libraries to link with', ['amd']),
106 # BLAS (used by UMFPACK)
107 ('blas_path', 'Path to BLAS includes', '/usr/include/suitesparse'),
108 ('blas_lib_path', 'Path to BLAS libs', '/usr/lib'),
109 ('blas_libs', 'BLAS libraries to link with', ['blas'])
110 )
111
112 ############ Specify which compilers to use ####################
113
114 # intelc uses regular expressions improperly and emits a warning about
115 # failing to find the compilers. This warning can be safely ignored.
116
117 if IS_WINDOWS_PLATFORM:
118 env = Environment(tools = ['default', 'msvc'], options = opts)
119 else:
120 if socket.gethostname().split('.')[0] == 'service0':
121 env = Environment(tools = ['default', 'intelc'], options = opts)
122 elif os.uname()[4]=='ia64':
123 env = Environment(tools = ['default', 'intelc'], options = opts)
124 if env['CXX'] == 'icpc':
125 env['LINK'] = env['CXX'] # version >=9 of intel c++ compiler requires use of icpc to link in C++ runtimes (icc does not)
126 else:
127 env = Environment(tools = ['default'], options = opts)
128 Help(opts.GenerateHelpText(env))
129
130 ############ Fill in compiler options if not set above #########
131
132 # Backwards compatibility: allow dodebug=yes and useMPI=yes
133 if env['dodebug']: env['usedebug'] = 1
134 if env['useMPI']: env['usempi'] = 1
135
136 # Default compiler options (override allowed in hostname_options.py, but should not be necessary)
137 # For both C and C++ you get: cc_flags and either the optim flags or debug flags
138
139 if env["CC"] == "icc":
140 # Intel compilers
141 cc_flags = "-fPIC -ansi -wd161 -w1 -vec-report0 -DBLOCKTIMER -DCORE_ID1"
142 cc_optim = "-O3 -ftz -IPF_ftlacc- -IPF_fma -fno-alias"
143 cc_debug = "-g -O0 -UDOASSERT -DDOPROF -DBOUNDS_CHECK"
144 omp_optim = "-openmp -openmp_report0"
145 omp_debug = "-openmp -openmp_report0"
146 elif env["CC"] == "gcc":
147 # GNU C on any system
148 cc_flags = "-fPIC -ansi -ffast-math -Wno-unknown-pragmas -pedantic-errors -Wno-long-long -DBLOCKTIMER"
149 cc_optim = "-O3"
150 cc_debug = "-g -O0 -UDOASSERT -DDOPROF -DBOUNDS_CHECK"
151 omp_optim = ""
152 omp_debug = ""
153 elif env["CC"] == "cl":
154 # Microsoft Visual C on Windows
155 cc_flags = "/FD /EHsc /GR /wd4068 -D_USE_MATH_DEFINES -DDLL_NETCDF"
156 cc_optim = "/O2 /Op /MT /W3"
157 cc_debug = "/Od /RTC1 /MTd /ZI -DBOUNDS_CHECK"
158 omp_optim = ""
159 omp_debug = ""
160
161 # If not specified in hostname_options.py then set them here
162 if env["cc_flags"] == "-DEFAULT_1": env['cc_flags'] = cc_flags
163 if env["cc_optim"] == "-DEFAULT_2": env['cc_optim'] = cc_optim
164 if env["cc_debug"] == "-DEFAULT_3": env['cc_debug'] = cc_debug
165 if env["omp_optim"] == "-DEFAULT_4": env['omp_optim'] = omp_optim
166 if env["omp_debug"] == "-DEFAULT_5": env['omp_debug'] = omp_debug
167
168 # OpenMP is disabled if useopenmp=no or both variables omp_optim and omp_debug are empty
169 if not env["useopenmp"]:
170 env['omp_optim'] = ""
171 env['omp_debug'] = ""
172
173 if env['omp_optim'] == "" and env['omp_debug'] == "": env["useopenmp"] = 0
174
175 ############ Copy environment variables into scons env #########
176
177 try: env['ENV']['OMP_NUM_THREADS'] = os.environ['OMP_NUM_THREADS']
178 except KeyError: env['ENV']['OMP_NUM_THREADS'] = 1
179
180 try: env['ENV']['PATH'] = os.environ['PATH']
181 except KeyError: pass
182
183 try: env['ENV']['PYTHONPATH'] = os.environ['PYTHONPATH']
184 except KeyError: pass
185
186 try: env['ENV']['LD_LIBRARY_PATH'] = os.environ['LD_LIBRARY_PATH']
187 except KeyError: pass
188
189 try: env['ENV']['LIBRARY_PATH'] = os.environ['LIBRARY_PATH']
190 except KeyError: pass
191
192 try: env['ENV']['DISPLAY'] = os.environ['DISPLAY']
193 except KeyError: pass
194
195 try: env['ENV']['XAUTHORITY'] = os.environ['XAUTHORITY']
196 except KeyError: pass
197
198 try: env['ENV']['HOME'] = os.environ['HOME']
199 except KeyError: pass
200
201 # Configure for test suite
202 env.PrependENVPath('PYTHONPATH', prefix)
203 env.PrependENVPath('LD_LIBRARY_PATH', env['libinstall'])
204
205 ############ Set up paths for Configure() ######################
206
207 # Make a copy of an environment
208 # Use env.Clone if available, but fall back on env.Copy for older version of scons
209 def clone_env(env):
210 if 'Clone' in dir(env): return env.Clone() # scons-0.98
211 else: return env.Copy() # scons-0.96
212
213 # Add cc option -I<Escript>/trunk/include
214 env.Append(CPPPATH = [Dir('include')])
215
216 # Add cc option -L<Escript>/trunk/lib
217 env.Append(LIBPATH = [Dir('lib')])
218
219 env.Append(CPPDEFINES = ['ESCRIPT_EXPORTS', 'FINLEY_EXPORTS'])
220
221 # Get the global Subversion revision number for getVersion() method
222 try:
223 global_revision = os.popen("svnversion -n .").read()
224 global_revision = re.sub(":.*", "", global_revision)
225 global_revision = re.sub("[^0-9]", "", global_revision)
226 except:
227 global_revision="-1"
228 if global_revision == "": global_revision="-2"
229 env.Append(CPPDEFINES = ["SVN_VERSION="+global_revision])
230
231 # Create a Configure() environment only for checking existence of
232 # libraries and headers. Later we throw it away then build the real
233 # environment.
234 conf = Configure(clone_env(env))
235
236 ############ numarray (required) ###############################
237
238 try: from numarray import identity
239 except ImportError: sys.exit(1)
240
241 ############ python libraries (required) #######################
242
243 conf.env.Append(CPPPATH = [env['python_path']])
244 conf.env.Append(LIBPATH = [env['python_lib_path']])
245 conf.env.Append(LIBS = [env['python_libs']])
246
247 if not conf.CheckCHeader('Python.h'): sys.exit(1)
248 if not conf.CheckFunc('Py_Main'): sys.exit(1)
249
250 # Add python libraries to environment env
251 env.AppendUnique(CPPPATH = [env['python_path']])
252 env.AppendUnique(LIBPATH = [env['python_lib_path']])
253 env.Append(LIBS = [env['python_libs']])
254
255 ############ boost (required) ##################################
256
257 conf.env.Append(CPPPATH = [env['boost_path']])
258 conf.env.Append(LIBPATH = [env['boost_lib_path']])
259 conf.env.Append(LIBS = [env['boost_libs']])
260
261 if not conf.CheckCXXHeader('boost/python.hpp'): sys.exit(1)
262 if not conf.CheckFunc('PyObject_SetAttr'): sys.exit(1)
263
264 # Add boost to environment env
265 env.AppendUnique(CPPPATH = [env['boost_path']])
266 env.AppendUnique(LIBPATH = [env['boost_lib_path']])
267 env.Append(LIBS = [env['boost_libs']])
268
269 ############ VTK (optional) ####################################
270
271 # You must set up your PYTHONPATH before calling scons
272
273 if env['usevtk']:
274 try:
275 import vtk
276 env['usevtk'] = 1
277 except ImportError:
278 env['usevtk'] = 0
279
280 # Add VTK to environment env
281 if env['usevtk']:
282 env.Append(CPPDEFINES = ['USE_VTK'])
283
284 ############ NetCDF (optional) #################################
285
286 # Start a new configure environment that reflects what we've already found
287 conf.Finish()
288 conf = Configure(clone_env(env))
289
290 if env['usenetcdf']:
291 conf.env.Append(CPPPATH = [env['netCDF_path']])
292 conf.env.Append(LIBPATH = [env['netCDF_lib_path']])
293 conf.env.Append(LIBS = [env['netCDF_libs']])
294
295 if env['usenetcdf'] and not conf.CheckCHeader('netcdf.h'): env['usenetcdf'] = 0
296 if env['usenetcdf'] and not conf.CheckFunc('nc_open'): env['usenetcdf'] = 0
297
298 # Add NetCDF to environment env
299 if env['usenetcdf']:
300 env.AppendUnique(CPPPATH = [env['netCDF_path']])
301 env.AppendUnique(LIBPATH = [env['netCDF_lib_path']])
302 env.Append(LIBS = [env['netCDF_libs']])
303 env.Append(CPPDEFINES = ['USE_NETCDF'])
304
305 ############ PAPI (optional) ###################################
306
307 # Start a new configure environment that reflects what we've already found
308 conf.Finish()
309 conf = Configure(clone_env(env))
310
311 if env['usepapi']:
312 conf.env.Append(CPPPATH = [env['papi_path']])
313 conf.env.Append(LIBPATH = [env['papi_lib_path']])
314 conf.env.Append(LIBS = [env['papi_libs']])
315
316 if env['usepapi'] and not conf.CheckCHeader('papi.h'): env['usepapi'] = 0
317 if env['usepapi'] and not conf.CheckFunc('PAPI_start_counters'): env['usepapi'] = 0
318
319 # Add PAPI to environment env
320 if env['usepapi']:
321 env.AppendUnique(CPPPATH = [env['papi_path']])
322 env.AppendUnique(LIBPATH = [env['papi_lib_path']])
323 env.Append(LIBS = [env['papi_libs']])
324 env.Append(CPPDEFINES = ['BLOCKPAPI'])
325
326 ############ MKL (optional) ####################################
327
328 # Start a new configure environment that reflects what we've already found
329 conf.Finish()
330 conf = Configure(clone_env(env))
331
332 if env['usemkl']:
333 conf.env.Append(CPPPATH = [env['mkl_path']])
334 conf.env.Append(LIBPATH = [env['mkl_lib_path']])
335 conf.env.Append(LIBS = [env['mkl_libs']])
336
337 if env['usemkl'] and not conf.CheckCHeader('mkl_solver.h'): env['usemkl'] = 0
338 if env['usemkl'] and not conf.CheckFunc('PARDISO'): env['usemkl'] = 0
339
340 # Add MKL to environment env
341 if env['usemkl']:
342 print "ksteube using MKL"
343 env.AppendUnique(CPPPATH = [env['mkl_path']])
344 env.AppendUnique(LIBPATH = [env['mkl_lib_path']])
345 env.Append(LIBS = [env['mkl_libs']])
346 env.Append(CPPDEFINES = ['MKL'])
347
348 ############ UMFPACK (optional) ################################
349
350 # Start a new configure environment that reflects what we've already found
351 conf.Finish()
352 conf = Configure(clone_env(env))
353
354 if env['useumfpack']:
355 conf.env.Append(CPPPATH = [env['ufc_path']])
356 conf.env.Append(CPPPATH = [env['umf_path']])
357 conf.env.Append(LIBPATH = [env['umf_lib_path']])
358 conf.env.Append(LIBS = [env['umf_libs']])
359 conf.env.Append(CPPPATH = [env['amd_path']])
360 conf.env.Append(LIBPATH = [env['amd_lib_path']])
361 conf.env.Append(LIBS = [env['amd_libs']])
362 conf.env.Append(CPPPATH = [env['blas_path']])
363 conf.env.Append(LIBPATH = [env['blas_lib_path']])
364 conf.env.Append(LIBS = [env['blas_libs']])
365
366 if env['useumfpack'] and not conf.CheckCHeader('umfpack.h'): env['useumfpack'] = 0
367 if env['useumfpack'] and not conf.CheckFunc('umfpack_di_symbolic'): env['useumfpack'] = 0
368
369 # Add UMFPACK to environment env
370 if env['useumfpack']:
371 env.AppendUnique(CPPPATH = [env['ufc_path']])
372 env.AppendUnique(CPPPATH = [env['umf_path']])
373 env.AppendUnique(LIBPATH = [env['umf_lib_path']])
374 env.Append(LIBS = [env['umf_libs']])
375 env.Append(CPPDEFINES = ['UMFPACK'])
376
377 env.AppendUnique(CPPPATH = [env['amd_path']])
378 env.AppendUnique(LIBPATH = [env['amd_lib_path']])
379 env.Append(LIBS = [env['amd_libs']])
380
381 env.AppendUnique(CPPPATH = [env['blas_path']])
382 env.AppendUnique(LIBPATH = [env['blas_lib_path']])
383 env.Append(LIBS = [env['blas_libs']])
384
385 ############ MPI (optional) ####################################
386
387 # Start a new configure environment that reflects what we've already found
388 conf.Finish()
389 conf = Configure(clone_env(env))
390
391 if env['usempi']:
392 conf.env.Append(CPPPATH = [env['mpi_path']])
393 conf.env.Append(LIBPATH = [env['mpi_lib_path']])
394 conf.env.Append(LIBS = [env['mpi_libs']])
395
396 if env['usempi'] and not conf.CheckCHeader('mpi.h'): env['usempi'] = 0
397 if env['usempi'] and not conf.CheckFunc('MPI_Init'): env['usempi'] = 0
398
399 # Create a modified environment for MPI programs
400 env_mpi = clone_env(env)
401
402 # Add MPI to environment env_mpi
403 if env_mpi['usempi']:
404 env_mpi.AppendUnique(CPPPATH = [env['mpi_path']])
405 env_mpi.AppendUnique(LIBPATH = [env['mpi_lib_path']])
406 env_mpi.Append(LIBS = [env['mpi_libs']])
407 env_mpi.Append(CPPDEFINES = ['PASO_MPI', 'MPI_NO_CPPBIND', env_mpi['MPICH_IGNORE_CXX_SEEK']])
408
409 ############ ParMETIS (optional) ###############################
410
411 # Start a new configure environment that reflects what we've already found
412 conf.Finish()
413 conf = Configure(clone_env(env_mpi))
414
415 if not env['usempi']: env['useparmetis'] = 0
416
417 if env['useparmetis']:
418 conf.env.Append(CPPPATH = [env['parmetis_path']])
419 conf.env.Append(LIBPATH = [env['parmetis_lib_path']])
420 conf.env.Append(LIBS = [env['parmetis_libs']])
421
422 if env['useparmetis'] and not conf.CheckCHeader('parmetis.h'): env['useparmetis'] = 0
423 if env['useparmetis'] and not conf.CheckFunc('ParMETIS_V3_PartGeomKway'): env['useparmetis'] = 0
424
425 # Add ParMETIS to environment env_mpi
426 if env['useparmetis']:
427 env_mpi.AppendUnique(CPPPATH = [env['parmetis_path']])
428 env_mpi.AppendUnique(LIBPATH = [env['parmetis_lib_path']])
429 env_mpi.Append(LIBS = [env['parmetis_libs']])
430 env_mpi.Append(CPPDEFINES = ['USE_PARMETIS'])
431
432 ############ Configure finished, now finish environment ########
433
434 conf.Finish()
435
436 # Enable debug by choosing either cc_debug or cc_optim
437 if env['usedebug']:
438 env.Append(CCFLAGS = env['cc_debug'])
439 env.Append(CCFLAGS = env['omp_debug'])
440 else:
441 env.Append(CCFLAGS = env['cc_optim'])
442 env.Append(CCFLAGS = env['omp_optim'])
443
444 # Always use cc_flags
445 env.Append(CCFLAGS = env['cc_flags'])
446
447 # MS Windows
448 if IS_WINDOWS_PLATFORM:
449 env.PrependENVPath('PATH', [env['boost_lib_path']])
450 env.PrependENVPath('PATH', [env['libinstall']])
451 if env['usenetcdf']:
452 env.PrependENVPath('PATH', [env['netCDF_lib_path']])
453
454 env.Append(ARFLAGS = env['ar_flags'])
455
456 ############ Summarize our environment #########################
457
458 print ""
459 print "Summary of configuration (see ./config.log for information)"
460 print " Using python libraries"
461 print " Using numarray"
462 print " Using boost"
463 if env['usenetcdf']: print " Using NetCDF"
464 else: print " Not using NetCDF"
465 if env['usevtk']: print " Using VTK"
466 else: print " Not using VTK"
467 if env['usemkl']: print " Using MKL"
468 else: print " Not using MKL"
469 if env['useumfpack']: print " Using UMFPACK"
470 else: print " Not using UMFPACK"
471 if env['useopenmp']: print " Using OpenMP"
472 else: print " Not using OpenMP"
473 if env['usempi']: print " Using MPI"
474 else: print " Not using MPI"
475 if env['useparmetis']: print " Using ParMETIS"
476 else: print " Not using ParMETIS (requires MPI)"
477 if env['usepapi']: print " Using PAPI"
478 else: print " Not using PAPI"
479 if env['usedebug']: print " Compiling for debug"
480 else: print " Not compiling for debug"
481 print " Installing in", prefix
482 print ""
483
484 ############ Add some custom builders ##########################
485
486 py_builder = Builder(action = scons_extensions.build_py, suffix = '.pyc', src_suffix = '.py', single_source=True)
487 env.Append(BUILDERS = {'PyCompile' : py_builder});
488
489 runUnitTest_builder = Builder(action = scons_extensions.runUnitTest, suffix = '.passed', src_suffix=env['PROGSUFFIX'], single_source=True)
490 env.Append(BUILDERS = {'RunUnitTest' : runUnitTest_builder});
491
492 runPyUnitTest_builder = Builder(action = scons_extensions.runPyUnitTest, suffix = '.passed', src_suffic='.py', single_source=True)
493 env.Append(BUILDERS = {'RunPyUnitTest' : runPyUnitTest_builder});
494
495 ############ Build the desired subdirectories ##################
496
497 Export(["env", "env_mpi"])
498
499 env.SConscript(dirs = ['tools/CppUnitTest/src'], build_dir='build/$PLATFORM/tools/CppUnitTest', duplicate=0)
500 env.SConscript(dirs = ['paso/src'], build_dir='build/$PLATFORM/paso', duplicate=0)
501 env.SConscript(dirs = ['escript/src'], build_dir='build/$PLATFORM/escript', duplicate=0)
502 env.SConscript(dirs = ['esysUtils/src'], build_dir='build/$PLATFORM/esysUtils', duplicate=0)
503 env.SConscript(dirs = ['finley/src'], build_dir='build/$PLATFORM/finley', duplicate=0)
504 env.SConscript(dirs = ['modellib/py_src'], build_dir='build/$PLATFORM/modellib', duplicate=0)
505 env.SConscript(dirs = ['doc'], build_dir='build/$PLATFORM/doc', duplicate=0)
506 env.SConscript(dirs = ['pyvisi/py_src'], build_dir='build/$PLATFORM/pyvisi', duplicate=0)
507 env.SConscript(dirs = ['pycad/py_src'], build_dir='build/$PLATFORM/pycad', duplicate=0)
508 env.SConscript(dirs = ['pythonMPI/src'], build_dir='build/$PLATFORM/pythonMPI', duplicate=0)
509
510 ############ Targets to build and install libraries ############
511
512 target_init = env.Command(env['pyinstall']+'/__init__.py', None, Touch('$TARGET'))
513 env.Alias('target_init', [target_init])
514
515 # The headers have to be installed prior to build in order to satisfy #include <paso/Common.h>
516 env.Alias('build_esysUtils', ['target_install_esysUtils_headers', 'target_esysUtils_a'])
517 env.Alias('install_esysUtils', ['build_esysUtils', 'target_install_esysUtils_a'])
518
519 env.Alias('build_paso', ['target_install_paso_headers', 'target_paso_a'])
520 env.Alias('install_paso', ['build_paso', 'target_install_paso_a'])
521
522 env.Alias('build_escript', ['target_install_escript_headers', 'target_escript_so', 'target_escriptcpp_so'])
523 env.Alias('install_escript', ['build_escript', 'target_install_escript_so', 'target_install_escriptcpp_so', 'target_install_escript_py'])
524
525 env.Alias('build_finley', ['target_install_finley_headers', 'target_finley_so', 'target_finleycpp_so'])
526 env.Alias('install_finley', ['build_finley', 'target_install_finley_so', 'target_install_finleycpp_so', 'target_install_finley_py'])
527
528 # Now gather all the above into a couple easy targets: build_all and install_all
529 build_all_list = []
530 build_all_list += ['build_esysUtils']
531 build_all_list += ['build_paso']
532 build_all_list += ['build_escript']
533 build_all_list += ['build_finley']
534 if env['usempi']: build_all_list += ['target_pythonMPI_exe']
535 env.Alias('build_all', build_all_list)
536
537 install_all_list = []
538 install_all_list += ['target_init']
539 install_all_list += ['install_esysUtils']
540 install_all_list += ['install_paso']
541 install_all_list += ['install_escript']
542 install_all_list += ['install_finley']
543 install_all_list += ['target_install_pyvisi_py']
544 install_all_list += ['target_install_modellib_py']
545 install_all_list += ['target_install_pycad_py']
546 if env['usempi']: install_all_list += ['target_install_pythonMPI_exe']
547 env.Alias('install_all', install_all_list)
548
549 # Default target is install
550 env.Default('install_all')
551
552 ############ Targets to build and run the test suite ###########
553
554 env.Alias('build_cppunittest', ['target_install_cppunittest_headers', 'target_cppunittest_a'])
555 env.Alias('install_cppunittest', ['build_cppunittest', 'target_install_cppunittest_a'])
556 env.Alias('run_tests', ['install_all', 'target_install_cppunittest_a'])
557 env.Alias('all_tests', ['install_all', 'target_install_cppunittest_a', 'run_tests', 'py_tests'])
558
559 ############ Targets to build the documentation ################
560
561 env.Alias('docs', ['examples_tarfile', 'examples_zipfile', 'api_epydoc', 'api_doxygen', 'guide_pdf', 'guide_html'])
562
563 ############ Remember what options were used in the build ######
564
565 if not IS_WINDOWS_PLATFORM:
566 env.Execute("/bin/rm -f " + env['libinstall'] + "/Compiled.with.*")
567 if env['usedebug']: env.Execute("touch " + env['libinstall'] + "/Compiled.with.debug")
568 if env['usempi']: env.Execute("touch " + env['libinstall'] + "/Compiled.with.mpi")
569 if env['omp_optim'] != '': env.Execute("touch " + env['libinstall'] + "/Compiled.with.OpenMP")
570

  ViewVC Help
Powered by ViewVC 1.1.26