mirror of
https://github.com/Kitware/CMake.git
synced 2026-05-07 22:59:56 -05:00
CUDA: More exhaustive checks to determine when to do device linking
Previously CMake used fairly naive logic to determine when to do device linking which caused unnecessary device linking to occur frequently. We now use a more exhaustive algorithm to determine when we have a need for device linking. Fixes: #19238
This commit is contained in:
@@ -2,7 +2,6 @@
|
||||
file Copyright.txt or https://cmake.org/licensing for details. */
|
||||
#include "cmMakefileExecutableTargetGenerator.h"
|
||||
|
||||
#include <algorithm>
|
||||
#include <memory> // IWYU pragma: keep
|
||||
#include <set>
|
||||
#include <sstream>
|
||||
@@ -87,20 +86,9 @@ void cmMakefileExecutableTargetGenerator::WriteDeviceExecutableRule(
|
||||
return;
|
||||
}
|
||||
|
||||
const std::string cuda_lang("CUDA");
|
||||
cmGeneratorTarget::LinkClosure const* closure =
|
||||
this->GeneratorTarget->GetLinkClosure(this->ConfigName);
|
||||
|
||||
const bool hasCUDA =
|
||||
(std::find(closure->Languages.begin(), closure->Languages.end(),
|
||||
cuda_lang) != closure->Languages.end());
|
||||
|
||||
bool doDeviceLinking = true;
|
||||
if (const char* resolveDeviceSymbols =
|
||||
this->GeneratorTarget->GetProperty("CUDA_RESOLVE_DEVICE_SYMBOLS")) {
|
||||
doDeviceLinking = cmSystemTools::IsOn(resolveDeviceSymbols);
|
||||
}
|
||||
if (!hasCUDA || !doDeviceLinking) {
|
||||
bool requiresDeviceLinking = requireDeviceLinking(
|
||||
*this->GeneratorTarget, *this->LocalGenerator, this->ConfigName);
|
||||
if (!requiresDeviceLinking) {
|
||||
return;
|
||||
}
|
||||
|
||||
|
||||
Reference in New Issue
Block a user