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

Diff of /branches/amg_from_3530/SConstruct

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

revision 2548 by jfenwick, Mon Jul 20 06:20:06 2009 UTC revision 2721 by jfenwick, Fri Oct 16 05:40:12 2009 UTC
# Line 16  EnsureSConsVersion(0,96,91) Line 16  EnsureSConsVersion(0,96,91)
16  EnsurePythonVersion(2,3)  EnsurePythonVersion(2,3)
17    
18  import sys, os, re, socket, platform, stat  import sys, os, re, socket, platform, stat
19    # For copy()
20    import shutil
21    
22  # Add our extensions  # Add our extensions
23  if os.path.isdir('scons'): sys.path.append('scons')  if os.path.isdir('scons'): sys.path.append('scons')
# Line 33  IS_WINDOWS_PLATFORM = (os.name== "nt") Line 35  IS_WINDOWS_PLATFORM = (os.name== "nt")
35    
36  prefix = ARGUMENTS.get('prefix', Dir('#.').abspath)  prefix = ARGUMENTS.get('prefix', Dir('#.').abspath)
37    
38    #Holds names of variables from the calling environment which need to be passed
39    #to tools
40    env_export=[]
41    
42  #Determine where to read options from use:  #Determine where to read options from use:
43  #1. command line  #1. command line
44  #2. scons/<hostname>_options.py  #2. scons/<hostname>_options.py
45  #3. name as part of a cluster  #3. name as part of a cluster
46  options_file=ARGUMENTS.get('options_file', None)  options_file=ARGUMENTS.get('options_file', None)
47    effective_hostname=socket.gethostname().split('.')[0]
48  if not options_file:  if not options_file:
49    hostname = re.sub("[^0-9a-zA-Z]", "_", socket.gethostname().split('.')[0])    mangledhostname = re.sub("[^0-9a-zA-Z]", "_", effective_hostname)
50    options_file = os.path.join("scons",hostname+"_options.py")    options_file = os.path.join("scons",mangledhostname+"_options.py")
51    #If there is no options file with that name see if there is a substitute    #If there is no options file with that name see if there is a substitute
52    if not os.path.isfile(options_file):    if not os.path.isfile(options_file):
53      tmp = scons_extensions.effectiveName(hostname)      effective_hostname = scons_extensions.effectiveName(effective_hostname)
54      options_file = os.path.join("scons",tmp+"_options.py")      mangledhostname = re.sub("[^0-9a-zA-Z]", "_", effective_hostname)
55        options_file = os.path.join("scons",mangledhostname+"_options.py")
56    
57  if not os.path.isfile(options_file):  if not os.path.isfile(options_file):
58    print "Options file not found (expected '%s')" % options_file    print "Options file not found (expected '%s')" % options_file
# Line 94  adder( Line 102  adder(
102    BoolVariable('usepedantic', 'Compile with -pedantic if using gcc', 'no'),    BoolVariable('usepedantic', 'Compile with -pedantic if using gcc', 'no'),
103    BoolVariable('usewarnings','Compile with warnings as errors if using gcc','yes'),    BoolVariable('usewarnings','Compile with warnings as errors if using gcc','yes'),
104    ('forcelazy','for testing use only - set the default value for autolazy','leave_alone'),    ('forcelazy','for testing use only - set the default value for autolazy','leave_alone'),
105      ('forcecollres','for testing use only - set the default value for force resolving collective ops','leave_alone'),
106  # Python  # Python
107    ('python_path', 'Path to Python includes', '/usr/include/'+python_version),    ('python_path', 'Path to Python includes', '/usr/include/'+python_version),
108    ('python_lib_path', 'Path to Python libs', usr_lib),    ('python_lib_path', 'Path to Python libs', usr_lib),
# Line 157  adder( Line 166  adder(
166  # finer control over library building, intel aggressive global optimisation  # finer control over library building, intel aggressive global optimisation
167  # works with dynamic libraries on windows.  # works with dynamic libraries on windows.
168    ('share_esysUtils', 'control static or dynamic esysUtils lib', False),    ('share_esysUtils', 'control static or dynamic esysUtils lib', False),
169    ('share_paso', 'control static or dynamic paso lib', False)    ('share_paso', 'control static or dynamic paso lib', False),
170      ('env_export','Environment variables to be passed to children',[])
171  )  )
172    
173    
174    
175  ############ Specify which compilers to use ####################  ############ Specify which compilers to use ####################
176    
177  # intelc uses regular expressions improperly and emits a warning about  # intelc uses regular expressions improperly and emits a warning about
# Line 170  if IS_WINDOWS_PLATFORM: Line 182  if IS_WINDOWS_PLATFORM:
182        env = Environment(tools = ['default'] + env['tools_names'],        env = Environment(tools = ['default'] + env['tools_names'],
183                          options = opts)                          options = opts)
184  else:  else:
185     if socket.gethostname().split('.')[0] == 'service0':     if effective_hostname == 'service0':
186        env = Environment(tools = ['default', 'intelc'], options = opts)        env = Environment(tools = ['default', 'intelc'], options = opts)
187     elif os.uname()[4]=='ia64':     elif os.uname()[4]=='ia64':
188        env = Environment(tools = ['default', 'intelc'], options = opts)        env = Environment(tools = ['default', 'intelc'], options = opts)
# Line 180  else: Line 192  else:
192        env = Environment(tools = ['default'], options = opts)        env = Environment(tools = ['default'], options = opts)
193  Help(opts.GenerateHelpText(env))  Help(opts.GenerateHelpText(env))
194    
195    
196    ############ Make sure target directories exist ################
197    
198    if not os.path.isdir(env['bininstall']):
199        os.makedirs(env['bininstall'])
200    if not os.path.isdir(env['libinstall']):
201        os.makedirs(env['libinstall'])
202    if not os.path.isdir(env['pyinstall']):
203        os.makedirs(env['pyinstall'])
204    
205    ########## Copy required environment vars ######################
206    
207    for i in env['env_export']:
208       env.Append(ENV = {i:os.environ[i]})
209    
210  ############ Fill in compiler options if not set above #########  ############ Fill in compiler options if not set above #########
211    
212  # Backwards compatibility: allow dodebug=yes and useMPI=yes  # Backwards compatibility: allow dodebug=yes and useMPI=yes
# Line 243  if env["omp_libs"] == "-DEFAULT_6": env[ Line 270  if env["omp_libs"] == "-DEFAULT_6": env[
270  #set up the autolazy values  #set up the autolazy values
271  if env['forcelazy']    != "leave_alone":  if env['forcelazy']    != "leave_alone":
272    if env['forcelazy'] == 'on':    if env['forcelazy'] == 'on':
273      env.Append(CPPDEFINES='FAUTOLAZYON')      env.Append(CPPDEFINES=['FAUTOLAZYON'])
274    else:    else:
275       if env['forcelazy'] == 'off':       if env['forcelazy'] == 'off':
276      env.Append(CPPDEFINES='FAUTOLAZYOFF')      env.Append(CPPDEFINES=['FAUTOLAZYOFF'])
277    
278    #set up the colective resolve values
279    if env['forcecollres']    != "leave_alone":
280      print env['forcecollres']
281      if env['forcecollres'] == 'on':
282        env.Append(CPPDEFINES=['FRESCOLLECTON'])
283      else:
284         if env['forcecollres'] == 'off':
285        env.Append(CPPDEFINES=['FRESCOLLECTOFF'])
286    
287    
288  # OpenMP is disabled if useopenmp=no or both variables omp_optim and omp_debug are empty  # OpenMP is disabled if useopenmp=no or both variables omp_optim and omp_debug are empty
289  if not env["useopenmp"]:  if not env["useopenmp"]:
# Line 873  if not IS_WINDOWS_PLATFORM: Line 910  if not IS_WINDOWS_PLATFORM:
910      print "Error attempting to write unittests file."      print "Error attempting to write unittests file."
911      sys.exit(1)      sys.exit(1)
912    
913       #Make sure that the escript wrapper is in place
914       if not os.path.isfile(os.path.join(env['bininstall'],'escript')):
915           print "Copying escript wrapper"
916           shutil.copy("bin/escript",os.path.join(env['bininstall'],'escript'))

Legend:
Removed from v.2548  
changed lines
  Added in v.2721

  ViewVC Help
Powered by ViewVC 1.1.26