[llvm] [runtimes] Fix not correctly searching target builtins directories (PR #103311)

Joseph Huber via llvm-commits llvm-commits at lists.llvm.org
Tue Aug 13 09:58:02 PDT 2024


https://github.com/jhuber6 created https://github.com/llvm/llvm-project/pull/103311

Summary:
Enabling `compiler-rt` only worked previously if we had it in the
default target. This is because we didn't extract the path carefully.
This patch fixes that by getting the correct path and appending it,
instead of just the project name.


>From 979bd9915dc627c3bd5a99a75901a7b5af395bd7 Mon Sep 17 00:00:00 2001
From: Joseph Huber <huberjn at outlook.com>
Date: Tue, 13 Aug 2024 11:55:42 -0500
Subject: [PATCH] [runtimes] Fix not correctly searching target builtins
 directories

Summary:
Enabling `compiler-rt` only worked previously if we had it in the
default target. This is because we didn't extract the path carefully.
This patch fixes that by getting the correct path and appending it,
instead of just the project name.
---
 llvm/runtimes/CMakeLists.txt | 7 ++++++-
 1 file changed, 6 insertions(+), 1 deletion(-)

diff --git a/llvm/runtimes/CMakeLists.txt b/llvm/runtimes/CMakeLists.txt
index 5a4435bc96e0c8..187c44fb9d04d2 100644
--- a/llvm/runtimes/CMakeLists.txt
+++ b/llvm/runtimes/CMakeLists.txt
@@ -19,7 +19,12 @@ endforeach()
 function(get_compiler_rt_path path)
   set(all_runtimes ${runtimes})
   foreach(name ${LLVM_RUNTIME_TARGETS})
-    list(APPEND all_runtimes ${RUNTIMES_${name}_LLVM_ENABLE_RUNTIMES})
+    foreach(proj ${RUNTIMES_${name}_LLVM_ENABLE_RUNTIMES})
+      set(proj_dir "${CMAKE_CURRENT_SOURCE_DIR}/../../${proj}")
+      if(IS_DIRECTORY ${proj_dir} AND EXISTS ${proj_dir}/CMakeLists.txt)
+        list(APPEND all_runtimes ${proj_dir})
+      endif()
+    endforeach()
   endforeach()
   list(REMOVE_DUPLICATES all_runtimes)
   foreach(entry ${all_runtimes})



More information about the llvm-commits mailing list