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

Diff of /branches/diaplayground/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 2324 by jfenwick, Thu Mar 19 04:35:30 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 572  if env_mpi['usempi']: Line 572  if env_mpi['usempi']:
572    conf.env.PrependENVPath('LD_LIBRARY_PATH', env['libinstall'])    conf.env.PrependENVPath('LD_LIBRARY_PATH', env['libinstall'])
573    
574  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
575  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
576    
577  # Add MPI to environment env_mpi if it was found  # Add MPI to environment env_mpi if it was found
578  if env_mpi['usempi']:  if env_mpi['usempi']:
# Line 653  print "" Line 653  print ""
653    
654  ############ Delete option-dependent files #####################  ############ Delete option-dependent files #####################
655    
656  Execute(Delete(env['libinstall'] + "/Compiled.with.debug"))  Execute(Delete(os.path.join(env['libinstall'],"Compiled.with.debug")))
657  Execute(Delete(env['libinstall'] + "/Compiled.with.mpi"))  Execute(Delete(os.path.join(env['libinstall'],"Compiled.with.mpi")))
658  Execute(Delete(env['libinstall'] + "/Compiled.with.openmp"))  Execute(Delete(os.path.join(env['libinstall'],"Compiled.with.openmp")))
659  if not env['usempi']: Execute(Delete(env['libinstall'] + "/pythonMPI"))  Execute(Delete(os.path.join(env['libinstall'],"pyversion")))
660    Execute(Delete(os.path.join(env['libinstall'],"buildvars")))
661    if not env['usempi']: Execute(Delete(os.path.join(env['libinstall'],"pythonMPI")))
662    
663    
664  ############ Build the subdirectories ##########################  ############ Build the subdirectories ##########################
# Line 694  env.SConscript(dirs = ['paso/profiling'] Line 696  env.SConscript(dirs = ['paso/profiling']
696  remember_list = []  remember_list = []
697    
698  if env['usedebug']:  if env['usedebug']:
699    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'))
700    
701  if env['usempi']:  if env['usempi']:
702    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'))
703    
704  if env['omp_optim'] != '':  if env['useopenmp']:
705    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'))
706    
707  env.Alias('remember_options', remember_list)  env.Alias('remember_options', remember_list)
708    
709    
710    ############### Record python interpreter version ##############
711    
712    if not IS_WINDOWS_PLATFORM:
713      versionstring="Python "+str(sys.version_info[0])+"."+str(sys.version_info[1])+"."+str(sys.version_info[2])
714      os.system("echo "+versionstring+" > "+os.path.join(env['libinstall'],"pyversion"))
715    
716    ############## Populate the buildvars file #####################
717    
718    buildvars=open(os.path.join(env['libinstall'],'buildvars'),'w')
719    buildvars.write('python='+str(sys.version_info[0])+"."+str(sys.version_info[1])+"."+str(sys.version_info[2])+'\n')
720    
721    # Find the boost version by extracting it from version.hpp
722    boosthpp=open(os.path.join(env['boost_path'],'boost','version.hpp'))
723    boostversion='unknown'
724    try:
725        for line in boosthpp:
726            ver=re.match(r'#define BOOST_VERSION (\d+)',line)
727            if ver:
728                boostversion=ver.group(1)
729    except StopIteration:
730        pass
731    buildvars.write("boost="+boostversion+"\n")
732    buildvars.write("svn_revision="+str(global_revision)+"\n")
733    out="usedebug="
734    if env['usedebug']:
735        out+="y"
736    else:
737        out+="n"
738    out+="\nusempi="
739    if env['usempi']:
740        out+="y"
741    else:
742        out+="n"
743    out+="\nuseopenmp="
744    if env['useopenmp']:
745        out+="y"
746    else:
747        out+="n"
748    buildvars.write(out+"\n")
749    
750    buildvars.close()
751    
752    
753  ############ Targets to build and install libraries ############  ############ Targets to build and install libraries ############
754    
755  target_init = env.Command(env['pyinstall']+'/__init__.py', None, Touch('$TARGET'))  target_init = env.Command(env['pyinstall']+'/__init__.py', None, Touch('$TARGET'))
# Line 773  if not IS_WINDOWS_PLATFORM: Line 819  if not IS_WINDOWS_PLATFORM:
819      for tests in TestGroups:      for tests in TestGroups:
820          utest.write(tests.makeString())          utest.write(tests.makeString())
821      utest.close()      utest.close()
822        os.chmod("utest.sh",stat.S_IRWXU|stat.S_IRGRP|stat.S_IXGRP|stat.S_IROTH|stat.S_IXOTH)
823      print "utest.sh written"      print "utest.sh written"
824     except IOError:     except IOError:
825      print "Error attempting to write unittests file."      print "Error attempting to write unittests file."

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

  ViewVC Help
Powered by ViewVC 1.1.26