mirror of
https://github.com/Kitware/CMake.git
synced 2026-04-24 07:08:38 -05:00
Merge topic 'cuda_clang_toolkit_path' into release-3.18
ec59fb6c31CUDA: Determine CUDA toolkit location for NVCC0a056246a1CUDA: Pass toolkit path to Clang9c43972127FindCUDAToolkit: Avoid unnecessary temporary variable computing binary dir9eebb5b8b2FindCUDAToolkit: Remove unnecessary checks around searches8f01fe7bf1FindCUDAToolkit: Use list(SORT) to sort in natural order8c144fe9adFindCUDAToolkit: Compute CUDAToolkit_INCLUDE_DIR instead of searching403f8d31e3FindCUDAToolkit: Add CUDAToolkit_LIBRARY_ROOT6636693134FindCUDAToolkit: Re-unify with Internal/CUDAToolkit Acked-by: Kitware Robot <kwrobot@kitware.com> Merge-request: !4828
This commit is contained in:
@@ -37,6 +37,7 @@
|
||||
#include "cmLocalGenerator.h"
|
||||
#include "cmMakefile.h"
|
||||
#include "cmMessageType.h"
|
||||
#include "cmOutputConverter.h"
|
||||
#include "cmPropertyMap.h"
|
||||
#include "cmRange.h"
|
||||
#include "cmSourceFile.h"
|
||||
@@ -3152,6 +3153,28 @@ void cmGeneratorTarget::AddCUDAArchitectureFlags(std::string& flags) const
|
||||
}
|
||||
}
|
||||
|
||||
void cmGeneratorTarget::AddCUDAToolkitFlags(std::string& flags) const
|
||||
{
|
||||
std::string const& compiler =
|
||||
this->Makefile->GetSafeDefinition("CMAKE_CUDA_COMPILER_ID");
|
||||
|
||||
if (compiler == "Clang") {
|
||||
// Pass CUDA toolkit explicitly to Clang.
|
||||
// Clang's searching for the system CUDA toolkit isn't very good and it's
|
||||
// expected the user will explicitly pass the toolkit path.
|
||||
// This also avoids Clang having to search for the toolkit on every
|
||||
// invocation.
|
||||
std::string toolkitRoot =
|
||||
this->Makefile->GetSafeDefinition("CMAKE_CUDA_COMPILER_LIBRARY_ROOT");
|
||||
|
||||
if (!toolkitRoot.empty()) {
|
||||
flags += " --cuda-path=" +
|
||||
this->LocalGenerator->ConvertToOutputFormat(toolkitRoot,
|
||||
cmOutputConverter::SHELL);
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
//----------------------------------------------------------------------------
|
||||
std::string cmGeneratorTarget::GetFeatureSpecificLinkRuleVariable(
|
||||
std::string const& var, std::string const& lang,
|
||||
|
||||
@@ -426,6 +426,7 @@ public:
|
||||
std::vector<std::string>& archVec) const;
|
||||
|
||||
void AddCUDAArchitectureFlags(std::string& flags) const;
|
||||
void AddCUDAToolkitFlags(std::string& flags) const;
|
||||
|
||||
std::string GetFeatureSpecificLinkRuleVariable(
|
||||
std::string const& var, std::string const& lang,
|
||||
|
||||
@@ -1986,6 +1986,7 @@ void cmLocalGenerator::AddLanguageFlags(std::string& flags,
|
||||
}
|
||||
} else if (lang == "CUDA") {
|
||||
target->AddCUDAArchitectureFlags(flags);
|
||||
target->AddCUDAToolkitFlags(flags);
|
||||
|
||||
std::string const& compiler =
|
||||
this->Makefile->GetSafeDefinition("CMAKE_CUDA_COMPILER_ID");
|
||||
|
||||
Reference in New Issue
Block a user