Bläddra i källkod

Ninja: Do not use nvcc response files with non-nvcc tools

Since commit d91b5a72cd (Ninja: Add support for CUDA nvcc response
files, 2019-05-30, v3.15.0-rc1~8^2) we use NVCC's `--options-file`
option to avoid long link command lines via a response file.  However,
for non-device linking the host tools are used and the option does not
make sense.  Update the logic to use `--options-file` only for device
linking.  Linking with the host tools already has its own logic for
response files.

Fixes: #19954
Francisco Facioni 5 år sedan
förälder
incheckning
738f3f23aa
2 ändrade filer med 3 tillägg och 3 borttagningar
  1. 1 1
      Modules/Compiler/NVIDIA-CUDA.cmake
  2. 2 2
      Source/cmNinjaNormalTargetGenerator.cxx

+ 1 - 1
Modules/Compiler/NVIDIA-CUDA.cmake

@@ -42,6 +42,6 @@ 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_DEVICE_LINK_FLAG "--options-file ")
   set(CMAKE_CUDA_RESPONSE_FILE_FLAG "--options-file ")
 endif()

+ 2 - 2
Source/cmNinjaNormalTargetGenerator.cxx

@@ -174,7 +174,7 @@ void cmNinjaNormalTargetGenerator::WriteDeviceLinkRule(bool useResponseFile)
 
     // build response file name
     std::string responseFlag = this->GetMakefile()->GetSafeDefinition(
-      "CMAKE_CUDA_RESPONSE_FILE_LINK_FLAG");
+      "CMAKE_CUDA_RESPONSE_FILE_DEVICE_LINK_FLAG");
 
     if (!useResponseFile || responseFlag.empty()) {
       vars.Objects = "$in";
@@ -290,7 +290,7 @@ void cmNinjaNormalTargetGenerator::WriteLinkRule(bool useResponseFile)
 
     if (flag) {
       responseFlag = flag;
-    } else if (this->TargetLinkLanguage != "CUDA") {
+    } else {
       responseFlag = "@";
     }