diff options
author | Brad King <brad.king@kitware.com> | 2020-06-15 13:25:11 (GMT) |
---|---|---|
committer | Kitware Robot <kwrobot@kitware.com> | 2020-06-15 13:25:29 (GMT) |
commit | 7fa5ea130b6f8b70d1c1ddef389ce9e47ac85b4b (patch) | |
tree | 966d34a004c446a70ed67e54573ad373ff160d2c /Source | |
parent | a3881d6313776aaf4c1d92b68c5064c9ac5cdcd3 (diff) | |
parent | ec59fb6c315f2797e72cab985110555c63ba65f8 (diff) | |
download | CMake-7fa5ea130b6f8b70d1c1ddef389ce9e47ac85b4b.zip CMake-7fa5ea130b6f8b70d1c1ddef389ce9e47ac85b4b.tar.gz CMake-7fa5ea130b6f8b70d1c1ddef389ce9e47ac85b4b.tar.bz2 |
Merge topic 'cuda_clang_toolkit_path' into release-3.18
ec59fb6c31 CUDA: Determine CUDA toolkit location for NVCC
0a056246a1 CUDA: Pass toolkit path to Clang
9c43972127 FindCUDAToolkit: Avoid unnecessary temporary variable computing binary dir
9eebb5b8b2 FindCUDAToolkit: Remove unnecessary checks around searches
8f01fe7bf1 FindCUDAToolkit: Use list(SORT) to sort in natural order
8c144fe9ad FindCUDAToolkit: Compute CUDAToolkit_INCLUDE_DIR instead of searching
403f8d31e3 FindCUDAToolkit: Add CUDAToolkit_LIBRARY_ROOT
6636693134 FindCUDAToolkit: Re-unify with Internal/CUDAToolkit
Acked-by: Kitware Robot <kwrobot@kitware.com>
Merge-request: !4828
Diffstat (limited to 'Source')
-rw-r--r-- | Source/cmGeneratorTarget.cxx | 23 | ||||
-rw-r--r-- | Source/cmGeneratorTarget.h | 1 | ||||
-rw-r--r-- | Source/cmLocalGenerator.cxx | 1 |
3 files changed, 25 insertions, 0 deletions
diff --git a/Source/cmGeneratorTarget.cxx b/Source/cmGeneratorTarget.cxx index 54d34ba..f2011ee 100644 --- a/Source/cmGeneratorTarget.cxx +++ b/Source/cmGeneratorTarget.cxx @@ -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, diff --git a/Source/cmGeneratorTarget.h b/Source/cmGeneratorTarget.h index a7201dc..3aedbf5 100644 --- a/Source/cmGeneratorTarget.h +++ b/Source/cmGeneratorTarget.h @@ -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, diff --git a/Source/cmLocalGenerator.cxx b/Source/cmLocalGenerator.cxx index fba9cdb..f748822 100644 --- a/Source/cmLocalGenerator.cxx +++ b/Source/cmLocalGenerator.cxx @@ -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"); |