Ignore:
Timestamp:
Nov 19, 2022 4:00:09 PM (7 months ago)
Author:
toby
Message:

reorg scons build: testing

File:
1 edited

Legend:

Unmodified
Added
Removed
  • trunk/fsource/SConstruct

    r5369 r5375  
    227227
    228228examples:
    229     scons -Q
     229    scons
    230230       (builds into ../bin for current platform using default options)
    231     scons -Q install=t
     231    scons -Q install=T
    232232       (builds into ../bin<platform-dir> for module distribution)
    233233    """)
    234234    sys.exit()
    235 #==========================================================================================
    236 # override from command-line options
    237 for var in ['F2PYflags','F2PYpath','F2PYsuffix','FCompiler','FORTpath','FORTflags','LDFLAGS']:
    238     if ARGUMENTS.get(var, None) is not None:
    239         print ('Setting',var,'to',ARGUMENTS.get(var),'based on command line')
    240         exec(var + "= ARGUMENTS.get('" + var +"')")
    241235#==========================================================================================
    242236# get the python version number from the python image in the f2py directory
     
    389383env.Append(BUILDERS = {'nist' : Builder(generator = generate_nist)},)
    390384
    391 
    392 #==========================================================================================
    393 # Setup build Environment
    394 #    add compiler, f2py & python to path
    395 if FORTpath != "":  env.PrependENVPath('PATH', FORTpath)
    396 if F2PYpath != "":  env.PrependENVPath('PATH', F2PYpath)
    397 if pythonpath != "" and pythonpath != F2PYpath: env.PrependENVPath('PATH', pythonpath)
    398 #   add other needed environment variables
    399 for var in ('LDFLAGS','SDKROOT'):
    400     if eval(var) != "":
    401        env['ENV'][var] = eval(var)
    402        print("Setting environment variable {} to {}".format(var,eval(var)))
    403 if 'WINDIR' in os.environ: env['ENV']['WINDIR'] = os.environ['WINDIR']
    404 
    405 #==========================================================================================
    406 # finally ready to build something!
    407 # locate libraries to be built (subdirectories named *subs)
     385#==========================================================================================
     386# override from command-line options
     387for var in ['F2PYflags','F2PYpath','F2PYsuffix','FCompiler','FORTpath','FORTflags','LDFLAGS']:
     388    if ARGUMENTS.get(var, None) is not None:
     389        print ('Setting',var,'to "'+ARGUMENTS.get(var)+'" based on command line')
     390        exec(var + "= ARGUMENTS.get('" + var +"')")
     391#==========================================================================================
     392# locate libraries to be built (in subdirectories named *subs)
    408393liblist = []
    409394NISTlib = []
     
    439424    modlist.append(out[0].name)
    440425
     426exelist = []
    441427# NIST*LATTICE programs
    442428for src in 'LATTIC.f','convcell.f':
     
    445431    Clean(out, target)
    446432    Depends(target, NISTlib) # make sure library is rebuilt if old   
    447 #==========================================================================================
    448 # all done with setup, show the user the options and let scons do the work
     433    exelist.append(out[0].name)
     434#==========================================================================================
     435# all done with setup, finally ready to build something! but 1st show the
     436# user the final options and save in build notes; then let scons do the work
     437print ('Note: Use "scons help" to see build options')
    449438print (80*'=')
    450439for var in ['FCompiler','FORTpath','FORTflags','F2PYflags','F2PYpath','F2PYsuffix','LDFLAGS']:
    451     print ('Variable',var,'is',eval(var))
     440    print ('Variable',var,'is','"'+eval(var)+'"')
    452441print ('Using python at', pythonprogram )
    453442print ('Python/f2py version =',version,PlatformBits)
     
    459448for mod in modlist: print (" " + mod,)
    460449print ("")
    461 print ('Use "scons help" to see build options')
     450print ('Will compile these executables:',)
     451for mod in exelist: print (" " + mod,)
     452print ("")
     453print (80*'=')
     454print("Setting environment variables:")
     455# Setup build Environment
     456#    add compiler, f2py & python to path
     457if FORTpath != "":  env.PrependENVPath('PATH', FORTpath)
     458if F2PYpath != "":  env.PrependENVPath('PATH', F2PYpath)
     459if pythonpath != "" and pythonpath != F2PYpath: env.PrependENVPath('PATH', pythonpath)
     460#   add other needed environment variables
     461for var in ('LDFLAGS','SDKROOT'):
     462    if eval(var) != "":
     463       env['ENV'][var] = eval(var)
     464       print("\t{} = {}".format(var,eval(var)))
     465if 'WINDIR' in os.environ:
     466    env['ENV']['WINDIR'] = os.environ['WINDIR']
     467    print("\t {} = {}".format(WINDIR,eval(os.environ['WINDIR'])))
    462468print (80*'=')
    463469#print (env.Dump())
     
    471477    fp.write('Created {} on {}\n'.format(datetime.datetime.isoformat(datetime.datetime.now()),
    472478                                         platform.node()))
     479    for var in ['FCompiler','FORTpath','FORTflags','F2PYflags','F2PYpath','F2PYsuffix','LDFLAGS']:
     480        fp.write('\tVariable',var,'=','"'+eval(var)+'"\n')
    473481    fp.close()
Note: See TracChangeset for help on using the changeset viewer.