Beispiel #1
0
def configure(ctx):
    atl.conf_lib(ctx,
                 tool, ["fftw3"],
                 "fftw_execute",
                 "fftw3.h",
                 defines="HAS_FFTW3",
                 install=installfftw3)
Beispiel #2
0
def configure(ctx):
    atl.conf_lib(
        ctx,
        tool, ["gsl", "gslcblas"],
        ["gsl_ran_gaussian", "gsl_blas_dgemm", "gsl_linalg_cholesky_invert"],
        ["gsl/gsl_randist.h", "gsl/gsl_blas.h", "gsl/gsl_linalg.h"],
        install=installgsl)
Beispiel #3
0
def configure(ctx):
    atl.conf_lib(ctx,
                 "cfitsio", ["cfitsio"],
                 "fits_init_cfitsio",
                 "fitsio.h",
                 msg="",
                 opt_name="cfitsio",
                 uselib=["cshlib"],
                 install=install_cfitsio)
Beispiel #4
0
def configure(ctx):
  ctx.env.has_pmc = False
  #pmc_config_path = ctx.find_program("pmc-config",path_list=[ctx.options.pmc_prefix+"/bin"])[0]
  try:
    pmc_config_path = ctx.find_program("pmc-config",path_list=[ctx.options.pmc_prefix+"/bin"])
    pmcflagline = ctx.cmd_and_log(pmc_config_path)
  except Exception as e:
    pmcflagline='' 
  atl.conf_lib(ctx,"pmc","pmc","init_distribution","pmc.h",["pmclib","pmctools"],defines=["HAS_PMC"],flagline=pmcflagline)
    
def configure(ctx):
    atl.conf_lib(ctx, tool, ["hdf5", "hdf5_hl"], "H5Fcreate",
                 "hdf5.h", defines="HAS_HDF5", install=installhdf5)
    try:
        kw = {}
        kw["fragment"] = '''#include "hdf5.h"
    #include <stdio.h> 
    int main() {
    herr_t res;
    unsigned int majnum,minnum,relnum;
    res = H5get_libversion(&majnum, &minnum, &relnum );
    if (res<0) return -1;
    printf("%d.%d.%d\\n",majnum,minnum,relnum);
    printf("%d\\n",H5Gopen == H5Gopen2);
    return 0;}'''
        kw["use"] = "hdf5"
        kw["execute"] = True
        kw['compiler'] = 'c'
        kw['define_ret'] = "HDF5_VERSION"
        ctx.validate_c(kw)
        ctx.start_msg('Checking for hdf5 version (>1.8)')
        ret = None
        try:
            ret = ctx.run_c_code(**kw)
        except ctx.errors.ConfigurationError as e:
            ctx.end_msg(kw['errmsg'], 'YELLOW')
            from waflib import Logs
            if Logs.verbose > 1:
                raise
            else:
                ctx.fatal('The configuration failed')
        else:
            rets = ret.split("\n")
            ret1 = rets[0]
            ret2 = rets[1]
            if int(ret1.split(".")[1]) != 8 or int(ret2) != 1:
                if int(ret1.split(".")[1]) != 8:
                    ret = ret1
                else:
                    ret = "using HDF 1.6 API"
                ctx.end_msg(ret, "YELLOW")
                raise Exception("Atrgl")
            else:
                ctx.end_msg(ret1)

    except Exception as e:
        print(e)
        atl.conf_lib(ctx, tool, ["hdf5", "hdf5_hl"], "H5Fcreate", "hdf5.h",
                     defines="HAS_HDF5", install=installhdf5, forceinstall=True)
Beispiel #6
0
def configure(ctx):
    # atl.conf_lib(ctx,"cfitsio",["cfitsio"],"fits_init_cfitsio","fitsio.h",msg="",opt_name="healpix",uselib=["cshlib"],install=install_cfitsio)
    ctx.env.th = False
    atl.conf_lib(
        ctx,
        "chealpix", ["chealpix", "m", "cfitsio"],
        "pix2vec_ring",
        "chealpix.h",
        msg="or check that the path also point toward your cfitsio install",
        opt_name="healpix",
        uselib=["cpic", "cfistio"],
        install=install_healpix)
    atl.conf_lib(
        ctx,
        "healpix_f90", ["healpix", "cfitsio"],
        "HEALPIX_TYPES",
        msg="or check that the path also point toward your cfitsio install",
        opt_name="healpix",
        add_lib_code="f90",
        uselib=["fpic", "cfistio"],
        install=install_healpix)
def configure(ctx):
  #always assume that I need a dedicated include file.
  
  if ctx.options.lapack_apple:
    ctx.start_msg("Check apple lapack")
    if sys.platform.lower()!="darwin":
      ctx.end_msg("not on darwin ! Got '%s'"%sys.platform,color="YELLOW")
      raise Errors.WafError("cannot find apple lapack")
    ctx.end_msg("ok")
    lapack_extradefs = ["HAS_LAPACK"]
    lapack_libs = ["BLAS","LAPACK"]
    lapack_includes = ["lapack_clik.h"]
    lapack_extradefs += ["LAPACK_CLIK"]
    ctx.options.lapack_include = osp.join(ctx.env.PREFIX,"include")
    ctx.options.lapack_lib = "/System/Library/Frameworks/Accelerate.framework/Versions/Current/Frameworks/vecLib.framework/Versions/Current"
    do_include(ctx,"%s_")

  elif ctx.options.lapack_mkl:
    # parse version
    ctx.start_msg("Check mkl version")
    if ctx.options.lapack_mkl_version.strip()[:4] not in ("10.0","10.1","10.2","10.3"):
      ctx.end_msg(ctx.options.lapack_mkl_version.strip(),color="YELLOW")
      raise Errors.WafError("Cannot understand mkl version '%s'"%ctx.options.lapack_mkl_version.strip())
    version = int(ctx.options.lapack_mkl_version.strip()[:4].split(".")[1])
    ctx.end_msg("10.%d"%version)
    lapack_extradefs = ["HAS_LAPACK"]
    lapack_extradefs += ["HAS_MKL"]
    lapack_includes = ["mkl_lapack.h","mkl_blas.h"]
    lapack_libs = []
    tag = sys.platform.lower()
    if tag=="darwin":
      pass
    elif "linux" in tag:
      tag="linux"
    else:
      raise Errors.WafError("unknown platform '%s'"%tag)
    tag+="_10.%d"%version
    mopt = ctx.env.mopt
    if "64" in mopt:
      tag+="_64"
    else:
      tag +="_32"

    if sys.platform.lower()!='darwin':
      #I need to create my own lapack ! 
      cmdline = """gcc -shared -Bdynamic  %(func_list)s  -Wl,--start-group %(ars)s  -Wl,--end-group %(Lomp)s %(omp)s -o "%(res)s" """
      cmdlist = {}
      cmdlist["func_list"] = " ".join(["-u %s_"%v for v in lapack_funcs.split()])
      cmdlist["ars"] = " ".join([osp.join(mkl_options[tag][0]%(ctx.options.lapack_mkl),"lib%s.a"%v.strip()) for v in mkl_options[tag][1].split("-l") if v.strip() and v.strip()[:3]=="mkl"])
      cmdlist["Lomp"] = " ".join("-L%s"%v.strip() for v in ctx.env.LIBPATH_fc_runtime if v.strip())
      cmdlist["omp"] = " ".join([v.strip() for v in mkl_options[tag][1].split() if v.strip() and "mkl" not in v])
      cmdlist["res"] = osp.join(ctx.env.LIBDIR,ctx.env.cshlib_PATTERN%"clik_mkl")
      cmdline = cmdline%cmdlist
      #print cmdline
      ctx.start_msg("create specific mkl lib")
      llgo,llge = ctx.cmd_and_log(cmdline, output=waflib.Context.BOTH)
      #print llgo
      #print llge
      ctx.end_msg(cmdlist["res"])
      ctx.options.lapack_link = "-lclik_mkl "+cmdlist["omp"]
      ctx.options.lapack_lib = ctx.env.LIBDIR+":".join([""]+ctx.env.LIBPATH_fc_runtime)
      ctx.options.lapack_include =  ctx.options.lapack_mkl+"/include"

    else:
      ctx.options.lapack_link = mkl_options[tag][1]
      ctx.options.lapack_lib = mkl_options[tag][0]%(ctx.options.lapack_mkl)+":".join([""]+ctx.env.LIBPATH_fc_runtime)
      if "framework" in ctx.options.lapack_mkl.lower():
        ctx.options.lapack_include =  ctx.options.lapack_mkl+"/Headers"
      else:
        ctx.options.lapack_include =  ctx.options.lapack_mkl+"/include"

    #try:
    #  atl.conf_lib(ctx,"lapack",lapack_libs,lapack_funcs.split(),lapack_includes,defines=lapack_extradefs,install=installlapack)
    #except Exception,e:
    #  pass

  #lapack_extradefs = ["HAS_LAPACK"]
  #lapack_libs = ["BLAS","LAPACK"]
  #lapack_includes = ["lapack.h","blas.h"]

  #if "mkl" in ctx.options.lapack_lib.lower() or "mkl" in ctx.options.lapack_include.lower() or "mkl" in ctx.options.lapack_link or ctx.options.lapack_mkl:
  #  ctx.env.mkl = True
  #  lapack_extradefs += ["HAS_MKL"]
  #  lapack_includes = ["mkl_lapack.h","mkl_blas.h"]
  #  if ctx.options.lapack_mkl:
  #    if ctx.env.has_ifort==False:
  #      raise Exception("cannot use MKL without ifort")
  #    if "framework" in ctx.options.lapack_mkl.lower():
  #      # guess we are on macosx
  #      # get the path of the framework
  #      if ctx.options.lapack_mkl[-1] == "/":
  #        fpath,fname = osp.split(ctx.options.lapack_mkl[:-1])
  #      else:
  #        fpath,fname = osp.split(ctx.options.lapack_mkl)
  #      fname = fname.split(".")[0]
  #      ctx.options.lapack_include =  ctx.options.lapack_mkl+"/Headers"
  #      ctx.options.lapack_lib =  ctx.options.lapack_mkl+"/Libraries/universal"
  #      if ctx.options.lapack_link=="":
  #        ctx.options.lapack_link = "-lmkl_intel_lp64 -lmkl_intel_thread -lmkl_core"
  #    else:
  #      # assume it's 10 on linux
  #      # check whether it's 10.3
  #      if ctx.options.m32:
  #        libsuffix="/lib/32"
  #        libdep = "-lmkl_intel"
  #      else:
  #        libsuffix="/lib/em64t"
  #        libdep = "-lmkl_intel_lp64"
  #      if ctx.options.lapack_link=="":
  #        ctx.options.lapack_link = "-lmkl_lapack -lmkl_intel_thread -lmkl_core -liomp5 -lm -lpthread -lmkl_def" + libdep
  #      if not ctx.options.m32 and osp.exists(ctx.options.lapack_mkl+"/lib/intel64"):
  #        libsuffix="/lib/intel64"
  #        ctx.options.lapack_link = "-lmkl_intel_thread -lmkl_core -liomp5 -lm -lpthread -lmkl_def" + libdep
  #      ctx.options.lapack_include=ctx.options.lapack_mkl+"/include"
  #      ctx.options.lapack_lib=ctx.options.lapack_mkl+libsuffix+":".join([""]+ctx.env.LIBPATH_fc_runtime)
  elif atl.upgrade(ctx,"lapack") or ctx.options.lapack_islocal or ctx.options.lapack_forceinstall or atl.shouldIinstall_all(ctx,"lapack"):
    ctx.env.append_value("LIBPATH_lapack",ctx.env.LIBPATH_fc_runtime)
    ctx.env.append_value("RPATH_lapack",ctx.env.RPATH_fc_runtime)
    ctx.env.append_value("LIB_lapack",ctx.env.LIB_fc_runtime)
    lapack_libs = ["lapack_clik","blas_clik"]
    lapack_includes = ["lapack_clik.h"]
    lapack_extradefs = ["HAS_LAPACK"]
    lapack_extradefs += ["LAPACK_CLIK"]
  else:
    lapack_libs = []
    lapack_includes = ["lapack_clik.h"]
    lapack_extradefs = ["HAS_LAPACK"]
    lapack_extradefs += ["LAPACK_CLIK"]
    do_include(ctx)

  atl.conf_lib(ctx,"lapack",lapack_libs,lapack_funcs.split(),lapack_includes,defines=lapack_extradefs,install=installlapack)
Beispiel #8
0
#try to support many flavours of lapack
import autoinstall_lib as atl
from waflib import Logs
import os.path as osp
    
def options(ctx):
  atl.add_lib_option("pmc",ctx,install=False)
  
def configure(ctx):
  ctx.env.has_pmc = False
  #pmc_config_path = ctx.find_program("pmc-config",path_list=[ctx.options.pmc_prefix+"/bin"])[0]
  try:
    pmc_config_path = ctx.find_program("pmc-config",path_list=[ctx.options.pmc_prefix+"/bin"])
    pmcflagline = ctx.cmd_and_log(pmc_config_path)
  except Exception,e:
    pmcflagline='' 
  atl.conf_lib(ctx,"pmc","pmc","init_distribution","pmc.h",["pmclib","pmctools"],defines=["HAS_PMC"],flagline=pmcflagline)
    
Beispiel #9
0
def configure(ctx):
  atl.conf_lib(ctx,"cfitsio",["cfitsio"],"fits_init_cfitsio","fitsio.h",msg="",opt_name="cfitsio",uselib=["cshlib"],install=install_cfitsio)
  ctx.env.th = False