示例#1
0
def set_nvcc_environment(installDir, hostCompiler, hostInstallDir, addressModel):
    oldPathEnv = os.environ.get('PATH') or ""
    if os.name == 'nt':
        os.environ['PATH'] = "%s\\bin%s%s" % (installDir, os.pathsep, oldPathEnv)
    else:
        os.environ['PATH'] = "%s/bin%s%s" % (installDir, os.pathsep, oldPathEnv)

    if "gcc" in hostCompiler:
        import gcc_common
        gcc_common.set_gcc_environment(hostInstallDir)
    else:
        import msvc_common
        arch = "x86" if addressModel == "-m32" else "amd64"
        msvc_common.set_msvc_environment(hostInstallDir, arch)
示例#2
0
        return (arch1 == "amd64" or arch2 == "amd64")


    def shell_escape_path(path):
        return path.replace(" ", "\\ ")


    def create_lib():
        cmd = "lib \"@%s\" > \"%s\" 2>&1 " % (rspPath, logPath)
        exitcode = os.system(cmd)
        with open(logPath, "rt") as logFile:
            logContents = logFile.read()
        if re.search("(warning)|(error)", logContents, re.MULTILINE):
            print("%s" % logContents)
        if exitcode:
            sys.exit(exitcode)


    if os.name != 'nt':
        raise Exception("msvc is only usable on Windows")
    if not (arch == "x86" or arch == "amd64"):
        raise Exception("invalid architecture: " + arch)

    os.chdir(workingDir)

    msvc_common.set_msvc_environment(installDir, arch)

    create_lib()

    sys.exit(0)