Esempio n. 1
0
def setup(ctx):
    env = ctx.env

    env.update({
        "F77": ["ifort"],
        "F77_LINK": ["ifort"],
        "F77_LINKFLAGS": [],
        "F77FLAGS": [],
        "F77_TGT_F": ["-o"],
        "F77_SRC_F": ["-c"],
        "F77_LINK_TGT_F": ["-o"],
        "F77_LINK_SRC_F": [],
        "F77_OBJECT_FMT": "%s.o",
        "F77_PROGRAM_FMT": "%s"
    })
    if sys.platform == "win32":
        env.update({
            "F77FLAGS": ["/nologo"],
            "F77_TGT_F": ["/object:"],
            "F77_SRC_F": ["/c"],
            "F77_LINKFLAGS": ["/nologo"],
            "F77_LINK_TGT_F": ["/link", "/out:"],
            "F77_OBJECT_FMT": "%s.obj",
            "F77_PROGRAM_FMT": "%s.exe"
        })

        abi = "amd64"

        availables = find_versions_fc(abi)
        if len(availables) < 1:
            raise ValueError("No ifort version found for abi %s" % abi)

        versions = sorted(availables.keys())[::-1]
        pdir = product_dir_fc(availables[versions[0]])
        batfile = os.path.join(pdir, "bin", "ifortvars.bat")

        d = get_output(ctx, batfile, _ABI2BATABI[abi])
        for k, v in d.items():
            if k in ["LIB"]:
                ctx.env.extend("LIBDIR", v, create=True)
            elif k in ["INCLUDE"]:
                ctx.env.extend("CPPPATH", v, create=True)
        for p in d["PATH"]:
            exe = os.path.join(p, "ifort.exe")
            if os.path.exists(exe):
                env["F77"] = [exe]
                env["F77_LINK"] = [exe]
                break
Esempio n. 2
0
def setup(ctx):
    env = ctx.env

    env.update(
       {"F77": ["ifort"],
        "F77_LINK": ["ifort"],
        "F77_LINKFLAGS": [],
        "F77FLAGS": [],
        "F77_TGT_F": ["-o"],
        "F77_SRC_F": ["-c"],
        "F77_LINK_TGT_F": ["-o"],
        "F77_LINK_SRC_F": [],
        "F77_OBJECT_FMT": "%s.o",
        "F77_PROGRAM_FMT": "%s"})
    if sys.platform == "win32":
        env.update(
           {"F77FLAGS": ["/nologo"],
            "F77_TGT_F": ["/object:"],
            "F77_SRC_F": ["/c"],
            "F77_LINKFLAGS": ["/nologo"],
            "F77_LINK_TGT_F": ["/link", "/out:"],
            "F77_OBJECT_FMT": "%s.obj",
            "F77_PROGRAM_FMT": "%s.exe"})

        abi = "amd64"

        availables = find_versions_fc(abi)
        if len(availables) < 1:
            raise ValueError("No ifort version found for abi %s" % abi)

        versions = sorted(availables.keys())[::-1]
        pdir = product_dir_fc(availables[versions[0]])
        batfile = os.path.join(pdir, "bin", "ifortvars.bat")

        d = get_output(ctx, batfile, _ABI2BATABI[abi])
        for k, v in d.items():
            if k in ["LIB"]:
                ctx.env.extend("LIBDIR", v, create=True)
            elif k in ["INCLUDE"]:
                ctx.env.extend("CPPPATH", v, create=True)
        for p in d["PATH"]:
            exe = os.path.join(p, "ifort.exe")
            if os.path.exists(exe):
                env["F77"] = [exe]
                env["F77_LINK"] = [exe]
                break
Esempio n. 3
0
def _detect_msvc(ctx):
    from string import digits as string_digits

    msvc_version_info = (9, 0)
    msvc_version = "9.0"
    pdir = find_vc_pdir(msvc_version)
    if pdir is None:
        raise ValueError("VS 9.0 not found")

    # filter out e.g. "Exp" from the version name
    msvc_ver_numeric = ''.join(
        [x for x in msvc_version if x in string_digits + "."])
    vernum = float(msvc_ver_numeric)
    if 7 <= vernum < 8:
        pdir = os.path.join(pdir, os.pardir, "Common7", "Tools")
        batfilename = os.path.join(pdir, "vsvars32.bat")
    elif vernum < 7:
        pdir = os.path.join(pdir, "Bin")
        batfilename = os.path.join(pdir, "vcvars32.bat")
    else:  # >= 8
        batfilename = os.path.join(pdir, "vcvarsall.bat")

    vc_paths = get_output(ctx, batfilename, "x86")
    cc = None
    linker = None
    lib = None
    for p in vc_paths["PATH"]:
        _cc = os.path.join(p, "cl.exe")
        _linker = os.path.join(p, "link.exe")
        _lib = os.path.join(p, "lib.exe")
        if os.path.exists(_cc) and os.path.exists(_linker) and os.path.exists(
                _lib):
            cc = _cc
            linker = _linker
            lib = _lib
            break
    if cc is None or linker is None:
        raise RuntimeError("Could not find cl.exe/link.exe")

    return cc, linker, lib, vc_paths, msvc_version_info
Esempio n. 4
0
File: msvc.py Progetto: dagss/yaku
def _detect_msvc(ctx):
    from string import digits as string_digits

    msvc_version_info = (9, 0)
    msvc_version = "9.0"
    pdir = find_vc_pdir(msvc_version)
    if pdir is None:
        raise ValueError("VS 9.0 not found")

    # filter out e.g. "Exp" from the version name
    msvc_ver_numeric = ''.join([x for x in msvc_version if x in string_digits + "."])
    vernum = float(msvc_ver_numeric)
    if 7 <= vernum < 8:
        pdir = os.path.join(pdir, os.pardir, "Common7", "Tools")
        batfilename = os.path.join(pdir, "vsvars32.bat")
    elif vernum < 7:
        pdir = os.path.join(pdir, "Bin")
        batfilename = os.path.join(pdir, "vcvars32.bat")
    else: # >= 8
        batfilename = os.path.join(pdir, "vcvarsall.bat")

    vc_paths = get_output(ctx, batfilename, "x86")
    cc = None
    linker = None
    lib = None
    for p in vc_paths["PATH"]:
        _cc = os.path.join(p, "cl.exe")
        _linker = os.path.join(p, "link.exe")
        _lib = os.path.join(p, "lib.exe")
        if os.path.exists(_cc) and os.path.exists(_linker) and os.path.exists(_lib):
            cc = _cc
            linker = _linker
            lib = _lib
            break
    if cc is None or linker is None:
        raise RuntimeError("Could not find cl.exe/link.exe")

    return cc, linker, lib, vc_paths, msvc_version_info