コード例 #1
0
ファイル: nvcc-invoke.py プロジェクト: fifoforlifo/nstd
 def invoke():
     if "msvc" in hostCompiler:
         forceCompilerOption = nvcc_common.calc_msvc_options(hostCompiler)
     else:
         forceCompilerOption = ""
     cmd = "nvcc %s -optf \"%s\" > \"%s\" 2>&1" % (forceCompilerOption, rspPathEsc, 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)
コード例 #2
0
ファイル: nvcc-cxx-invoke.py プロジェクト: fifoforlifo/nstd
    def generate_deps():
        if "msvc" in hostCompiler:
            forceCompilerOption = nvcc_common.calc_msvc_options(hostCompiler)
        else:
            forceCompilerOption = ""
        tempDepPath = depPathEsc + ".tmp"
        cmd = "nvcc -M %s \"%s\" -optf \"%s\" -o \"%s\" > \"%s\" 2>&1" % (forceCompilerOption, srcPathEsc, rspPathEsc, tempDepPath, logPath)
        exitcode = os.system(cmd)

        if os.path.exists(depPath + ".tmp"):
            with open(tempDepPath, "rt") as tempDepFile:
                depLines = tempDepFile.readlines()
            os.unlink(tempDepPath)
            rhsIndex = depLines[0].find(' : ')
            depLines[0] = objPath + " : " + depLines[0][rhsIndex:]
            with open(depPath, "wt") as depFile:
                depFile.writelines(depLines)

        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)