summaryrefslogtreecommitdiffstats
path: root/Source
diff options
context:
space:
mode:
authorBrad King <brad.king@kitware.com>2022-05-04 15:13:13 (GMT)
committerKitware Robot <kwrobot@kitware.com>2022-05-04 15:13:24 (GMT)
commit16e0ccd70f106b2bac93a66cea2f15218fa5998d (patch)
treea18013c4cb14e24ab5fe654ab694efc68960ccfd /Source
parent1784440bd0533912c68e93975c006c18b09f538b (diff)
parent149c952007595ca80b6b568a5509de35ba3e91ad (diff)
downloadCMake-16e0ccd70f106b2bac93a66cea2f15218fa5998d.zip
CMake-16e0ccd70f106b2bac93a66cea2f15218fa5998d.tar.gz
CMake-16e0ccd70f106b2bac93a66cea2f15218fa5998d.tar.bz2
Merge topic 'cuda-vs-use-LinkLineDeviceComputer'
149c952007 CUDA: Use cmLinkLineDeviceComputer in VS generator Acked-by: Kitware Robot <kwrobot@kitware.com> Merge-request: !7235
Diffstat (limited to 'Source')
-rw-r--r--Source/cmVisualStudio10TargetGenerator.cxx62
1 files changed, 7 insertions, 55 deletions
diff --git a/Source/cmVisualStudio10TargetGenerator.cxx b/Source/cmVisualStudio10TargetGenerator.cxx
index cf0cb17..1739b5a 100644
--- a/Source/cmVisualStudio10TargetGenerator.cxx
+++ b/Source/cmVisualStudio10TargetGenerator.cxx
@@ -3832,63 +3832,15 @@ bool cmVisualStudio10TargetGenerator::ComputeCudaLinkOptions(
return false;
}
- // Would like to use:
- // cmLinkLineDeviceComputer computer(this->LocalGenerator,
- // this->LocalGenerator->GetStateSnapshot().GetDirectory());
- // std::string computed_libs = computer.ComputeLinkLibraries(cli,
- // std::string{}); but it outputs in "<libA> <libB>" format instead of
- // "<libA>;<libB>"
- // Note:
- // Any modification of this algorithm should be reflected also in
- // cmLinkLineDeviceComputer
cmComputeLinkInformation& cli = *pcli;
+ cmLinkLineDeviceComputer computer(
+ this->LocalGenerator,
+ this->LocalGenerator->GetStateSnapshot().GetDirectory());
+ std::vector<BT<std::string>> btLibVec;
+ computer.ComputeLinkLibraries(cli, std::string{}, btLibVec);
std::vector<std::string> libVec;
- const auto& libs = cli.GetItems();
- for (cmComputeLinkInformation::Item const& l : libs) {
-
- if (l.Target) {
- auto managedType = l.Target->GetManagedType(configName);
- // Do not allow C# targets to be added to the LIB listing. LIB files
- // are used for linking C++ dependencies. C# libraries do not have lib
- // files. Instead, they compile down to C# reference libraries (DLL
- // files). The
- // `<ProjectReference>` elements added to the vcxproj are enough for
- // the IDE to deduce the DLL file required by other C# projects that
- // need its reference library.
- if (managedType == cmGeneratorTarget::ManagedType::Managed) {
- continue;
- }
- const auto type = l.Target->GetType();
-
- bool skip = false;
- switch (type) {
- case cmStateEnums::SHARED_LIBRARY:
- case cmStateEnums::MODULE_LIBRARY:
- case cmStateEnums::INTERFACE_LIBRARY:
- skip = true;
- break;
- case cmStateEnums::STATIC_LIBRARY:
- skip = l.Target->GetPropertyAsBool("CUDA_RESOLVE_DEVICE_SYMBOLS");
- break;
- default:
- break;
- }
- if (skip) {
- continue;
- }
- }
-
- if (l.IsPath == cmComputeLinkInformation::ItemIsPath::Yes) {
- std::string path =
- this->LocalGenerator->MaybeRelativeToCurBinDir(l.Value.Value);
- ConvertToWindowsSlash(path);
- if (!cmVS10IsTargetsFile(l.Value.Value)) {
- libVec.push_back(l.HasFeature() ? l.GetFormattedItem(path).Value
- : path);
- }
- } else {
- libVec.push_back(l.Value.Value);
- }
+ for (auto const& item : btLibVec) {
+ libVec.emplace_back(item.Value);
}
cudaLinkOptions.AddFlag("AdditionalDependencies", libVec);