/[escript]/trunk/SConstruct
ViewVC logotype

Diff of /trunk/SConstruct

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

revision 2296 by jfenwick, Thu Mar 5 05:47:34 2009 UTC revision 2334 by jfenwick, Thu Mar 26 03:05:33 2009 UTC
# Line 15  Line 15 
15  EnsureSConsVersion(0,96,91)  EnsureSConsVersion(0,96,91)
16  EnsurePythonVersion(2,3)  EnsurePythonVersion(2,3)
17    
18  import sys, os, re, socket, platform  import sys, os, re, socket, platform, stat
19    
20  # Add our extensions  # Add our extensions
21  if os.path.isdir('scons'): sys.path.append('scons')  if os.path.isdir('scons'): sys.path.append('scons')
# Line 189  elif env["CC"] == "gcc": Line 189  elif env["CC"] == "gcc":
189  #the long long warning occurs on the Mac  #the long long warning occurs on the Mac
190    cc_optim      = "-O3"    cc_optim      = "-O3"
191    cc_debug      = "-g -O0 -DDOASSERT -DDOPROF -DBOUNDS_CHECK"    cc_debug      = "-g -O0 -DDOASSERT -DDOPROF -DBOUNDS_CHECK"
192    omp_optim     = ""    omp_optim     = "-fopenmp"
193    omp_debug     = ""    omp_debug     = "-fopenmp"
194    omp_libs      = []    omp_libs      = ['gomp']
195    pedantic      = "-pedantic-errors -Wno-long-long"    pedantic      = "-pedantic-errors -Wno-long-long"
196    fatalwarning      = "-Werror"    fatalwarning      = "-Werror"
197    sysheaderopt      = "-isystem "    sysheaderopt      = "-isystem "
# Line 296  if env['usepedantic']: env.Append(CCFLAG Line 296  if env['usepedantic']: env.Append(CCFLAG
296    
297  # MS Windows  # MS Windows
298  if IS_WINDOWS_PLATFORM:  if IS_WINDOWS_PLATFORM:
299    env.PrependENVPath('PATH',    [env['boost_lib_path']])    env.AppendENVPath('PATH', [env['boost_lib_path']])
300    env.PrependENVPath('PATH',    [env['libinstall']])    env.AppendENVPath('PATH', [env['libinstall']])
301    if not env['share_esysUtils'] :    if not env['share_esysUtils'] :
302      env.Append(CPPDEFINES = ['ESYSUTILS_STATIC_LIB'])      env.Append(CPPDEFINES = ['ESYSUTILS_STATIC_LIB'])
303    if not env['share_paso'] :    if not env['share_paso'] :
304      env.Append(CPPDEFINES = ['PASO_STATIC_LIB'])      env.Append(CPPDEFINES = ['PASO_STATIC_LIB'])
305    
306    if env['usenetcdf']:    if env['usenetcdf']:
307      env.PrependENVPath('PATH',  [env['netCDF_lib_path']])      env.AppendENVPath('PATH',   [env['netCDF_lib_path']])
308    
309  env.Append(ARFLAGS = env['ar_flags'])  env.Append(ARFLAGS = env['ar_flags'])
310    
# Line 408  if env['usevtk']: Line 408  if env['usevtk']:
408    
409  conf = Configure(clone_env(env))  conf = Configure(clone_env(env))
410    
411    print "<1<<<<"+str(conf.env['ENV']['LD_LIBRARY_PATH'])
412    
413    
414  if env['usenetcdf']:  if env['usenetcdf']:
415    conf.env.AppendUnique(CPPPATH = [env['netCDF_path']])    conf.env.AppendUnique(CPPPATH = [env['netCDF_path']])
416    conf.env.AppendUnique(LIBPATH = [env['netCDF_lib_path']])    conf.env.AppendUnique(LIBPATH = [env['netCDF_lib_path']])
# Line 420  if env['usenetcdf']: Line 423  if env['usenetcdf']:
423  if env['usenetcdf'] and not conf.CheckCHeader('netcdf.h'): env['usenetcdf'] = 0  if env['usenetcdf'] and not conf.CheckCHeader('netcdf.h'): env['usenetcdf'] = 0
424  if env['usenetcdf'] and not conf.CheckFunc('nc_open'): env['usenetcdf'] = 0  if env['usenetcdf'] and not conf.CheckFunc('nc_open'): env['usenetcdf'] = 0
425    
426    print "<2<<<<"+str(conf.env['ENV']['LD_LIBRARY_PATH'])
427    
428  # Add NetCDF to environment env if it was found  # Add NetCDF to environment env if it was found
429  if env['usenetcdf']:  if env['usenetcdf']:
430    env = conf.Finish()    env = conf.Finish()
# Line 427  if env['usenetcdf']: Line 432  if env['usenetcdf']:
432  else:  else:
433    conf.Finish()    conf.Finish()
434    
435    print "<A<<<<"+str(env['ENV']['LD_LIBRARY_PATH'])
436    
437  ############ PAPI (optional) ###################################  ############ PAPI (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
# Line 572  if env_mpi['usempi']: Line 579  if env_mpi['usempi']:
579    conf.env.PrependENVPath('LD_LIBRARY_PATH', env['libinstall'])    conf.env.PrependENVPath('LD_LIBRARY_PATH', env['libinstall'])
580    
581  if env_mpi['usempi'] and not conf.CheckCHeader('mpi.h'): env_mpi['usempi'] = 0  if env_mpi['usempi'] and not conf.CheckCHeader('mpi.h'): env_mpi['usempi'] = 0
582  if env_mpi['usempi'] and not conf.CheckFunc('MPI_Init'): env_mpi['usempi'] = 0  # if env_mpi['usempi'] and not conf.CheckFunc('MPI_Init'): env_mpi['usempi'] = 0
583    
584  # Add MPI to environment env_mpi if it was found  # Add MPI to environment env_mpi if it was found
585  if env_mpi['usempi']:  if env_mpi['usempi']:
# Line 653  print "" Line 660  print ""
660    
661  ############ Delete option-dependent files #####################  ############ Delete option-dependent files #####################
662    
663  Execute(Delete(env['libinstall'] + "/Compiled.with.debug"))  Execute(Delete(os.path.join(env['libinstall'],"Compiled.with.debug")))
664  Execute(Delete(env['libinstall'] + "/Compiled.with.mpi"))  Execute(Delete(os.path.join(env['libinstall'],"Compiled.with.mpi")))
665  Execute(Delete(env['libinstall'] + "/Compiled.with.openmp"))  Execute(Delete(os.path.join(env['libinstall'],"Compiled.with.openmp")))
666  if not env['usempi']: Execute(Delete(env['libinstall'] + "/pythonMPI"))  Execute(Delete(os.path.join(env['libinstall'],"pyversion")))
667    Execute(Delete(os.path.join(env['libinstall'],"buildvars")))
668    if not env['usempi']: Execute(Delete(os.path.join(env['libinstall'],"pythonMPI")))
669    
670    
671  ############ Build the subdirectories ##########################  ############ Build the subdirectories ##########################
# Line 694  env.SConscript(dirs = ['paso/profiling'] Line 703  env.SConscript(dirs = ['paso/profiling']
703  remember_list = []  remember_list = []
704    
705  if env['usedebug']:  if env['usedebug']:
706    remember_list += env.Command(env['libinstall'] + "/Compiled.with.debug", None, Touch('$TARGET'))    remember_list += env.Command(os.path.join(env['libinstall'],"Compiled.with.debug"), None, Touch('$TARGET'))
707    
708  if env['usempi']:  if env['usempi']:
709    remember_list += env.Command(env['libinstall'] + "/Compiled.with.mpi", None, Touch('$TARGET'))    remember_list += env.Command(os.path.join(env['libinstall'],"Compiled.with.mpi"), None, Touch('$TARGET'))
710    
711  if env['omp_optim'] != '':  if env['useopenmp']:
712    remember_list += env.Command(env['libinstall'] + "/Compiled.with.openmp", None, Touch('$TARGET'))    remember_list += env.Command(os.path.join(env['libinstall'],"Compiled.with.openmp"), None, Touch('$TARGET'))
713    
714  env.Alias('remember_options', remember_list)  env.Alias('remember_options', remember_list)
715    
716    
717    ############### Record python interpreter version ##############
718    
719    if not IS_WINDOWS_PLATFORM:
720      versionstring="Python "+str(sys.version_info[0])+"."+str(sys.version_info[1])+"."+str(sys.version_info[2])
721      os.system("echo "+versionstring+" > "+os.path.join(env['libinstall'],"pyversion"))
722    
723    ############## Populate the buildvars file #####################
724    
725    buildvars=open(os.path.join(env['libinstall'],'buildvars'),'w')
726    buildvars.write('python='+str(sys.version_info[0])+"."+str(sys.version_info[1])+"."+str(sys.version_info[2])+'\n')
727    
728    # Find the boost version by extracting it from version.hpp
729    boosthpp=open(os.path.join(env['boost_path'],'boost','version.hpp'))
730    boostversion='unknown'
731    try:
732        for line in boosthpp:
733            ver=re.match(r'#define BOOST_VERSION (\d+)',line)
734            if ver:
735                boostversion=ver.group(1)
736    except StopIteration:
737        pass
738    buildvars.write("boost="+boostversion+"\n")
739    buildvars.write("svn_revision="+str(global_revision)+"\n")
740    out="usedebug="
741    if env['usedebug']:
742        out+="y"
743    else:
744        out+="n"
745    out+="\nusempi="
746    if env['usempi']:
747        out+="y"
748    else:
749        out+="n"
750    out+="\nuseopenmp="
751    if env['useopenmp']:
752        out+="y"
753    else:
754        out+="n"
755    buildvars.write(out+"\n")
756    
757    buildvars.close()
758    
759    
760  ############ Targets to build and install libraries ############  ############ Targets to build and install libraries ############
761    
762  target_init = env.Command(env['pyinstall']+'/__init__.py', None, Touch('$TARGET'))  target_init = env.Command(env['pyinstall']+'/__init__.py', None, Touch('$TARGET'))
# Line 761  env.Alias('build_full',['install_all','b Line 814  env.Alias('build_full',['install_all','b
814    
815  ############ Targets to build the documentation ################  ############ Targets to build the documentation ################
816    
817  env.Alias('docs', ['examples_tarfile', 'examples_zipfile', 'api_epydoc', 'api_doxygen', 'guide_pdf', 'guide_html'])  env.Alias('docs', ['examples_tarfile', 'examples_zipfile', 'api_epydoc', 'api_doxygen', 'guide_pdf', 'guide_html','install_pdf'])
818    
819  if not IS_WINDOWS_PLATFORM:  if not IS_WINDOWS_PLATFORM:
820     try:     try:
# Line 773  if not IS_WINDOWS_PLATFORM: Line 826  if not IS_WINDOWS_PLATFORM:
826      for tests in TestGroups:      for tests in TestGroups:
827          utest.write(tests.makeString())          utest.write(tests.makeString())
828      utest.close()      utest.close()
829        os.chmod("utest.sh",stat.S_IRWXU|stat.S_IRGRP|stat.S_IXGRP|stat.S_IROTH|stat.S_IXOTH)
830      print "utest.sh written"      print "utest.sh written"
831     except IOError:     except IOError:
832      print "Error attempting to write unittests file."      print "Error attempting to write unittests file."

Legend:
Removed from v.2296  
changed lines
  Added in v.2334

  ViewVC Help
Powered by ViewVC 1.1.26