diff options
author | Francisco Facioni <francisco.facioni@hawkeyeinnovations.com> | 2019-05-30 08:35:03 (GMT) |
---|---|---|
committer | Brad King <brad.king@kitware.com> | 2019-06-03 15:53:27 (GMT) |
commit | d91b5a72cd751b75fbce163fa7a3ea2f05bf484d (patch) | |
tree | 2067e7d2249a42402a974d390349dcd9bb258be1 /Source/cmNinjaNormalTargetGenerator.cxx | |
parent | 5efac09beda23c1fb188c660df39b1884f252f64 (diff) | |
download | CMake-d91b5a72cd751b75fbce163fa7a3ea2f05bf484d.zip CMake-d91b5a72cd751b75fbce163fa7a3ea2f05bf484d.tar.gz CMake-d91b5a72cd751b75fbce163fa7a3ea2f05bf484d.tar.bz2 |
Ninja: Add support for CUDA nvcc response files
Diffstat (limited to 'Source/cmNinjaNormalTargetGenerator.cxx')
-rw-r--r-- | Source/cmNinjaNormalTargetGenerator.cxx | 21 |
1 files changed, 15 insertions, 6 deletions
diff --git a/Source/cmNinjaNormalTargetGenerator.cxx b/Source/cmNinjaNormalTargetGenerator.cxx index 63af69e..7ad8ab3 100644 --- a/Source/cmNinjaNormalTargetGenerator.cxx +++ b/Source/cmNinjaNormalTargetGenerator.cxx @@ -182,11 +182,11 @@ void cmNinjaNormalTargetGenerator::WriteDeviceLinkRule(bool useResponseFile) if (flag) { responseFlag = flag; - } else { + } else if (this->TargetLinkLanguage != "CUDA") { responseFlag = "@"; } - if (!useResponseFile) { + if (!useResponseFile || responseFlag.empty()) { vars.Objects = "$in"; vars.LinkLibraries = "$LINK_PATH $LINK_LIBRARIES"; } else { @@ -300,11 +300,11 @@ void cmNinjaNormalTargetGenerator::WriteLinkRule(bool useResponseFile) if (flag) { responseFlag = flag; - } else { + } else if (this->TargetLinkLanguage != "CUDA") { responseFlag = "@"; } - if (!useResponseFile) { + if (!useResponseFile || responseFlag.empty()) { vars.Objects = "$in"; vars.LinkLibraries = "$LINK_PATH $LINK_LIBRARIES"; } else { @@ -713,7 +713,7 @@ void cmNinjaNormalTargetGenerator::WriteDeviceLinkStatement() bool usedResponseFile = false; globalGen->WriteBuild(this->GetBuildFileStream(), build, commandLineLengthLimit, &usedResponseFile); - this->WriteDeviceLinkRule(false); + this->WriteDeviceLinkRule(usedResponseFile); } void cmNinjaNormalTargetGenerator::WriteLinkStatement() @@ -1047,8 +1047,17 @@ void cmNinjaNormalTargetGenerator::WriteLinkStatement() symlinkVars["POST_BUILD"] = postBuildCmdLine; } + std::string cmakeVarLang = "CMAKE_"; + cmakeVarLang += this->TargetLinkLanguage; + + // build response file name + std::string cmakeLinkVar = cmakeVarLang + "_RESPONSE_FILE_LINK_FLAG"; + + const char* flag = GetMakefile()->GetDefinition(cmakeLinkVar); + bool const lang_supports_response = - !(this->TargetLinkLanguage == "RC" || this->TargetLinkLanguage == "CUDA"); + !(this->TargetLinkLanguage == "RC" || + (this->TargetLinkLanguage == "CUDA" && !flag)); int commandLineLengthLimit = -1; if (!lang_supports_response || !this->ForceResponseFile()) { commandLineLengthLimit = |