예제 #1
0
def generate(env):
    """Add construction variables for an external module to an Environment."""
    if (env.has_key("L_MDSPLUS")):
        return      # assume found
    
    l_mdsplus = "MdsLib"

    # - look for library -
    checkdir = env.get("MDSPLUS_LIBRARY_PATH",None)
    lsearch = transpSConsUtils.findDirectory(env,l_mdsplus,env['LD_LIBRARY_PATH'],
                                             checkdir=checkdir,type=3)
    if (lsearch):
        t_mdsplus = os.path.realpath(lsearch[0])
    else:
        return   # no mdsplus is ok

    # - look for includes -
    i_mdsplus = []
    checkdir=env.get("MDSPLUS_INCLUDE_PATH",
                     os.path.join(os.path.split(lsearch[0])[0],"include"))  # guess
    for inc in ["mdslib.h"]:
        isearch = transpSConsUtils.findDirectory(env,inc,env['INCLUDE_PATH'],
                                                 checkdir=checkdir)
        if (isearch):
            if (checkdir != isearch[0]):
                checkdir += " "+isearch[0]
            x = os.path.realpath(isearch[0])
            if (x not in i_mdsplus):
                i_mdsplus.append(x)
        else:
            raise ValueError("unable to find the mdsplus include file "+inc)

    env['L_MDSPLUS'] = l_mdsplus
    env.AppendUnique(LIBPATH=[t_mdsplus], CPPPATH=i_mdsplus)
예제 #2
0
def generate(env):
    """Add construction variables for an external module to an Environment."""
    if (env.has_key("L_FFTW")):
        return      # assume found
    
    l_fftw = "fftw"

    # - look for library -
    checkdir = env.get("FFTW_LIBRARY_PATH",None)
    lsearch = transpSConsUtils.findDirectory(env,l_fftw,env['LD_LIBRARY_PATH'],
                                             checkdir=checkdir,type=3)
    if (lsearch):
        t_fftw = os.path.realpath(lsearch[0])
    else:
        raise ValueError("unable to find the fftw library")

    # - look for includes -
    i_fftw = []
    checkdir=env.get("FFTW_INCLUDE_PATH",
                     os.path.join(os.path.split(lsearch[0])[0],"include"))  # guess
    for inc in ["fftw.h"]:
        isearch = transpSConsUtils.findDirectory(env,inc,env['INCLUDE_PATH'],
                                                 checkdir=checkdir)
        if (isearch):
            if (checkdir != isearch[0]):
                checkdir += " "+isearch[0]
            x = os.path.realpath(isearch[0])
            if (x not in i_fftw):
                i_fftw.append(x)
        else:
            raise ValueError("unable to find the fftw include file "+inc)

    env['L_FFTW'] = l_fftw
    env.AppendUnique(LIBPATH=[t_fftw], CPPPATH=i_fftw)
예제 #3
0
def generate(env):
    """Add construction variables for an external module to an Environment."""
    if (env['PLATFORM']=='darwin'):
        env.AppendUnique(FRAMEWORKS=["veclib"])
    else:
        if (env.has_key("L_LAPACK")):
            return      # assume found
    
        # - dependent library -
        trscons_blas.generate(env)
    
        l_lapack = "lapack"

        # - look for library -
        checkdir = env.get("LAPACK_LIBRARY_PATH",None)
        lsearch = transpSConsUtils.findDirectory(env,l_lapack,env['LD_LIBRARY_PATH'],
                                             checkdir=checkdir,type=3)
        if (lsearch):
            t_lapack = os.path.realpath(lsearch[0])
        else:
            raise ValueError("unable to find the lapack library")

        env['L_LAPACK'] = [ l_lapack ] + env.Split(env['L_BLAS'])
    
        env.AppendUnique(LIBPATH=[t_lapack])
예제 #4
0
def generate(env):
    """Add construction variables for an external module to an Environment."""
    if env.has_key("L_NETCDF"):
        return  # assume found

    l_netcdf = "netcdf"

    # - look for library -
    checkdir = env.get("NETCDF_LIBRARY_PATH", None)
    lsearch = transpSConsUtils.findDirectory(env, l_netcdf, env["LD_LIBRARY_PATH"], checkdir=checkdir, type=3)
    if lsearch:
        t_netcdf = os.path.realpath(lsearch[0])
    else:
        raise ValueError("unable to find the netcdf library")

    w_netcdf = [l_netcdf]  # library names
    x_netcdf = [t_netcdf]  # library paths

    # - look for includes -
    i_netcdf = []
    checkdir = env.get("NETCDF_INCLUDE_PATH", os.path.join(os.path.split(lsearch[0])[0], "include"))  # guess
    for inc in ["netcdf.h", "netcdf.inc"]:
        isearch = transpSConsUtils.findDirectory(env, inc, env["INCLUDE_PATH"], checkdir=checkdir)
        if isearch:
            if checkdir != isearch[0]:
                checkdir += " " + isearch[0]
            x = os.path.realpath(isearch[0])
            if x not in i_netcdf:
                i_netcdf.append(x)
        else:
            raise ValueError("unable to find the netcdf include file " + inc)

    # check for Lors
    if t_netcdf.find("netcdfL") >= 0:
        # assume this is a lors build of netcdf
        for x in ["xio", "lors_all", "xml2"]:

            lsearch = transpSConsUtils.findDirectory(env, x, env["LD_LIBRARY_PATH"], checkdir=t_netcdf, type=3)
            w_netcdf.append(x)
            if lsearch:
                x_netcdf.append(os.path.realpath(lsearch[0]))
            else:
                raise ValueError("unable to find the %s library for a lors netcdf installation" % x)

    env["L_NETCDF"] = w_netcdf
    env.AppendUnique(LIBPATH=x_netcdf, CPPPATH=i_netcdf)
예제 #5
0
def generate(env):
    """Add Builders and construction variables for NAG fortran to an Environment."""
    SCons.Tool.fortran.generate(env)      # defines various fortran flags

    env['_FORTRAND'] = 'f95'

    # --- transp stuff ---
    normpath = env.WhereIs('f95')
    if (not normpath):
        raise RuntimeError("could not find f95 in the path")
    
    normpath = os.path.normpath(os.path.realpath(normpath))
    dirpath  = os.path.dirname(normpath)

    env['FORTRAN']            = "f95" 
    env['FORTRANFLAGS']       = "-O -PIC -w=all -dcfuns -dusty -kind=byte -mismatch_all -maxcontin=85"
    env['FORTRANFLAGS_DEBUG'] = "-g -gline -PIC -O0 -dcfuns -dusty -w=all -kind=byte -mismatch_all -maxcontin=85"
    env['FORTRANMODSUFFIX']   = ".mod"
    env['FORTRAN_FREE_EXT']   = "f90"
    env['FORTRAN_FIXED_EXT']  = "for"
    env['FORTRAN_VARIANT']    = "NagWare"
    
    libpath = os.path.join(os.path.split(dirpath)[0],"lib")  # guess
    l2 = os.path.join(libpath,"NAGWare")
    if (os.path.exists(l2)):
      libpath=l2
    #print "nag guess = ",libpath
    fdir = transpSConsUtils.findDirectory(env,"f97",env['LD_LIBRARY_PATH'],
                                          checkdir=libpath,type=3)
    if (fdir):
        libpath=fdir[0]
        env['FTN_LIBPATH']=libpath
        env['FTN_LIBS']=['f97','f96','m']

    mainpath = os.path.join(libpath,"quickfit.o")
    if (os.path.isfile(mainpath)):
        env['FTN_MAIN']=mainpath

    fdir = transpSConsUtils.findDirectory(env,"f98",env['LD_LIBRARY_PATH'],
                                          checkdir=libpath,type=3)   
    if (fdir):
        libpath=fdir[0]
        env['FTN_SHLIBPATH']=libpath
        env['FTN_SHLIBS']=['extra_rob','f98']
예제 #6
0
def generate(env):
    """Add construction variables for an external module to an Environment."""
    if (env.has_key("L_SUPERLU")):
        return      # assume found
    
    # - dependent library -
    trscons_blas.generate(env)
    
    l_superlu = "superlu"

    # - look for library -
    checkdir = env.get("SUPERLU_LIBRARY_PATH",None)
    if (checkdir==None):
        checkdir = os.environ.get("SUPERLU_ROOT",None)
        if (checkdir!=None):
            checkdir = os.path.join(checkdir.strip(),"lib")
            
    lsearch = transpSConsUtils.findDirectory(env,l_superlu,env['LD_LIBRARY_PATH'],
                                             checkdir=checkdir,type=3)
    if (lsearch):
        t_superlu = os.path.realpath(lsearch[0])
    else:
        raise ValueError("unable to find the superlu library")

    # - look for includes -
    i_superlu = []
    checkdir=env.get("SUPERLU_INCLUDE_PATH",
                     os.path.join(os.path.split(lsearch[0])[0],"include"))  # guess
    for inc in ["slu_ddefs.h"]:
        isearch = transpSConsUtils.findDirectory(env,inc,env['INCLUDE_PATH'],
                                                 checkdir=checkdir)
        if (isearch):
            if (checkdir != isearch[0]):
                checkdir += " "+isearch[0]
            x = os.path.realpath(isearch[0])
            if (x not in i_superlu):
                i_superlu.append(x)
        else:
            raise ValueError("unable to find the superlu include file "+inc)

    env['L_SUPERLU'] = [ l_superlu ] + env.Split(env['L_BLAS'])
    
    env.AppendUnique(LIBPATH=[t_superlu], CPPPATH=i_superlu)
예제 #7
0
def generate(env):
    """Add construction variables for an external module to an Environment."""
    if env["PLATFORM"] == "darwin":
        env.AppendUnique(FRAMEWORKS=["veclib"])
    else:
        if env.has_key("L_BLAS"):
            return  # assume found

        l_blas = "blas"

        # - look for library -
        checkdir = env.get("BLAS_LIBRARY_PATH", None)
        lsearch = transpSConsUtils.findDirectory(env, l_blas, env["LD_LIBRARY_PATH"], checkdir=checkdir, type=3)
        if lsearch:
            t_blas = os.path.realpath(lsearch[0])
        else:
            raise ValueError("unable to find the blas library")
        env["L_BLAS"] = l_blas
        env.AppendUnique(LIBPATH=[t_blas])
예제 #8
0
def generate(env):
    """Add Builders and construction variables for lf95 to an Environment."""
    SCons.Tool.fortran.generate(env)      # defines various fortran flags

    env['_FORTRAND'] = 'lf95'

    # --- transp stuff ---
    ftype = 32
    normpath = env.WhereIs('lf95')
    if (not normpath):
        #print "no lf95"
        env['_FORTRAND'] = 'lfc'
        ftype = 64
        normpath = env.WhereIs('lfc')
        if (not normpath):
            print "no lfc"
            raise RuntimeError("could not find lf95 or lfc in the path")
    
    normpath = os.path.normpath(os.path.realpath(normpath))
    dirpath  = os.path.dirname(normpath)

    if (ftype==32):
        env['FORTRAN']        = "lf95" 
    else:
        env['FORTRAN']        = "lfc" 
        
    env['FORTRANFLAGS']       = "-O --trap --trace"
    env['FORTRANFLAGS_DEBUG'] = "-g --trap --trace"
    env['FORTRANMODSUFFIX']   = ".mod"
    env['FORTRAN_FREE_EXT']   = "f90"
    env['FORTRAN_FIXED_EXT']  = "for"
    env['FORTRAN_VARIANT']    = "LaheyFujitsu"

    if (ftype==32):
        libpath = os.path.join(os.path.split(dirpath)[0],"lib")  # guess
        fdir = transpSConsUtils.findDirectory(env,"fj9i6",env['LD_LIBRARY_PATH'],
                                              checkdir=libpath,type=3)
    else:
        libpath = os.path.join(os.path.split(dirpath)[0],"lib64")  # guess
        fdir = transpSConsUtils.findDirectory(env,"fj90i",env['LD_LIBRARY_PATH'],
                                              checkdir=libpath,type=3)
        
    if (fdir):
        libpath=fdir[0]
        env['FTN_LIBPATH']=libpath
        if (ftype==32):
            env['FTN_LIBS']=['fj9i6', 'fj9f6', 'fj9e6', 'fst', 'fccx86_6a']
            env['FTN_EXTRA_LIBS']=['fst']  # needed on fortran link line
        else:
            env['FTN_LIBS']=['fj90i', 'fj90f']
            lsearch = transpSConsUtils.findDirectory(env,"elf-0.97.1",env['LD_LIBRARY_PATH'],
                                                     checkdir="/usr/lib",type=3)
            if (lsearch==None):
                raise RuntimeError("could not find elf library")
            env.AppendUnique(LIBPATH=lsearch[0])
            env.AppendUnique(LIBS="elf")
            
        env['FTN_SHLIBPATH']=env['FTN_LIBPATH']
        env['FTN_SHLIBS']=env['FTN_LIBS']

        env['LINK_FORTRAN_TRAILER'] = '${_concat(LIBDIRPREFIX, FTN_LIBPATH, LIBDIRSUFFIX, __env__)} ' + \
                                      '${_stripixes(LIBLINKPREFIX, FTN_EXTRA_LIBS, LIBLINKSUFFIX, LIBPREFIX, LIBSUFFIX, __env__)}'
    mainpath = os.path.join(libpath,"fj90rt0.o")
    if (os.path.isfile(mainpath)):
        env['FTN_MAIN']=mainpath