| 187 | } |
| 188 | |
| 189 | bool requireDeviceLinking(cmGeneratorTarget& target, cmLocalGenerator& lg, |
| 190 | std::string const& config) |
| 191 | { |
| 192 | if (!target.GetGlobalGenerator()->GetLanguageEnabled("CUDA")) { |
| 193 | return false; |
| 194 | } |
| 195 | |
| 196 | if (target.GetType() == cmStateEnums::OBJECT_LIBRARY) { |
| 197 | return false; |
| 198 | } |
| 199 | |
| 200 | if (!lg.GetMakefile()->IsOn("CMAKE_CUDA_COMPILER_HAS_DEVICE_LINK_PHASE")) { |
| 201 | return false; |
| 202 | } |
| 203 | |
| 204 | if (cmValue resolveDeviceSymbols = |
| 205 | target.GetProperty("CUDA_RESOLVE_DEVICE_SYMBOLS")) { |
| 206 | // If CUDA_RESOLVE_DEVICE_SYMBOLS has been explicitly set we need |
| 207 | // to honor the value no matter what it is. |
| 208 | return resolveDeviceSymbols.IsOn(); |
| 209 | } |
| 210 | |
| 211 | // Determine if we have any dependencies that require |
| 212 | // us to do a device link step |
| 213 | cmGeneratorTarget::LinkClosure const* closure = |
| 214 | target.GetLinkClosure(config); |
| 215 | |
| 216 | if (cm::contains(closure->Languages, "CUDA")) { |
| 217 | if (target.GetProperty("CUDA_SEPARABLE_COMPILATION").IsOn()) { |
| 218 | bool doDeviceLinking = false; |
| 219 | switch (target.GetType()) { |
| 220 | case cmStateEnums::SHARED_LIBRARY: |
| 221 | case cmStateEnums::MODULE_LIBRARY: |
| 222 | case cmStateEnums::EXECUTABLE: |
| 223 | doDeviceLinking = true; |
| 224 | break; |
| 225 | default: |
| 226 | break; |
| 227 | } |
| 228 | return doDeviceLinking; |
| 229 | } |
| 230 | |
| 231 | cmComputeLinkInformation* pcli = target.GetLinkInformation(config); |
| 232 | if (pcli) { |
| 233 | cmLinkLineDeviceComputer deviceLinkComputer( |
| 234 | &lg, lg.GetStateSnapshot().GetDirectory()); |
| 235 | return deviceLinkComputer.ComputeRequiresDeviceLinking(*pcli); |
| 236 | } |
| 237 | return true; |
| 238 | } |
| 239 | return false; |
| 240 | } |
no test coverage detected
searching dependent graphs…