[llvm] bdd3748 - [runtimes] Add a mechanism to use cache files for a runtimes build

Shoaib Meenai via llvm-commits llvm-commits at lists.llvm.org
Mon Sep 18 12:19:48 PDT 2023


Author: Shoaib Meenai
Date: 2023-09-18T12:18:40-07:00
New Revision: bdd3748ac833180a41e42f5db6397834ebfda9f3

URL: https://github.com/llvm/llvm-project/commit/bdd3748ac833180a41e42f5db6397834ebfda9f3
DIFF: https://github.com/llvm/llvm-project/commit/bdd3748ac833180a41e42f5db6397834ebfda9f3.diff

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

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.

Reviewed By: phosek

Differential Revision: https://reviews.llvm.org/D158791

Added: 
    

Modified: 
    llvm/runtimes/CMakeLists.txt

Removed: 
    


################################################################################
diff  --git a/llvm/runtimes/CMakeLists.txt b/llvm/runtimes/CMakeLists.txt
index 6db943c91790207..7ec6480773c8f05 100644
--- a/llvm/runtimes/CMakeLists.txt
+++ b/llvm/runtimes/CMakeLists.txt
@@ -105,8 +105,14 @@ function(builtin_register_target compiler_rt_path name)
     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 CACHE_FILES)
+        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 @@ function(runtime_register_target name)
       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 CACHE_FILES)
+          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()


        


More information about the llvm-commits mailing list