[PATCH] D68833: [CMake] Re-order runtimes in the order of dependencies
Petr Hosek via Phabricator via llvm-commits
llvm-commits at lists.llvm.org
Thu Oct 10 19:49:38 PDT 2019
phosek updated this revision to Diff 224533.
phosek added a reviewer: smeenai.
Repository:
rG LLVM Github Monorepo
CHANGES SINCE LAST ACTION
https://reviews.llvm.org/D68833/new/
https://reviews.llvm.org/D68833
Files:
llvm/runtimes/CMakeLists.txt
Index: llvm/runtimes/CMakeLists.txt
===================================================================
--- llvm/runtimes/CMakeLists.txt
+++ llvm/runtimes/CMakeLists.txt
@@ -38,10 +38,10 @@
set(LLVM_EXTERNAL_${canon_name}_SOURCE_DIR "${CMAKE_CURRENT_SOURCE_DIR}/../../${proj}")
endforeach()
-function(get_compiler_rt_path path)
+function(get_runtime_path runtime path)
foreach(entry ${runtimes})
get_filename_component(projName ${entry} NAME)
- if("${projName}" MATCHES "compiler-rt")
+ if("${projName}" MATCHES "${runtime}")
set(${path} ${entry} PARENT_SCOPE)
return()
endif()
@@ -68,18 +68,6 @@
"${CMAKE_CURRENT_SOURCE_DIR}/../cmake/modules"
)
- # Some of the runtimes will conditionally use the compiler-rt sanitizers
- # to make this work smoothly we ensure that compiler-rt is added first in
- # the list of sub-projects. This allows other sub-projects to have checks
- # like `if(TARGET asan)` to enable building with asan.
- get_compiler_rt_path(compiler_rt_path)
- if(compiler_rt_path)
- list(REMOVE_ITEM runtimes ${compiler_rt_path})
- if(NOT DEFINED LLVM_BUILD_COMPILER_RT OR LLVM_BUILD_COMPILER_RT)
- list(INSERT runtimes 0 ${compiler_rt_path})
- endif()
- endif()
-
# Setting these variables will allow the sub-build to put their outputs into
# the library and bin directories of the top-level build.
set(LLVM_LIBRARY_OUTPUT_INTDIR ${LLVM_LIBRARY_DIR})
@@ -122,6 +110,17 @@
include(UseLibtool)
endif()
+ # Re-order runtimes in the order of dependencies: libcxxabi depend on libunwind,
+ # libcxx depends on libcxxabi, some compiler-rt runtimes depend on libcxx. This
+ # allows these runtimes to have checks like `if(TARGET ${runtime})`.
+ foreach(runtime compiler-rt libcxx libcxxabi libunwind)
+ get_runtime_path(${runtime} runtime_path)
+ if(runtime_path)
+ list(REMOVE_ITEM runtimes ${runtime_path})
+ list(INSERT runtimes 0 ${runtime_path})
+ endif()
+ endforeach()
+
# This can be used to detect whether we're in the runtimes build.
set(RUNTIMES_BUILD ON)
@@ -291,7 +290,7 @@
# If compiler-rt is present we need to build the builtin libraries first. This
# is required because the other runtimes need the builtin libraries present
# before the just-built compiler can pass the configuration tests.
- get_compiler_rt_path(compiler_rt_path)
+ get_runtime_path(compiler-rt compiler_rt_path)
if(compiler_rt_path)
if(NOT LLVM_BUILTIN_TARGETS)
builtin_default_target(${compiler_rt_path}
-------------- next part --------------
A non-text attachment was scrubbed...
Name: D68833.224533.patch
Type: text/x-patch
Size: 2546 bytes
Desc: not available
URL: <http://lists.llvm.org/pipermail/llvm-commits/attachments/20191011/e4c2cd47/attachment.bin>
More information about the llvm-commits
mailing list