diff options
author | Robert Maynard <rmaynard@nvidia.com> | 2022-04-22 16:51:26 (GMT) |
---|---|---|
committer | Robert Maynard <rmaynard@nvidia.com> | 2022-07-22 14:34:45 (GMT) |
commit | 96bc59b1ca01be231347404d178445263687dd22 (patch) | |
tree | d9c015f30a1e43f0d5ded6dc75a638471f085ed6 /Source/cmLinkLineDeviceComputer.cxx | |
parent | 1527d48cd0071e3e1737b51db3738f7f76ddbf80 (diff) | |
download | CMake-96bc59b1ca01be231347404d178445263687dd22.zip CMake-96bc59b1ca01be231347404d178445263687dd22.tar.gz CMake-96bc59b1ca01be231347404d178445263687dd22.tar.bz2 |
CUDA: Add Device LTO support for nvcc
Fixes #22200
Diffstat (limited to 'Source/cmLinkLineDeviceComputer.cxx')
-rw-r--r-- | Source/cmLinkLineDeviceComputer.cxx | 20 |
1 files changed, 20 insertions, 0 deletions
diff --git a/Source/cmLinkLineDeviceComputer.cxx b/Source/cmLinkLineDeviceComputer.cxx index 719b834..b06dc3d 100644 --- a/Source/cmLinkLineDeviceComputer.cxx +++ b/Source/cmLinkLineDeviceComputer.cxx @@ -68,6 +68,26 @@ bool cmLinkLineDeviceComputer::ComputeRequiresDeviceLinking( }); } +bool cmLinkLineDeviceComputer::ComputeRequiresDeviceLinkingIPOFlag( + cmComputeLinkInformation& cli) +{ + // Determine if this item might requires device linking. + // For this we only consider targets + using ItemVector = cmComputeLinkInformation::ItemVector; + ItemVector const& items = cli.GetItems(); + std::string config = cli.GetConfig(); + return std::any_of( + items.begin(), items.end(), + [config](cmComputeLinkInformation::Item const& item) -> bool { + return item.Target && + item.Target->GetType() == cmStateEnums::STATIC_LIBRARY && + // this dependency requires us to device link it + !item.Target->GetPropertyAsBool("CUDA_RESOLVE_DEVICE_SYMBOLS") && + item.Target->GetPropertyAsBool("CUDA_SEPARABLE_COMPILATION") && + item.Target->IsIPOEnabled("CUDA", config); + }); +} + void cmLinkLineDeviceComputer::ComputeLinkLibraries( cmComputeLinkInformation& cli, std::string const& stdLibString, std::vector<BT<std::string>>& linkLibraries) |