summaryrefslogtreecommitdiffstats
path: root/Source/cmLinkLineDeviceComputer.cxx
diff options
context:
space:
mode:
authorRobert Maynard <robert.maynard@kitware.com>2017-04-25 20:09:56 (GMT)
committerRobert Maynard <robert.maynard@kitware.com>2017-04-26 20:18:25 (GMT)
commit493671a5212c6548b2d7376c7065f5f76692a792 (patch)
treeb6e861120d50f15946603919b3637806a4e93596 /Source/cmLinkLineDeviceComputer.cxx
parent8fb85c68bb0090b44df22c27dabc03da63602e5e (diff)
downloadCMake-493671a5212c6548b2d7376c7065f5f76692a792.zip
CMake-493671a5212c6548b2d7376c7065f5f76692a792.tar.gz
CMake-493671a5212c6548b2d7376c7065f5f76692a792.tar.bz2
CUDA: Static libraries can now explicitly resolve device symbols
If a static library has the property CUDA_RESOLVE_DEVICE_SYMBOLS enabled it will now perform the device link step. The normal behavior is to delay calling device link until the static library is consumed by a shared library or an executable.
Diffstat (limited to 'Source/cmLinkLineDeviceComputer.cxx')
-rw-r--r--Source/cmLinkLineDeviceComputer.cxx21
1 files changed, 18 insertions, 3 deletions
diff --git a/Source/cmLinkLineDeviceComputer.cxx b/Source/cmLinkLineDeviceComputer.cxx
index 6789555..bf30b39 100644
--- a/Source/cmLinkLineDeviceComputer.cxx
+++ b/Source/cmLinkLineDeviceComputer.cxx
@@ -39,9 +39,24 @@ std::string cmLinkLineDeviceComputer::ComputeLinkLibraries(
continue;
}
- if (li->Target->GetType() == cmStateEnums::INTERFACE_LIBRARY ||
- li->Target->GetType() == cmStateEnums::SHARED_LIBRARY ||
- li->Target->GetType() == cmStateEnums::MODULE_LIBRARY) {
+ bool skippable = false;
+ switch (li->Target->GetType()) {
+ case cmStateEnums::SHARED_LIBRARY:
+ case cmStateEnums::MODULE_LIBRARY:
+ case cmStateEnums::INTERFACE_LIBRARY:
+ skippable = true;
+ break;
+ case cmStateEnums::STATIC_LIBRARY:
+ // If a static library is resolving its device linking, it should
+ // be removed for other device linking
+ skippable =
+ li->Target->GetPropertyAsBool("CUDA_RESOLVE_DEVICE_SYMBOLS");
+ break;
+ default:
+ break;
+ }
+
+ if (skippable) {
continue;
}