Skip to content

Commit

Permalink
[runtimes][NFC] Colocate handling of LLVM_ENABLE_PROJECTS and LLVM_EN…
Browse files Browse the repository at this point in the history
…ABLE_RUNTIMES

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.

Differential Revision: https://reviews.llvm.org/D132478
  • Loading branch information
ldionne committed Aug 24, 2022
1 parent 849ca46 commit a8cd939
Show file tree
Hide file tree
Showing 3 changed files with 17 additions and 13 deletions.
14 changes: 14 additions & 0 deletions llvm/CMakeLists.txt
Original file line number Diff line number Diff line change
Expand Up @@ -143,6 +143,20 @@ if ("flang" IN_LIST LLVM_ENABLE_PROJECTS)
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:
Expand Down
10 changes: 0 additions & 10 deletions llvm/runtimes/CMakeLists.txt
Original file line number Diff line number Diff line change
Expand Up @@ -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}")
Expand Down
6 changes: 3 additions & 3 deletions runtimes/CMakeLists.txt
Original file line number Diff line number Diff line change
Expand Up @@ -16,14 +16,14 @@ list(INSERT CMAKE_MODULE_PATH 0
# We order libraries to mirror roughly how they are layered, except that compiler-rt can depend
# on libc++, so we put it after.
set(LLVM_DEFAULT_RUNTIMES "libc;libunwind;libcxxabi;pstl;libcxx;compiler-rt;openmp")
set(LLVM_ALL_RUNTIMES "${LLVM_DEFAULT_RUNTIMES};llvm-libgcc")
set(LLVM_SUPPORTED_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, 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()
include(SortSubset)
sort_subset("${LLVM_ALL_RUNTIMES}" "${LLVM_ENABLE_RUNTIMES}" LLVM_ENABLE_RUNTIMES)
sort_subset("${LLVM_SUPPORTED_RUNTIMES}" "${LLVM_ENABLE_RUNTIMES}" LLVM_ENABLE_RUNTIMES)

foreach(proj ${LLVM_ENABLE_RUNTIMES})
set(proj_dir "${CMAKE_CURRENT_SOURCE_DIR}/../${proj}")
Expand Down

0 comments on commit a8cd939

Please sign in to comment.