aboutsummaryrefslogtreecommitdiff
path: root/llvm/CMakeLists.txt
diff options
context:
space:
mode:
authorPaul Scoropan <1paulscoropan@gmail.com>2023-09-30 12:35:20 -0400
committerMark Danial <mark.danial@ibm.com>2023-09-30 12:35:33 -0400
commit6403287eff71a3d6f6c862346d6ed3f0f000eb70 (patch)
tree1801158643d4594bb486b8af230d6d2dd4f79e45 /llvm/CMakeLists.txt
parentd222c5ec47a09a3e120000e4a1006f4da7741256 (diff)
downloadllvm-6403287eff71a3d6f6c862346d6ed3f0f000eb70.zip
llvm-6403287eff71a3d6f6c862346d6ed3f0f000eb70.tar.gz
llvm-6403287eff71a3d6f6c862346d6ed3f0f000eb70.tar.bz2
[Flang] [FlangRT] Introduce FlangRT project as solution to Flang's runtime LLVM integration
See discourse thread https://discourse.llvm.org/t/rfc-support-cmake-option-to-control-link-type-built-for-flang-runtime-libraries/71602/18 for full details. Flang-rt is the new library target for the flang runtime libraries. It builds the Flang-rt library (which contains the sources of FortranRuntime and FortranDecimal) and the Fortran_main library. See documentation in this patch for detailed description (flang-rt/docs/GettingStarted.md). This patch aims to: - integrate Flang's runtime into existing llvm infrasturcture so that Flang's runtime can be built similarly to other runtimes via the runtimes target or via the llvm target as an enabled runtime - decouple the FortranDecimal library sources that were used by both compiler and runtime so that different build configurations can be applied for compiler vs runtime - add support for running flang-rt testsuites, which were created by migrating relevant tests from `flang/test` and `flang/unittest` to `flang-rt/test` and `flang-rt/unittest`, using a new `check-flang-rt` target. - provide documentation on how to build and use the new FlangRT runtime Reviewed By: DanielCChen Differential Revision: https://reviews.llvm.org/D154869
Diffstat (limited to 'llvm/CMakeLists.txt')
-rw-r--r--llvm/CMakeLists.txt10
1 files changed, 9 insertions, 1 deletions
diff --git a/llvm/CMakeLists.txt b/llvm/CMakeLists.txt
index 5985256..7b49ec1 100644
--- a/llvm/CMakeLists.txt
+++ b/llvm/CMakeLists.txt
@@ -149,7 +149,10 @@ endif()
# As we migrate runtimes to using the bootstrapping build, the set of default runtimes
# should grow as we remove those runtimes from LLVM_ENABLE_PROJECTS above.
set(LLVM_DEFAULT_RUNTIMES "libcxx;libcxxabi;libunwind")
-set(LLVM_SUPPORTED_RUNTIMES "libc;libunwind;libcxxabi;pstl;libcxx;compiler-rt;openmp;llvm-libgcc")
+if ("flang" IN_LIST LLVM_ENABLE_PROJECTS)
+ set(LLVM_DEFAULT_RUNTIMES "libcxx;libcxxabi;libunwind;flang-rt")
+endif()
+set(LLVM_SUPPORTED_RUNTIMES "libc;libunwind;libcxxabi;pstl;libcxx;compiler-rt;openmp;llvm-libgcc;flang-rt")
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")
@@ -171,6 +174,11 @@ if ("libc" IN_LIST LLVM_ENABLE_RUNTIMES)
endif()
endif()
+if ("flang" IN_LIST LLVM_ENABLE_PROJECTS AND NOT "flang-rt" IN_LIST LLVM_ENABLE_RUNTIMES)
+ message(STATUS "Enabling Flang-rt to be built with the Flang project.")
+ list(APPEND LLVM_ENABLE_RUNTIMES "flang-rt")
+endif()
+
# LLVM_ENABLE_PROJECTS_USED is `ON` if the user has ever used the
# `LLVM_ENABLE_PROJECTS` CMake cache variable. This exists for
# several reasons: