mirror of
https://github.com/reactos/CMake.git
synced 2024-11-27 13:30:39 +00:00
Ninja: Add support for CUDA nvcc response files
This commit is contained in:
parent
5efac09bed
commit
d91b5a72cd
@ -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()
|
||||
|
@ -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 =
|
||||
|
@ -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;
|
||||
|
||||
|
Loading…
Reference in New Issue
Block a user