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

Diff of /branches/diaplayground/SConstruct

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

revision 3319 by caltinay, Thu Oct 28 03:14:27 2010 UTC revision 3508 by lgao, Fri May 13 04:15:29 2011 UTC
# Line 54  vars = Variables(options_file, ARGUMENTS Line 54  vars = Variables(options_file, ARGUMENTS
54  vars.AddVariables(  vars.AddVariables(
55    PathVariable('options_file', 'Path to options file', options_file, PathVariable.PathIsFile),    PathVariable('options_file', 'Path to options file', options_file, PathVariable.PathIsFile),
56    PathVariable('prefix', 'Installation prefix', Dir('#.').abspath, PathVariable.PathIsDirCreate),    PathVariable('prefix', 'Installation prefix', Dir('#.').abspath, PathVariable.PathIsDirCreate),
57      PathVariable('build_dir', 'Top-level build directory', Dir('#/build').abspath, PathVariable.PathIsDirCreate),
58    BoolVariable('verbose', 'Output full compile/link lines', False),    BoolVariable('verbose', 'Output full compile/link lines', False),
59  # Compiler/Linker options  # Compiler/Linker options
60    ('cc', 'Path to C compiler', 'default'),    ('cc', 'Path to C compiler', 'default'),
# Line 71  vars.AddVariables( Line 72  vars.AddVariables(
72    ('omp_ldflags', 'OpenMP linker flags', 'default'),    ('omp_ldflags', 'OpenMP linker flags', 'default'),
73  # Mandatory libraries  # Mandatory libraries
74    ('boost_prefix', 'Prefix/Paths of boost installation', default_prefix),    ('boost_prefix', 'Prefix/Paths of boost installation', default_prefix),
75    ('boost_libs', 'Boost libraries to link with', ['boost_python']),    ('boost_libs', 'Boost libraries to link with', ['boost_python-mt']),
76  # Optional libraries and options  # Optional libraries and options
77    EnumVariable('mpi', 'Compile parallel version using MPI flavour', 'none', allowed_values=mpi_flavours),    EnumVariable('mpi', 'Compile parallel version using MPI flavour', 'none', allowed_values=mpi_flavours),
78    ('mpi_prefix', 'Prefix/Paths of MPI installation', default_prefix),    ('mpi_prefix', 'Prefix/Paths of MPI installation', default_prefix),
# Line 92  vars.AddVariables( Line 93  vars.AddVariables(
93    BoolVariable('umfpack', 'Enable UMFPACK', False),    BoolVariable('umfpack', 'Enable UMFPACK', False),
94    ('umfpack_prefix', 'Prefix/Paths to UMFPACK installation', default_prefix),    ('umfpack_prefix', 'Prefix/Paths to UMFPACK installation', default_prefix),
95    ('umfpack_libs', 'UMFPACK libraries to link with', ['umfpack']),    ('umfpack_libs', 'UMFPACK libraries to link with', ['umfpack']),
96      BoolVariable('boomeramg', 'Enable BoomerAMG', False),
97      ('boomeramg_prefix', 'Prefix/Paths to BoomerAMG installation', default_prefix),
98      ('boomeramg_libs', 'BoomerAMG libraries to link with', ['boomeramg']),
99    EnumVariable('lapack', 'Set LAPACK flavour', 'none', allowed_values=lapack_flavours),    EnumVariable('lapack', 'Set LAPACK flavour', 'none', allowed_values=lapack_flavours),
100    ('lapack_prefix', 'Prefix/Paths to LAPACK installation', default_prefix),    ('lapack_prefix', 'Prefix/Paths to LAPACK installation', default_prefix),
101    ('lapack_libs', 'LAPACK libraries to link with', []),    ('lapack_libs', 'LAPACK libraries to link with', []),
# Line 102  vars.AddVariables( Line 106  vars.AddVariables(
106    ('visit_prefix', 'Prefix/Paths to VisIt installation', default_prefix),    ('visit_prefix', 'Prefix/Paths to VisIt installation', default_prefix),
107    ('visit_libs', 'VisIt libraries to link with', ['simV2']),    ('visit_libs', 'VisIt libraries to link with', ['simV2']),
108    BoolVariable('pyvisi', 'Enable pyvisi (deprecated, requires VTK module)', False),    BoolVariable('pyvisi', 'Enable pyvisi (deprecated, requires VTK module)', False),
109      BoolVariable('vsl_random', 'Use VSL from intel for random data', False),
110  # Advanced settings  # Advanced settings
111    #dudley_assemble_flags = -funroll-loops      to actually do something    #dudley_assemble_flags = -funroll-loops      to actually do something
112    ('dudley_assemble_flags', 'compiler flags for some dudley optimisations', ''),    ('dudley_assemble_flags', 'compiler flags for some dudley optimisations', ''),
# Line 157  if len(vars.UnknownVariables())>0: Line 162  if len(vars.UnknownVariables())>0:
162    
163  #################### Make sure install directories exist #####################  #################### Make sure install directories exist #####################
164    
165    env['BUILD_DIR']=env['build_dir']
166  prefix=Dir(env['prefix']).abspath  prefix=Dir(env['prefix']).abspath
167  env['incinstall'] = os.path.join(prefix, 'include')  env['incinstall'] = os.path.join(prefix, 'include')
168  env['bininstall'] = os.path.join(prefix, 'bin')  env['bininstall'] = os.path.join(prefix, 'bin')
# Line 310  for key in 'OMP_NUM_THREADS', 'ESCRIPT_N Line 316  for key in 'OMP_NUM_THREADS', 'ESCRIPT_N
316          env['ENV'][key] = 1          env['ENV'][key] = 1
317    
318  env_export=env['env_export']  env_export=env['env_export']
319  env_export.extend(['ESCRIPT_NUM_THREADS','ESCRIPT_HOSTFILE','DISPLAY','XAUTHORITY','PATH','HOME'])  env_export.extend(['ESCRIPT_NUM_THREADS','ESCRIPT_HOSTFILE','DISPLAY','XAUTHORITY','PATH','HOME','TMPDIR','TEMP','TMP'])
320    
321  for key in set(env_export):  for key in set(env_export):
322      try:      try:
# Line 379  if conf.CheckFunc('gethostname'): Line 385  if conf.CheckFunc('gethostname'):
385  python_inc_path=sysconfig.get_python_inc()  python_inc_path=sysconfig.get_python_inc()
386  if IS_WINDOWS:  if IS_WINDOWS:
387      python_lib_path=os.path.join(sysconfig.get_config_var('prefix'), 'libs')      python_lib_path=os.path.join(sysconfig.get_config_var('prefix'), 'libs')
388    elif env['PLATFORM']=='darwin':
389        python_lib_path=sysconfig.get_config_var('LIBPL')
390  else:  else:
391      python_lib_path=sysconfig.get_config_var('LIBDIR')      python_lib_path=sysconfig.get_config_var('LIBDIR')
392  #python_libs=[sysconfig.get_config_var('LDLIBRARY')] # only on linux  #python_libs=[sysconfig.get_config_var('LDLIBRARY')] # only on linux
# Line 522  if env['silo']: Line 530  if env['silo']:
530      # weipa library and tools.      # weipa library and tools.
531      #env.AppendUnique(LIBS = [env['silo_libs']])      #env.AppendUnique(LIBS = [env['silo_libs']])
532    
533    ######## VSL random numbers (optional)
534    if env['vsl_random']:
535        env.Append(CPPDEFINES = ['MKLRANDOM'])
536    
537  ######## VisIt (optional)  ######## VisIt (optional)
538    
539  visit_inc_path=''  visit_inc_path=''
# Line 549  if env['usempi']: Line 561  if env['usempi']:
561      if env['netcdf'] and env['mpi'] in ['MPT','OPENMPI']:      if env['netcdf'] and env['mpi'] in ['MPT','OPENMPI']:
562          env.Append(CPPDEFINES = ['MPI_INCLUDED'])          env.Append(CPPDEFINES = ['MPI_INCLUDED'])
563    
564    ######## BOOMERAMG (optional)
565    
566    if env['boomeramg'] and env['mpi'] == 'none':
567        print("boomeramg requires mpi!")
568        Exit(1)
569    
570    boomeramg_inc_path=''
571    boomeramg_lib_path=''
572    if env['boomeramg']:
573        boomeramg_inc_path,boomeramg_lib_path=findLibWithHeader(env, env['boomeramg_libs'], 'HYPRE.h', env['boomeramg_prefix'], lang='c')
574        env.AppendUnique(CPPPATH = [boomeramg_inc_path])
575        env.AppendUnique(LIBPATH = [boomeramg_lib_path])
576        # Note that we do not add the libs since they are only needed for the
577        # weipa library and tools.
578        env.AppendUnique(LIBS = env['boomeramg_libs'])
579        env.PrependENVPath(LD_LIBRARY_PATH_KEY, boomeramg_lib_path)
580        env.Append(CPPDEFINES = ['BOOMERAMG'])
581    
582  ######## ParMETIS (optional)  ######## ParMETIS (optional)
583    
584  if not env['usempi']: env['parmetis'] = False  if not env['usempi']: env['parmetis'] = False
# Line 563  if env['parmetis']: Line 593  if env['parmetis']:
593      env.PrependENVPath(LD_LIBRARY_PATH_KEY, parmetis_lib_path)      env.PrependENVPath(LD_LIBRARY_PATH_KEY, parmetis_lib_path)
594      env.Append(CPPDEFINES = ['USE_PARMETIS'])      env.Append(CPPDEFINES = ['USE_PARMETIS'])
595    
596    ######## gmsh (optional, for tests)
597    
598    try:
599        import subprocess
600        p=subprocess.Popen(['gmsh', '-version'], stderr=subprocess.PIPE)
601        p.poll()
602        env['gmsh']=True
603    except OSError:
604        env['gmsh']=False
605    
606  ######################## Summarize our environment ###########################  ######################## Summarize our environment ###########################
607    
608  # keep some of our install paths first in the list for the unit tests  # keep some of our install paths first in the list for the unit tests
# Line 601  else: Line 641  else:
641      print("          LAPACK:  DISABLED")      print("          LAPACK:  DISABLED")
642  d_list=[]  d_list=[]
643  e_list=[]  e_list=[]
644  for i in 'debug','openmp','netcdf','parmetis','papi','mkl','umfpack','silo','visit','pyvisi':  for i in 'debug','openmp','netcdf','parmetis','papi','mkl','umfpack','boomeramg','silo','visit':
645      if env[i]: e_list.append(i)      if env[i]: e_list.append(i)
646      else: d_list.append(i)      else: d_list.append(i)
647  for i in e_list:  for i in e_list:
648      print("%16s:  YES"%i)      print("%16s:  YES"%i)
649  for i in d_list:  for i in d_list:
650      print("%16s:  DISABLED"%i)      print("%16s:  DISABLED"%i)
651    if env['gmsh']:
652        print("            gmsh:  FOUND")
653    else:
654        print("            gmsh:  NOT FOUND")
655    print("      vsl_random:  %s"%env['vsl_random'])
656        
657  if ((fatalwarning != '') and (env['werror'])):  if ((fatalwarning != '') and (env['werror'])):
658      print("  Treating warnings as errors")      print("  Treating warnings as errors")
659  else:  else:
# Line 636  Export( Line 682  Export(
682    ]    ]
683  )  )
684    
685  env.SConscript(dirs = ['tools/CppUnitTest/src'], variant_dir='build/$PLATFORM/tools/CppUnitTest', duplicate=0)  env.SConscript(dirs = ['tools/CppUnitTest/src'], variant_dir='$BUILD_DIR/$PLATFORM/tools/CppUnitTest', duplicate=0)
686  env.SConscript(dirs = ['tools/escriptconvert'], variant_dir='build/$PLATFORM/tools/escriptconvert', duplicate=0)  env.SConscript(dirs = ['tools/escriptconvert'], variant_dir='$BUILD_DIR/$PLATFORM/tools/escriptconvert', duplicate=0)
687  env.SConscript(dirs = ['paso/src'], variant_dir='build/$PLATFORM/paso', duplicate=0)  env.SConscript(dirs = ['paso/src'], variant_dir='$BUILD_DIR/$PLATFORM/paso', duplicate=0)
688  env.SConscript(dirs = ['weipa/src'], variant_dir='build/$PLATFORM/weipa', duplicate=0)  env.SConscript(dirs = ['weipa/src'], variant_dir='$BUILD_DIR/$PLATFORM/weipa', duplicate=0)
689  env.SConscript(dirs = ['escript/src'], variant_dir='build/$PLATFORM/escript', duplicate=0)  env.SConscript(dirs = ['escript/src'], variant_dir='$BUILD_DIR/$PLATFORM/escript', duplicate=0)
690  env.SConscript(dirs = ['esysUtils/src'], variant_dir='build/$PLATFORM/esysUtils', duplicate=0)  env.SConscript(dirs = ['esysUtils/src'], variant_dir='$BUILD_DIR/$PLATFORM/esysUtils', duplicate=0)
691  env.SConscript(dirs = ['dudley/src'], variant_dir='build/$PLATFORM/dudley', duplicate=0)  env.SConscript(dirs = ['dudley/src'], variant_dir='$BUILD_DIR/$PLATFORM/dudley', duplicate=0)
692  env.SConscript(dirs = ['finley/src'], variant_dir='build/$PLATFORM/finley', duplicate=0)  env.SConscript(dirs = ['finley/src'], variant_dir='$BUILD_DIR/$PLATFORM/finley', duplicate=0)
693  env.SConscript(dirs = ['modellib/py_src'], variant_dir='build/$PLATFORM/modellib', duplicate=0)  env.SConscript(dirs = ['modellib/py_src'], variant_dir='$BUILD_DIR/$PLATFORM/modellib', duplicate=0)
694  env.SConscript(dirs = ['doc'], variant_dir='build/$PLATFORM/doc', duplicate=0)  env.SConscript(dirs = ['doc'], variant_dir='$BUILD_DIR/$PLATFORM/doc', duplicate=0)
695  env.SConscript(dirs = ['pyvisi/py_src'], variant_dir='build/$PLATFORM/pyvisi', duplicate=0)  env.SConscript(dirs = ['pyvisi/py_src'], variant_dir='$BUILD_DIR/$PLATFORM/pyvisi', duplicate=0)
696  env.SConscript(dirs = ['pycad/py_src'], variant_dir='build/$PLATFORM/pycad', duplicate=0)  env.SConscript(dirs = ['pycad/py_src'], variant_dir='$BUILD_DIR/$PLATFORM/pycad', duplicate=0)
697  env.SConscript(dirs = ['pythonMPI/src'], variant_dir='build/$PLATFORM/pythonMPI', duplicate=0)  env.SConscript(dirs = ['pythonMPI/src'], variant_dir='$BUILD_DIR/$PLATFORM/pythonMPI', duplicate=0)
698  env.SConscript(dirs = ['paso/profiling'], variant_dir='build/$PLATFORM/paso/profiling', duplicate=0)  env.SConscript(dirs = ['paso/profiling'], variant_dir='$BUILD_DIR/$PLATFORM/paso/profiling', duplicate=0)
699    
700  ######################## Populate the buildvars file #########################  ######################## Populate the buildvars file #########################
701    
# Line 687  buildvars.write("mpi_inc_path=%s\n"%mpi_ Line 733  buildvars.write("mpi_inc_path=%s\n"%mpi_
733  buildvars.write("mpi_lib_path=%s\n"%mpi_lib_path)  buildvars.write("mpi_lib_path=%s\n"%mpi_lib_path)
734  buildvars.write("lapack=%s\n"%env['lapack'])  buildvars.write("lapack=%s\n"%env['lapack'])
735  buildvars.write("pyvisi=%d\n"%env['pyvisi'])  buildvars.write("pyvisi=%d\n"%env['pyvisi'])
736  for i in 'netcdf','parmetis','papi','mkl','umfpack','silo','visit':  buildvars.write("vsl_random=%d"%int(env['vsl_random']))
737    for i in 'netcdf','parmetis','papi','mkl','umfpack','boomeramg','silo','visit':
738      buildvars.write("%s=%d\n"%(i, int(env[i])))      buildvars.write("%s=%d\n"%(i, int(env[i])))
739      if env[i]:      if env[i]:
740          buildvars.write("%s_inc_path=%s\n"%(i, eval(i+'_inc_path')))          buildvars.write("%s_inc_path=%s\n"%(i, eval(i+'_inc_path')))
# Line 761  env.Alias('install_cppunittest', ['build Line 808  env.Alias('install_cppunittest', ['build
808  env.Alias('run_tests', ['install_all', 'install_cppunittest_lib'])  env.Alias('run_tests', ['install_all', 'install_cppunittest_lib'])
809  env.Alias('all_tests', ['install_all', 'install_cppunittest_lib', 'run_tests', 'py_tests'])  env.Alias('all_tests', ['install_all', 'install_cppunittest_lib', 'run_tests', 'py_tests'])
810  env.Alias('build_full',['install_all','build_tests','build_py_tests'])  env.Alias('build_full',['install_all','build_tests','build_py_tests'])
811  env.Alias('build_PasoTests','build/$PLATFORM/paso/profiling/PasoTests')  env.Alias('build_PasoTests','$BUILD_DIR/$PLATFORM/paso/profiling/PasoTests')
812    
813  ##################### Targets to build the documentation #####################  ##################### Targets to build the documentation #####################
814    
815  env.Alias('api_epydoc','install_all')  env.Alias('api_epydoc','install_all')
816  env.Alias('docs', ['examples_tarfile', 'examples_zipfile', 'api_epydoc', 'api_doxygen', 'guide_pdf', 'install_pdf', 'cookbook_pdf'])  env.Alias('docs', ['examples_tarfile', 'examples_zipfile', 'api_epydoc', 'api_doxygen', 'user_pdf', 'install_pdf', 'cookbook_pdf'])
817  env.Alias('release_prep', ['docs', 'install_all'])  env.Alias('release_prep', ['docs', 'install_all'])
818    
819  if not IS_WINDOWS:  if not IS_WINDOWS:
# Line 785  if not IS_WINDOWS: Line 832  if not IS_WINDOWS:
832      # Make sure that the escript wrapper is in place      # Make sure that the escript wrapper is in place
833      if not os.path.isfile(os.path.join(env['bininstall'], 'run-escript')):      if not os.path.isfile(os.path.join(env['bininstall'], 'run-escript')):
834          print("Copying escript wrapper.")          print("Copying escript wrapper.")
835          Execute(Copy(os.path.join(env['bininstall'],'escript'), 'bin/run-escript'))          Execute(Copy(os.path.join(env['bininstall'],'run-escript'), 'bin/run-escript'))
836    

Legend:
Removed from v.3319  
changed lines
  Added in v.3508

  ViewVC Help
Powered by ViewVC 1.1.26