| 285 | }; |
| 286 | |
| 287 | void cmNinjaNormalTargetGenerator::WriteNvidiaDeviceLinkRule( |
| 288 | bool useResponseFile, std::string const& config) |
| 289 | { |
| 290 | cmNinjaRule rule(this->LanguageLinkerDeviceRule(config)); |
| 291 | if (!this->GetGlobalGenerator()->HasRule(rule.Name)) { |
| 292 | cmRulePlaceholderExpander::RuleVariables vars; |
| 293 | vars.CMTargetName = this->GetGeneratorTarget()->GetName().c_str(); |
| 294 | vars.CMTargetType = |
| 295 | cmState::GetTargetTypeName(this->GetGeneratorTarget()->GetType()) |
| 296 | .c_str(); |
| 297 | vars.Language = "CUDA"; |
| 298 | std::string linker = |
| 299 | this->GetGeneratorTarget()->GetLinkerTool("CUDA", config); |
| 300 | vars.Linker = linker.c_str(); |
| 301 | |
| 302 | // build response file name |
| 303 | std::string responseFlag = this->GetMakefile()->GetSafeDefinition( |
| 304 | "CMAKE_CUDA_RESPONSE_FILE_DEVICE_LINK_FLAG"); |
| 305 | |
| 306 | if (!useResponseFile || responseFlag.empty()) { |
| 307 | vars.Objects = "$in"; |
| 308 | vars.LinkLibraries = "$LINK_PATH $LINK_LIBRARIES"; |
| 309 | } else { |
| 310 | rule.RspFile = "$RSP_FILE"; |
| 311 | responseFlag += rule.RspFile; |
| 312 | |
| 313 | // build response file content |
| 314 | if (this->GetGlobalGenerator()->IsGCCOnWindows()) { |
| 315 | rule.RspContent = "$in"; |
| 316 | } else { |
| 317 | rule.RspContent = "$in_newline"; |
| 318 | } |
| 319 | |
| 320 | // add the link command in the file if necessary |
| 321 | if (this->CheckUseResponseFileForLibraries("CUDA")) { |
| 322 | rule.RspContent += " $LINK_LIBRARIES"; |
| 323 | vars.LinkLibraries = ""; |
| 324 | } else { |
| 325 | vars.LinkLibraries = "$LINK_PATH $LINK_LIBRARIES"; |
| 326 | } |
| 327 | |
| 328 | vars.Objects = responseFlag.c_str(); |
| 329 | } |
| 330 | |
| 331 | vars.ObjectDir = "$OBJECT_DIR"; |
| 332 | vars.TargetSupportDir = "$TARGET_SUPPORT_DIR"; |
| 333 | |
| 334 | vars.Target = "$TARGET_FILE"; |
| 335 | |
| 336 | vars.SONameFlag = "$SONAME_FLAG"; |
| 337 | vars.TargetSOName = "$SONAME"; |
| 338 | vars.TargetPDB = "$TARGET_PDB"; |
| 339 | vars.TargetCompilePDB = "$TARGET_COMPILE_PDB"; |
| 340 | |
| 341 | vars.Flags = "$FLAGS"; |
| 342 | vars.LinkFlags = "$LINK_FLAGS"; |
| 343 | vars.Manifests = "$MANIFESTS"; |
| 344 | vars.Config = "$CONFIG"; |
no test coverage detected