[PATCH] D158791: [runtimes] Add a mechanism to use cache files for a runtimes build

Shoaib Meenai via Phabricator via llvm-commits llvm-commits at lists.llvm.org
Thu Aug 24 16:14:42 PDT 2023


smeenai created this revision.
smeenai added reviewers: phosek, ldionne.
Herald added a project: All.
smeenai requested review of this revision.
Herald added a project: LLVM.
Herald added a subscriber: llvm-commits.

Projects like libc++ include their own cache files, and it's convenient
to just be able to reuse those cache files as part of a runtimes build
instead of having to duplicate the settings inside a special runtimes
cache file (which will inevitably get out of sync).

I'm not completely happy about overloading the existing argument passing
behavior based on the argument name, but I also couldn't think of a good
alternative. Suggestions are welcome.


Repository:
  rG LLVM Github Monorepo

https://reviews.llvm.org/D158791

Files:
  llvm/runtimes/CMakeLists.txt


Index: llvm/runtimes/CMakeLists.txt
===================================================================
--- llvm/runtimes/CMakeLists.txt
+++ llvm/runtimes/CMakeLists.txt
@@ -105,8 +105,14 @@
     string(FIND "${variable_name}" "BUILTINS_${name}" out)
     if("${out}" EQUAL 0)
       string(REPLACE "BUILTINS_${name}_" "" new_name ${variable_name})
-      string(REPLACE ";" "|" new_value "${${variable_name}}")
-      list(APPEND ${name}_extra_args "-D${new_name}=${new_value}")
+      if(new_name STREQUAL CMAKE_CACHES)
+        foreach(cache IN LISTS ${variable_name})
+          list(APPEND ${name}_extra_args -C ${cache})
+        endforeach()
+      else()
+        string(REPLACE ";" "|" new_value "${${variable_name}}")
+        list(APPEND ${name}_extra_args "-D${new_name}=${new_value}")
+      endif()
     endif()
   endforeach()
 
@@ -326,8 +332,14 @@
       string(FIND "${variable_name}" "RUNTIMES_${extra_name}_" out)
       if("${out}" EQUAL 0)
         string(REPLACE "RUNTIMES_${extra_name}_" "" new_name ${variable_name})
-        string(REPLACE ";" "|" new_value "${${variable_name}}")
-        list(APPEND ${name}_extra_args "-D${new_name}=${new_value}")
+        if(new_name STREQUAL CMAKE_CACHES)
+          foreach(cache IN LISTS ${variable_name})
+            list(APPEND ${name}_extra_args -C ${cache})
+          endforeach()
+        else()
+          string(REPLACE ";" "|" new_value "${${variable_name}}")
+          list(APPEND ${name}_extra_args "-D${new_name}=${new_value}")
+        endif()
       endif()
     endforeach()
   endforeach()


-------------- next part --------------
A non-text attachment was scrubbed...
Name: D158791.553296.patch
Type: text/x-patch
Size: 1575 bytes
Desc: not available
URL: <http://lists.llvm.org/pipermail/llvm-commits/attachments/20230824/da58b1f4/attachment.bin>


More information about the llvm-commits mailing list