Changeset 370


Ignore:
Timestamp:
Sep 12, 2011 2:13:51 PM (10 years ago)
Author:
toby
Message:

Edits to build on 64-bit linux (RH Enterprise 5)

Location:
trunk
Files:
8 added
1 edited

Legend:

Unmodified
Added
Removed
  • trunk/fsource/SConstruct

    r364 r370  
    3232# need command-line options for fortran command and fortran options
    3333F2PYflags = '' # compiler options for f2py command
    34 F2PYpath = which_path('f2py')       # default path to f2py
     34# find a default f2py relative to the scons location. Should be in the same place as f2py
     35F2PYpath = ''
     36for program in ['f2py','../f2py']:
     37    if sys.platform == "win32" and os.path.splitext(program)[1].lower() != '.exe':
     38        program = program + '.exe'
     39    spath = os.path.split(sys.executable)[0]
     40    print spath
     41    f2pyprogram = os.path.normpath(os.path.join(spath,program))
     42    if is_exe(f2pyprogram):
     43        F2PYpath = os.path.split(f2pyprogram)[0]
     44        break
     45else:
     46    print 'Note: Using f2py from path (hope that works!)'
     47    F2PYpath = which_path('f2py')       # default path to f2py
     48
    3549GFORTpath = which_path('gfortran')   # path to compiler
    3650FCompiler='gfortran'
     
    127141        print 'Setting',var,'to',ARGUMENTS.get(var),'based on command line'
    128142        exec(var + "= ARGUMENTS.get('" + var +"')")
    129 #==========================================================================================
    130 # use the compiler choice to set compiler options, but don't change anything
    131 # specified on the command line
    132 if FCompiler == 'gfortran':
    133     if FORTpath == "": FORTpath = GFORTpath
    134     if F2PYflags == "": F2PYflags = '--fcompiler=gnu95 --f77exec=gfortran --f77flags="-fno-range-check"'
    135     if sys.platform == "linux2":
    136         if FORTflags == "": FORTflags = ' -w -O2 -fPIC'
    137 elif FCompiler == 'g77':
    138     if FORTpath == "": FORTpath = G77path
    139     if sys.platform == "win32":
    140         if F2PYflags == "": F2PYflags = '--compiler=mingw32 --fcompiler=gnu'
    141         if FORTflags == "": FORTflags = ' -w -O2 -fno-automatic -finit-local-zero -malign-double -mwindows'
    142     else:
    143         if F2PYflags == "": F2PYflags = '--fcompiler=gnu --f77exec=g77 --f77flags="-fno-range-check"'
    144 
    145 else:
    146     if FORTpath == "": print 'Likely error, FORTpath is not specified'
    147     if F2PYflags == "":
    148         print 'Error: specify a F2PYflags value'
    149         sys.exit()
    150 
    151143#==========================================================================================
    152144# get the python version number from the python image in the f2py directory
     
    163155'''
    164156    sys.exit()
    165 #  find the python location. Note that on Windows it may be in the parent of the f2py location
     157# find the python location associated with the f2py in use. Note
     158#   that on Windows it may be in the parent of the f2py location.
    166159# then run it to get info about the verision and the number of bits
    167160pythonpath = ''
     
    202195    InstallLoc = '../' + prefix + bits + version
    203196    Alias('install',InstallLoc)
    204 
     197#==========================================================================================
     198# use the compiler choice to set compiler options, but don't change anything
     199# specified on the command line
     200if FCompiler == 'gfortran':
     201    if FORTpath == "": FORTpath = GFORTpath
     202    if F2PYflags == "": F2PYflags = '--fcompiler=gnu95 --f77exec=gfortran --f77flags="-fno-range-check"'
     203#    if sys.platform == "linux2":
     204#        if FORTflags == "": FORTflags = ' -w -O2 -fPIC'
     205    if sys.platform == "linux2" and PlatformBits == '64bit':
     206        if FORTflags == "": FORTflags = ' -w -O2 -fPIC -m64'
     207    elif sys.platform == "linux2":
     208        if FORTflags == "": FORTflags = ' -w -O2 -fPIC -m32'
     209elif FCompiler == 'g77':
     210    if FORTpath == "": FORTpath = G77path
     211    if sys.platform == "win32":
     212        if F2PYflags == "": F2PYflags = '--compiler=mingw32 --fcompiler=gnu'
     213        if FORTflags == "": FORTflags = ' -w -O2 -fno-automatic -finit-local-zero -malign-double -mwindows'
     214    else:
     215        if F2PYflags == "": F2PYflags = '--fcompiler=gnu --f77exec=g77 --f77flags="-fno-range-check"'
     216
     217else:
     218    if FORTpath == "": print 'Likely error, FORTpath is not specified'
     219    if F2PYflags == "":
     220        print 'Error: specify a F2PYflags value'
     221        sys.exit()
     222#==========================================================================================
    205223# Setup build Environment
    206224env = Environment()
Note: See TracChangeset for help on using the changeset viewer.