Browse Source

VS: Drop workaround for CUDA compiler PDB location on CUDA 9.2+

The workaround added by commit v3.12.0-rc1~227^2 (VS: Add workaround for
CUDA compiler PDB location, 2018-04-13) is not necessary on CUDA 9.2+
because the CUDA Toolkit Visual Studio Integration has fixed the
original bug and forwards the `ProgramDataBaseFileName` to the host
compiler itself.  Make the workaround conditional on the CUDA version.

Issue: #18440
pull/324/head
Brad King 7 years ago
parent
commit
592064e026
  1. 18
      Source/cmVisualStudio10TargetGenerator.cxx

18
Source/cmVisualStudio10TargetGenerator.cxx

@ -2811,15 +2811,19 @@ bool cmVisualStudio10TargetGenerator::ComputeCudaOptions(
// Specify the compiler program database file if configured.
std::string pdb = this->GeneratorTarget->GetCompilePDBPath(configName);
if (!pdb.empty()) {
// CUDA does not have a field for this and does not honor the
// ProgramDataBaseFileName field in ClCompile. Work around this
// limitation by creating the directory and passing the flag ourselves.
// CUDA does not make the directory if it is non-standard.
std::string const pdbDir = cmSystemTools::GetFilenamePath(pdb);
cmSystemTools::MakeDirectory(pdbDir);
pdb = this->ConvertPath(pdb, true);
ConvertToWindowsSlash(pdb);
std::string const clFd = "-Xcompiler=\"-Fd\\\"" + pdb + "\\\"\"";
cudaOptions.AppendFlagString("AdditionalOptions", clFd);
if (cmSystemTools::VersionCompareGreaterEq(
"9.2", this->GlobalGenerator->GetPlatformToolsetCudaString())) {
// CUDA does not have a field for this and does not honor the
// ProgramDataBaseFileName field in ClCompile. Work around this
// limitation by creating the directory and passing the flag ourselves.
pdb = this->ConvertPath(pdb, true);
ConvertToWindowsSlash(pdb);
std::string const clFd = "-Xcompiler=\"-Fd\\\"" + pdb + "\\\"\"";
cudaOptions.AppendFlagString("AdditionalOptions", clFd);
}
}
// CUDA automatically passes the proper '--machine' flag to nvcc

Loading…
Cancel
Save