1
0
mirror of https://github.com/Kitware/CMake.git synced 2025-10-24 19:59:47 +08:00

cuda: Extend vs10 target generator to use custom cuda path

This commit is contained in:
Benjamin Wozniak
2019-08-21 15:30:46 +02:00
parent df0247a371
commit 55b0532128

View File

@@ -526,6 +526,13 @@ void cmVisualStudio10TargetGenerator::Generate()
} }
e1.Element("TargetFrameworkTargetsVersion", targetFrameworkVer); e1.Element("TargetFrameworkTargetsVersion", targetFrameworkVer);
} }
if (!this->GlobalGenerator->GetPlatformToolsetCudaCustomDirString()
.empty()) {
e1.Element(
"CudaToolkitCustomDir",
this->GlobalGenerator->GetPlatformToolsetCudaCustomDirString() +
"nvcc");
}
} }
// Disable the project upgrade prompt that is displayed the first time a // Disable the project upgrade prompt that is displayed the first time a
@@ -612,10 +619,17 @@ void cmVisualStudio10TargetGenerator::Generate()
e1.SetHasElements(); e1.SetHasElements();
if (this->GlobalGenerator->IsCudaEnabled()) { if (this->GlobalGenerator->IsCudaEnabled()) {
auto customDir =
this->GlobalGenerator->GetPlatformToolsetCudaCustomDirString();
std::string cudaPath = customDir.empty()
? "$(VCTargetsPath)\\BuildCustomizations\\"
: customDir +
"CUDAVisualStudioIntegration\\extras\\"
"visual_studio_integration\\MSBuildExtensions\\";
Elem(e1, "Import") Elem(e1, "Import")
.Attribute("Project", .Attribute("Project",
"$(VCTargetsPath)\\BuildCustomizations\\CUDA " + std::move(cudaPath) + "CUDA " +
this->GlobalGenerator->GetPlatformToolsetCudaString() + this->GlobalGenerator->GetPlatformToolsetCuda() +
".props"); ".props");
} }
if (this->GlobalGenerator->IsMasmEnabled()) { if (this->GlobalGenerator->IsMasmEnabled()) {
@@ -698,10 +712,17 @@ void cmVisualStudio10TargetGenerator::Generate()
e1.SetHasElements(); e1.SetHasElements();
this->WriteTargetsFileReferences(e1); this->WriteTargetsFileReferences(e1);
if (this->GlobalGenerator->IsCudaEnabled()) { if (this->GlobalGenerator->IsCudaEnabled()) {
auto customDir =
this->GlobalGenerator->GetPlatformToolsetCudaCustomDirString();
std::string cudaPath = customDir.empty()
? "$(VCTargetsPath)\\BuildCustomizations\\"
: customDir +
"CUDAVisualStudioIntegration\\extras\\"
"visual_studio_integration\\MSBuildExtensions\\";
Elem(e1, "Import") Elem(e1, "Import")
.Attribute("Project", .Attribute("Project",
"$(VCTargetsPath)\\BuildCustomizations\\CUDA " + std::move(cudaPath) + "CUDA " +
this->GlobalGenerator->GetPlatformToolsetCudaString() + this->GlobalGenerator->GetPlatformToolsetCuda() +
".targets"); ".targets");
} }
if (this->GlobalGenerator->IsMasmEnabled()) { if (this->GlobalGenerator->IsMasmEnabled()) {