summaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
-rw-r--r--Modules/Compiler/NVIDIA-CUDA.cmake5
-rw-r--r--Source/cmNinjaNormalTargetGenerator.cxx21
-rw-r--r--Source/cmNinjaTargetGenerator.cxx14
3 files changed, 31 insertions, 9 deletions
diff --git a/Modules/Compiler/NVIDIA-CUDA.cmake b/Modules/Compiler/NVIDIA-CUDA.cmake
index de9dd99..c0ccb71 100644
--- a/Modules/Compiler/NVIDIA-CUDA.cmake
+++ b/Modules/Compiler/NVIDIA-CUDA.cmake
@@ -40,3 +40,8 @@ endif()
set(CMAKE_CUDA_USE_RESPONSE_FILE_FOR_INCLUDES 0)
set(CMAKE_CUDA_USE_RESPONSE_FILE_FOR_LIBRARIES 0)
set(CMAKE_CUDA_USE_RESPONSE_FILE_FOR_OBJECTS 0)
+
+if (CMAKE_CUDA_COMPILER_VERSION VERSION_GREATER_EQUAL "9.0")
+ set(CMAKE_CUDA_RESPONSE_FILE_LINK_FLAG "--options-file ")
+ set(CMAKE_CUDA_RESPONSE_FILE_FLAG "--options-file ")
+endif()
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 =
diff --git a/Source/cmNinjaTargetGenerator.cxx b/Source/cmNinjaTargetGenerator.cxx
index 4c93cf1..2139a45 100644
--- a/Source/cmNinjaTargetGenerator.cxx
+++ b/Source/cmNinjaTargetGenerator.cxx
@@ -465,12 +465,12 @@ void cmNinjaTargetGenerator::WriteCompileRule(const std::string& lang)
std::string flags = "$FLAGS";
std::string responseFlag;
- bool const lang_supports_response = !(lang == "RC" || lang == "CUDA");
+ bool const lang_supports_response = lang != "RC";
if (lang_supports_response && this->ForceResponseFile()) {
std::string const responseFlagVar =
"CMAKE_" + lang + "_RESPONSE_FILE_FLAG";
responseFlag = this->Makefile->GetSafeDefinition(responseFlagVar);
- if (responseFlag.empty()) {
+ if (responseFlag.empty() && lang != "CUDA") {
responseFlag = "@";
}
}
@@ -944,8 +944,16 @@ void cmNinjaTargetGenerator::WriteObjectBuildStatement(
std::string const objectFileDir =
cmSystemTools::GetFilenamePath(objectFileName);
+ std::string cmakeVarLang = "CMAKE_";
+ cmakeVarLang += language;
+
+ // build response file name
+ std::string cmakeLinkVar = cmakeVarLang + "_RESPONSE_FILE_FLAG";
+
+ const char* flag = GetMakefile()->GetDefinition(cmakeLinkVar);
+
bool const lang_supports_response =
- !(language == "RC" || language == "CUDA");
+ !(language == "RC" || (language == "CUDA" && !flag));
int const commandLineLengthLimit =
((lang_supports_response && this->ForceResponseFile())) ? -1 : 0;