[libclc] [libclc] Use a response file when building on Windows (PR #89756)

Fraser Cormack via cfe-commits cfe-commits at lists.llvm.org
Tue Apr 23 06:27:18 PDT 2024


================
@@ -88,10 +88,25 @@ function(link_bc)
     ${ARGN}
   )
 
+  set( LINK_INPUT_ARG ${ARG_INPUTS} )
+  if( WIN32 OR CYGWIN )
+    # Create a response file in case the number of inputs exceeds command-line
+    # character limits on certain platforms.
+    file( TO_CMAKE_PATH ${LIBCLC_ARCH_OBJFILE_DIR}/${ARG_TARGET}.rsp RSP_FILE )
+    # Turn it into a space-separate list of input files
+    list( JOIN ARG_INPUTS " " RSP_INPUT )
+    file( WRITE ${RSP_FILE} ${RSP_INPUT} )
+    # Ensure that if this file is removed, we re-run CMake
+    set_property( DIRECTORY APPEND PROPERTY CMAKE_CONFIGURE_DEPENDS
+      ${RSP_FILE}
+    )
----------------
frasercrmck wrote:

Interesting, thank you for pointing that out.

I just tried something inspired by that (looking at https://github.com/ROCm/ROCm-Device-Libs/blob/amd-stg-open/cmake/OCL.cmake#L129) but when I deleted the configured `.rsp` file it wouldn't know how to rebuild it. It did reconfigure and rebuild when I deleted the `.rsp.in` file. It might be I've done something wrong, but though I like your suggestion I might stick with this one as I've verified it can handle being deleted.

https://github.com/llvm/llvm-project/pull/89756


More information about the cfe-commits mailing list