251 |
if global_revision == "": global_revision="-2" |
if global_revision == "": global_revision="-2" |
252 |
env.Append(CPPDEFINES = ["SVN_VERSION="+global_revision]) |
env.Append(CPPDEFINES = ["SVN_VERSION="+global_revision]) |
253 |
|
|
|
# Create a Configure() environment only for checking existence of |
|
|
# libraries and headers. Later we throw it away then build the real |
|
|
# environment. |
|
|
conf = Configure(clone_env(env)) |
|
|
|
|
|
############ C compiler (required) ############################# |
|
|
|
|
|
if not conf.CheckLib('c'): |
|
|
print "Cannot run C compiler (or libc is missing)" |
|
|
sys.exit(1) |
|
|
|
|
254 |
############ numarray (required) ############################### |
############ numarray (required) ############################### |
255 |
|
|
256 |
try: |
try: |
259 |
print "Cannot import numarray, you need to set your PYTHONPATH" |
print "Cannot import numarray, you need to set your PYTHONPATH" |
260 |
sys.exit(1) |
sys.exit(1) |
261 |
|
|
262 |
|
############ C compiler (required) ############################# |
263 |
|
|
264 |
|
# Create a Configure() environment for checking existence of required libraries and headers |
265 |
|
conf = Configure(clone_env(env)) |
266 |
|
|
267 |
|
# Test that the compiler is working |
268 |
|
if not conf.CheckFunc('printf'): |
269 |
|
print "Cannot run C compiler '%s' (or libc is missing)" % (env['CC']) |
270 |
|
sys.exit(1) |
271 |
|
|
272 |
############ python libraries (required) ####################### |
############ python libraries (required) ####################### |
273 |
|
|
274 |
conf.env.Append(CPPPATH = [env['python_path']]) |
conf.env.AppendUnique(CPPPATH = [env['python_path']]) |
275 |
conf.env.Append(LIBPATH = [env['python_lib_path']]) |
conf.env.AppendUnique(LIBPATH = [env['python_lib_path']]) |
276 |
conf.env.Append(LIBS = [env['python_libs']]) |
conf.env.AppendUnique(LIBS = [env['python_libs']]) |
277 |
|
|
278 |
if not conf.CheckCHeader('Python.h'): |
if not conf.CheckCHeader('Python.h'): |
279 |
print "Cannot find python include files (tried directory %s)" % env['python_path'] |
print "Cannot find python include files (tried directory %s)" % env['python_path'] |
282 |
print "Cannot find python library method Py_Main (tried directory %s)" % env['python_lib_path'] |
print "Cannot find python library method Py_Main (tried directory %s)" % env['python_lib_path'] |
283 |
sys.exit(1) |
sys.exit(1) |
284 |
|
|
|
# Add python libraries to environment env |
|
|
env.AppendUnique(CPPPATH = [env['python_path']]) |
|
|
env.AppendUnique(LIBPATH = [env['python_lib_path']]) |
|
|
env.Append(LIBS = [env['python_libs']]) |
|
|
|
|
285 |
############ boost (required) ################################## |
############ boost (required) ################################## |
286 |
|
|
287 |
conf.env.Append(CPPPATH = [env['boost_path']]) |
conf.env.AppendUnique(CPPPATH = [env['boost_path']]) |
288 |
conf.env.Append(LIBPATH = [env['boost_lib_path']]) |
conf.env.AppendUnique(LIBPATH = [env['boost_lib_path']]) |
289 |
conf.env.Append(LIBS = [env['boost_libs']]) |
conf.env.AppendUnique(LIBS = [env['boost_libs']]) |
|
|
|
|
if not conf.CheckCXXHeader('boost/python.hpp'): sys.exit(1) |
|
|
if not conf.CheckFunc('PyObject_SetAttr'): sys.exit(1) |
|
|
|
|
|
# Add boost to environment env |
|
|
env.AppendUnique(CPPPATH = [env['boost_path']]) |
|
|
env.AppendUnique(LIBPATH = [env['boost_lib_path']]) |
|
|
env.Append(LIBS = [env['boost_libs']]) |
|
290 |
|
|
291 |
############ VTK (optional) #################################### |
if not conf.CheckCXXHeader('boost/python.hpp'): |
292 |
|
print "Cannot find boost include files (tried directory %s)" % env['boost_path'] |
293 |
|
sys.exit(1) |
294 |
|
if not conf.CheckFunc('PyObject_SetAttr'): |
295 |
|
print "Cannot find boost library method PyObject_SetAttr (tried directory %s)" % env['boost_lib_path'] |
296 |
|
sys.exit(1) |
297 |
|
|
298 |
|
# Commit changes to environment |
299 |
|
env = conf.Finish() |
300 |
|
|
301 |
# You must set up your PYTHONPATH before calling scons |
############ VTK (optional) #################################### |
302 |
|
|
303 |
if env['usevtk']: |
if env['usevtk']: |
304 |
try: |
try: |
307 |
except ImportError: |
except ImportError: |
308 |
env['usevtk'] = 0 |
env['usevtk'] = 0 |
309 |
|
|
310 |
# Add VTK to environment env |
# Add VTK to environment env if it was found |
311 |
if env['usevtk']: |
if env['usevtk']: |
312 |
env.Append(CPPDEFINES = ['USE_VTK']) |
env.Append(CPPDEFINES = ['USE_VTK']) |
313 |
|
|
314 |
############ NetCDF (optional) ################################# |
############ NetCDF (optional) ################################# |
315 |
|
|
|
# Start a new configure environment that reflects what we've already found |
|
|
conf.Finish() |
|
316 |
conf = Configure(clone_env(env)) |
conf = Configure(clone_env(env)) |
317 |
|
|
318 |
if env['usenetcdf']: |
if env['usenetcdf']: |
319 |
conf.env.Append(CPPPATH = [env['netCDF_path']]) |
conf.env.AppendUnique(CPPPATH = [env['netCDF_path']]) |
320 |
conf.env.Append(LIBPATH = [env['netCDF_lib_path']]) |
conf.env.AppendUnique(LIBPATH = [env['netCDF_lib_path']]) |
321 |
conf.env.Append(LIBS = [env['netCDF_libs']]) |
conf.env.AppendUnique(LIBS = [env['netCDF_libs']]) |
322 |
|
|
323 |
if env['usenetcdf'] and not conf.CheckCHeader('netcdf.h'): env['usenetcdf'] = 0 |
if env['usenetcdf'] and not conf.CheckCHeader('netcdf.h'): env['usenetcdf'] = 0 |
324 |
if env['usenetcdf'] and not conf.CheckFunc('nc_open'): env['usenetcdf'] = 0 |
if env['usenetcdf'] and not conf.CheckFunc('nc_open'): env['usenetcdf'] = 0 |
325 |
|
|
326 |
# Add NetCDF to environment env |
# Add NetCDF to environment env if it was found |
327 |
if env['usenetcdf']: |
if env['usenetcdf']: |
328 |
env.AppendUnique(CPPPATH = [env['netCDF_path']]) |
env = conf.Finish() |
|
env.AppendUnique(LIBPATH = [env['netCDF_lib_path']]) |
|
|
env.Append(LIBS = [env['netCDF_libs']]) |
|
329 |
env.Append(CPPDEFINES = ['USE_NETCDF']) |
env.Append(CPPDEFINES = ['USE_NETCDF']) |
330 |
|
else: |
331 |
|
conf.Finish() |
332 |
|
|
333 |
############ PAPI (optional) ################################### |
############ PAPI (optional) ################################### |
334 |
|
|
335 |
# Start a new configure environment that reflects what we've already found |
# Start a new configure environment that reflects what we've already found |
|
conf.Finish() |
|
336 |
conf = Configure(clone_env(env)) |
conf = Configure(clone_env(env)) |
337 |
|
|
338 |
if env['usepapi']: |
if env['usepapi']: |
339 |
conf.env.Append(CPPPATH = [env['papi_path']]) |
conf.env.AppendUnique(CPPPATH = [env['papi_path']]) |
340 |
conf.env.Append(LIBPATH = [env['papi_lib_path']]) |
conf.env.AppendUnique(LIBPATH = [env['papi_lib_path']]) |
341 |
conf.env.Append(LIBS = [env['papi_libs']]) |
conf.env.AppendUnique(LIBS = [env['papi_libs']]) |
342 |
|
|
343 |
if env['usepapi'] and not conf.CheckCHeader('papi.h'): env['usepapi'] = 0 |
if env['usepapi'] and not conf.CheckCHeader('papi.h'): env['usepapi'] = 0 |
344 |
if env['usepapi'] and not conf.CheckFunc('PAPI_start_counters'): env['usepapi'] = 0 |
if env['usepapi'] and not conf.CheckFunc('PAPI_start_counters'): env['usepapi'] = 0 |
345 |
|
|
346 |
# Add PAPI to environment env |
# Add PAPI to environment env if it was found |
347 |
if env['usepapi']: |
if env['usepapi']: |
348 |
env.AppendUnique(CPPPATH = [env['papi_path']]) |
env = conf.Finish() |
|
env.AppendUnique(LIBPATH = [env['papi_lib_path']]) |
|
|
env.Append(LIBS = [env['papi_libs']]) |
|
349 |
env.Append(CPPDEFINES = ['BLOCKPAPI']) |
env.Append(CPPDEFINES = ['BLOCKPAPI']) |
350 |
|
else: |
351 |
|
conf.Finish() |
352 |
|
|
353 |
############ MKL (optional) #################################### |
############ MKL (optional) #################################### |
354 |
|
|
355 |
# Start a new configure environment that reflects what we've already found |
# Start a new configure environment that reflects what we've already found |
|
conf.Finish() |
|
356 |
conf = Configure(clone_env(env)) |
conf = Configure(clone_env(env)) |
357 |
|
|
358 |
if env['usemkl']: |
if env['usemkl']: |
359 |
conf.env.Append(CPPPATH = [env['mkl_path']]) |
conf.env.AppendUnique(CPPPATH = [env['mkl_path']]) |
360 |
conf.env.Append(LIBPATH = [env['mkl_lib_path']]) |
conf.env.AppendUnique(LIBPATH = [env['mkl_lib_path']]) |
361 |
conf.env.Append(LIBS = [env['mkl_libs']]) |
conf.env.AppendUnique(LIBS = [env['mkl_libs']]) |
362 |
|
|
363 |
if env['usemkl'] and not conf.CheckCHeader('mkl_solver.h'): env['usemkl'] = 0 |
if env['usemkl'] and not conf.CheckCHeader('mkl_solver.h'): env['usemkl'] = 0 |
364 |
if env['usemkl'] and not conf.CheckFunc('pardiso_'): env['usemkl'] = 0 |
if env['usemkl'] and not conf.CheckFunc('pardiso_'): env['usemkl'] = 0 |
365 |
|
|
366 |
# Add MKL to environment env |
# Add MKL to environment env if it was found |
367 |
if env['usemkl']: |
if env['usemkl']: |
368 |
env.AppendUnique(CPPPATH = [env['mkl_path']]) |
env = conf.Finish() |
|
env.AppendUnique(LIBPATH = [env['mkl_lib_path']]) |
|
|
env.Append(LIBS = [env['mkl_libs']]) |
|
369 |
env.Append(CPPDEFINES = ['MKL']) |
env.Append(CPPDEFINES = ['MKL']) |
370 |
|
else: |
371 |
|
conf.Finish() |
372 |
|
|
373 |
############ UMFPACK (optional) ################################ |
############ UMFPACK (optional) ################################ |
374 |
|
|
375 |
# Start a new configure environment that reflects what we've already found |
# Start a new configure environment that reflects what we've already found |
|
conf.Finish() |
|
376 |
conf = Configure(clone_env(env)) |
conf = Configure(clone_env(env)) |
377 |
|
|
378 |
if env['useumfpack']: |
if env['useumfpack']: |
379 |
conf.env.Append(CPPPATH = [env['ufc_path']]) |
conf.env.AppendUnique(CPPPATH = [env['ufc_path']]) |
380 |
conf.env.Append(CPPPATH = [env['umf_path']]) |
conf.env.AppendUnique(CPPPATH = [env['umf_path']]) |
381 |
conf.env.Append(LIBPATH = [env['umf_lib_path']]) |
conf.env.AppendUnique(LIBPATH = [env['umf_lib_path']]) |
382 |
conf.env.Append(LIBS = [env['umf_libs']]) |
conf.env.AppendUnique(LIBS = [env['umf_libs']]) |
383 |
conf.env.Append(CPPPATH = [env['amd_path']]) |
conf.env.AppendUnique(CPPPATH = [env['amd_path']]) |
384 |
conf.env.Append(LIBPATH = [env['amd_lib_path']]) |
conf.env.AppendUnique(LIBPATH = [env['amd_lib_path']]) |
385 |
conf.env.Append(LIBS = [env['amd_libs']]) |
conf.env.AppendUnique(LIBS = [env['amd_libs']]) |
386 |
conf.env.Append(CPPPATH = [env['blas_path']]) |
conf.env.AppendUnique(CPPPATH = [env['blas_path']]) |
387 |
conf.env.Append(LIBPATH = [env['blas_lib_path']]) |
conf.env.AppendUnique(LIBPATH = [env['blas_lib_path']]) |
388 |
conf.env.Append(LIBS = [env['blas_libs']]) |
conf.env.AppendUnique(LIBS = [env['blas_libs']]) |
389 |
|
|
390 |
if env['useumfpack'] and not conf.CheckCHeader('umfpack.h'): env['useumfpack'] = 0 |
if env['useumfpack'] and not conf.CheckCHeader('umfpack.h'): env['useumfpack'] = 0 |
391 |
if env['useumfpack'] and not conf.CheckFunc('umfpack_di_symbolic'): env['useumfpack'] = 0 |
if env['useumfpack'] and not conf.CheckFunc('umfpack_di_symbolic'): env['useumfpack'] = 0 |
392 |
|
|
393 |
# Add UMFPACK to environment env |
# Add UMFPACK to environment env if it was found |
394 |
if env['useumfpack']: |
if env['useumfpack']: |
395 |
env.AppendUnique(CPPPATH = [env['ufc_path']]) |
env = conf.Finish() |
|
env.AppendUnique(CPPPATH = [env['umf_path']]) |
|
|
env.AppendUnique(LIBPATH = [env['umf_lib_path']]) |
|
|
env.Append(LIBS = [env['umf_libs']]) |
|
396 |
env.Append(CPPDEFINES = ['UMFPACK']) |
env.Append(CPPDEFINES = ['UMFPACK']) |
397 |
|
else: |
398 |
env.AppendUnique(CPPPATH = [env['amd_path']]) |
conf.Finish() |
|
env.AppendUnique(LIBPATH = [env['amd_lib_path']]) |
|
|
env.Append(LIBS = [env['amd_libs']]) |
|
|
|
|
|
env.AppendUnique(CPPPATH = [env['blas_path']]) |
|
|
env.AppendUnique(LIBPATH = [env['blas_lib_path']]) |
|
|
env.Append(LIBS = [env['blas_libs']]) |
|
399 |
|
|
400 |
############ Add the compiler flags ############################ |
############ Add the compiler flags ############################ |
401 |
|
|
413 |
|
|
414 |
############ MPI (optional) #################################### |
############ MPI (optional) #################################### |
415 |
|
|
416 |
# Start a new configure environment that reflects what we've already found |
# Create a modified environment for MPI programs (identical to env if usempi=no) |
417 |
conf.Finish() |
env_mpi = clone_env(env) |
|
conf = Configure(clone_env(env)) |
|
418 |
|
|
419 |
if env['usempi']: |
# Start a new configure environment that reflects what we've already found |
420 |
conf.env.Append(CPPPATH = [env['mpi_path']]) |
conf = Configure(clone_env(env_mpi)) |
|
conf.env.Append(LIBPATH = [env['mpi_lib_path']]) |
|
|
conf.env.Append(LIBS = [env['mpi_libs']]) |
|
421 |
|
|
422 |
if env['usempi'] and not conf.CheckCHeader('mpi.h'): env['usempi'] = 0 |
if env_mpi['usempi']: |
423 |
if env['usempi'] and not conf.CheckFunc('MPI_Init'): env['usempi'] = 0 |
conf.env.AppendUnique(CPPPATH = [env_mpi['mpi_path']]) |
424 |
|
conf.env.AppendUnique(LIBPATH = [env_mpi['mpi_lib_path']]) |
425 |
|
conf.env.AppendUnique(LIBS = [env_mpi['mpi_libs']]) |
426 |
|
|
427 |
# Create a modified environment for MPI programs |
if env_mpi['usempi'] and not conf.CheckCHeader('mpi.h'): env_mpi['usempi'] = 0 |
428 |
env_mpi = clone_env(env) |
if env_mpi['usempi'] and not conf.CheckFunc('MPI_Init'): env_mpi['usempi'] = 0 |
429 |
|
|
430 |
# Add MPI to environment env_mpi |
# Add MPI to environment env_mpi if it was found |
431 |
if env_mpi['usempi']: |
if env_mpi['usempi']: |
432 |
env_mpi.AppendUnique(CPPPATH = [env['mpi_path']]) |
env_mpi = conf.Finish() |
|
env_mpi.AppendUnique(LIBPATH = [env['mpi_lib_path']]) |
|
|
env_mpi.Append(LIBS = [env['mpi_libs']]) |
|
433 |
env_mpi.Append(CPPDEFINES = ['PASO_MPI', 'MPI_NO_CPPBIND', env_mpi['MPICH_IGNORE_CXX_SEEK']]) |
env_mpi.Append(CPPDEFINES = ['PASO_MPI', 'MPI_NO_CPPBIND', env_mpi['MPICH_IGNORE_CXX_SEEK']]) |
434 |
|
else: |
435 |
|
conf.Finish() |
436 |
|
|
437 |
############ ParMETIS (optional) ############################### |
############ ParMETIS (optional) ############################### |
438 |
|
|
439 |
# Start a new configure environment that reflects what we've already found |
# Start a new configure environment that reflects what we've already found |
|
conf.Finish() |
|
440 |
conf = Configure(clone_env(env_mpi)) |
conf = Configure(clone_env(env_mpi)) |
441 |
|
|
442 |
if not env['usempi']: env['useparmetis'] = 0 |
if not env_mpi['usempi']: env_mpi['useparmetis'] = 0 |
443 |
|
|
444 |
if env['useparmetis']: |
if env_mpi['useparmetis']: |
445 |
conf.env.Append(CPPPATH = [env['parmetis_path']]) |
conf.env.AppendUnique(CPPPATH = [env_mpi['parmetis_path']]) |
446 |
conf.env.Append(LIBPATH = [env['parmetis_lib_path']]) |
conf.env.AppendUnique(LIBPATH = [env_mpi['parmetis_lib_path']]) |
447 |
conf.env.Append(LIBS = [env['parmetis_libs']]) |
conf.env.AppendUnique(LIBS = [env_mpi['parmetis_libs']]) |
448 |
|
|
449 |
if env['useparmetis'] and not conf.CheckCHeader('parmetis.h'): env['useparmetis'] = 0 |
if env_mpi['useparmetis'] and not conf.CheckCHeader('parmetis.h'): env_mpi['useparmetis'] = 0 |
450 |
if env['useparmetis'] and not conf.CheckFunc('ParMETIS_V3_PartGeomKway'): env['useparmetis'] = 0 |
if env_mpi['useparmetis'] and not conf.CheckFunc('ParMETIS_V3_PartGeomKway'): env_mpi['useparmetis'] = 0 |
451 |
|
|
452 |
# Add ParMETIS to environment env_mpi |
# Add ParMETIS to environment env_mpi if it was found |
453 |
if env['useparmetis']: |
if env_mpi['useparmetis']: |
454 |
env_mpi.AppendUnique(CPPPATH = [env['parmetis_path']]) |
env_mpi = conf.Finish() |
|
env_mpi.AppendUnique(LIBPATH = [env['parmetis_lib_path']]) |
|
|
env_mpi.Append(LIBS = [env['parmetis_libs']]) |
|
455 |
env_mpi.Append(CPPDEFINES = ['USE_PARMETIS']) |
env_mpi.Append(CPPDEFINES = ['USE_PARMETIS']) |
456 |
|
else: |
457 |
conf.Finish() |
conf.Finish() |
458 |
|
|
459 |
############ Summarize our environment ######################### |
############ Summarize our environment ######################### |
460 |
|
|