[PATCH] D132478: [runtimes][NFC] Colocate handling of LLVM_ENABLE_PROJECTS and LLVM_ENABLE_RUNTIMES

Louis Dionne via Phabricator via llvm-commits llvm-commits at lists.llvm.org
Tue Aug 23 08:33:52 PDT 2022


ldionne created this revision.
ldionne added a reviewer: phosek.
Herald added a subscriber: mgorny.
Herald added a project: All.
ldionne requested review of this revision.
Herald added a reviewer: jdoerfert.
Herald added subscribers: llvm-commits, libcxx-commits, sstefan1.
Herald added projects: libc++, libc++abi, LLVM.
Herald added a reviewer: libc++.
Herald added a reviewer: libc++abi.

This will make the following patches to migrate projects off of the
LLVM_ENABLE_PROJECTS build onto the LLVM_ENABLE_RUNTIMES build much
easier to comprehend. This patch should be a NFC since it keeps the
same set of runtimes being built by default.


Repository:
  rG LLVM Github Monorepo

https://reviews.llvm.org/D132478

Files:
  llvm/CMakeLists.txt
  llvm/runtimes/CMakeLists.txt
  runtimes/CMakeLists.txt


Index: runtimes/CMakeLists.txt
===================================================================
--- runtimes/CMakeLists.txt
+++ runtimes/CMakeLists.txt
@@ -18,7 +18,7 @@
 set(LLVM_DEFAULT_RUNTIMES "libc;libunwind;libcxxabi;pstl;libcxx;compiler-rt;openmp")
 set(LLVM_ALL_RUNTIMES "${LLVM_DEFAULT_RUNTIMES};llvm-libgcc")
 set(LLVM_ENABLE_RUNTIMES "" CACHE STRING
-  "Semicolon-separated list of runtimes to build (${LLVM_ALL_RUNTIMES}), or \"all\".")
+  "Semicolon-separated list of runtimes to build (by default ${LLVM_DEFAULT_RUNTIMES}), or \"all\" (${LLVM_ALL_RUNTIMES}).")
 if(LLVM_ENABLE_RUNTIMES STREQUAL "all" )
   set(LLVM_ENABLE_RUNTIMES ${LLVM_DEFAULT_RUNTIMES})
 endif()
Index: llvm/runtimes/CMakeLists.txt
===================================================================
--- llvm/runtimes/CMakeLists.txt
+++ llvm/runtimes/CMakeLists.txt
@@ -3,16 +3,6 @@
 # similar although simpler functionality. We should figure out how to merge
 # the two files.
 
-# TODO: Selecting runtimes should be always performed inside the runtimes
-# build, see runtimes/CMakeLists.txt, except that we currently check whether
-# compiler-rt is being built to determine whether to first build builtins
-# or not so we need that information in this file as well.
-set(LLVM_ALL_RUNTIMES "compiler-rt;libc;libcxx;libcxxabi;libunwind;openmp")
-set(LLVM_ENABLE_RUNTIMES "" CACHE STRING
-  "Semicolon-separated list of runtimes to build (${LLVM_ALL_RUNTIMES}), or \"all\".")
-if(LLVM_ENABLE_RUNTIMES STREQUAL "all" )
-  set(LLVM_ENABLE_RUNTIMES ${LLVM_ALL_RUNTIMES})
-endif()
 set(COMMON_CMAKE_ARGS "-DHAVE_LLVM_LIT=ON")
 foreach(proj ${LLVM_ENABLE_RUNTIMES})
   set(proj_dir "${CMAKE_CURRENT_SOURCE_DIR}/../../${proj}")
Index: llvm/CMakeLists.txt
===================================================================
--- llvm/CMakeLists.txt
+++ llvm/CMakeLists.txt
@@ -143,6 +143,20 @@
   endif()
 endif()
 
+# Select the runtimes to build
+set(LLVM_DEFAULT_RUNTIMES "compiler-rt;libc;libcxx;libcxxabi;libunwind;openmp")
+set(LLVM_SUPPORTED_RUNTIMES "libc;libunwind;libcxxabi;pstl;libcxx;compiler-rt;openmp;llvm-libgcc")
+set(LLVM_ENABLE_RUNTIMES "" CACHE STRING
+  "Semicolon-separated list of runtimes to build, or \"all\" (${LLVM_DEFAULT_RUNTIMES}). Supported runtimes are ${LLVM_SUPPORTED_RUNTIMES}.")
+if(LLVM_ENABLE_RUNTIMES STREQUAL "all")
+  set(LLVM_ENABLE_RUNTIMES ${LLVM_DEFAULT_RUNTIMES})
+endif()
+foreach(proj IN LISTS LLVM_ENABLE_RUNTIMES)
+  if (NOT "${proj}" IN_LIST LLVM_SUPPORTED_RUNTIMES)
+    message(FATAL_ERROR "Runtime ${proj} is not a supported runtime. Supported runtimes are: ${LLVM_SUPPORTED_RUNTIMES}")
+  endif()
+endforeach()
+
 # LLVM_ENABLE_PROJECTS_USED is `ON` if the user has ever used the
 # `LLVM_ENABLE_PROJECTS` CMake cache variable.  This exists for
 # several reasons:


-------------- next part --------------
A non-text attachment was scrubbed...
Name: D132478.454851.patch
Type: text/x-patch
Size: 2797 bytes
Desc: not available
URL: <http://lists.llvm.org/pipermail/llvm-commits/attachments/20220823/5e4e5314/attachment.bin>


More information about the llvm-commits mailing list