[llvm-branch-commits] [clang] [flang] [lld] [llvm] [Flang] LLVM_ENABLE_RUNTIMES=flang-rt (PR #110217)
Joseph Huber via llvm-branch-commits
llvm-branch-commits at lists.llvm.org
Thu Nov 7 08:09:57 PST 2024
================
@@ -0,0 +1,165 @@
+#===-- CMakeLists.txt ------------------------------------------------------===#
+#
+# Part of the LLVM Project, under the Apache License v2.0 with LLVM Exceptions.
+# See https://llvm.org/LICENSE.txt for license information.
+# SPDX-License-Identifier: Apache-2.0 WITH LLVM-exception
+#
+#===------------------------------------------------------------------------===#
+#
+# Build instructions for the flang-rt library. This is file is intended to be
+# included using the LLVM_ENABLE_RUNTIMES mechanism.
+#
+#===------------------------------------------------------------------------===#
+
+set(LLVM_SUBPROJECT_TITLE "Fortran Runtime")
+set(FLANGRT_SOURCE_DIR "${CMAKE_CURRENT_SOURCE_DIR}")
+set(FLANGRT_BINARY_DIR "${CMAKE_CURRENT_BINARY_DIR}")
+set(FLANG_SOURCE_DIR "${CMAKE_CURRENT_SOURCE_DIR}/../flang")
+
+enable_language(Fortran)
+
+list(APPEND CMAKE_MODULE_PATH
+ "${FLANGRT_SOURCE_DIR}/cmake/modules"
+ "${FLANG_SOURCE_DIR}/cmake/modules"
+ )
+include(AddFlangRT)
+include(FlangCommon)
+
+
+############################
+# Build Mode Introspection #
+############################
+
+# Setting these variables from an LLVM build is sufficient that flang-rt can
+# construct the output paths, so it can behave as if it were in-tree here.
+set(LLVM_TREE_AVAILABLE OFF)
+if (LLVM_LIBRARY_OUTPUT_INTDIR AND LLVM_RUNTIME_OUTPUT_INTDIR AND PACKAGE_VERSION)
+ # This is a bootstap build
+ set(LLVM_TREE_AVAILABLE ON)
+endif()
+
+if (LLVM_TREE_AVAILABLE)
+ # Despite Clang in the name, get_clang_resource_dir does not depend on Clang being added to the build
+ # flang-new uses the same resource dir as clang.
+ include(GetClangResourceDir)
+ get_clang_resource_dir(FLANGRT_BUILD_LIB_DIR PREFIX "${LLVM_LIBRARY_OUTPUT_INTDIR}/.." SUBDIR "lib${LLVM_LIBDIR_SUFFIX}")
+ get_clang_resource_dir(FLANGRT_INSTALL_LIB_DIR SUBDIR "lib${LLVM_LIBDIR_SUFFIX}") # No prefix, CMake's install command find the install prefix itself
+else ()
+ set(FLANGRT_BUILD_LIB_DIR "${LLVM_LIBRARY_OUTPUT_INTDIR}")
+ set(FLANGRT_INSTALL_LIB_DIR "lib${LLVM_LIBDIR_SUFFIX}")
+endif ()
+
+if (DEFINED WIN32)
+ set(FLANGRT_BUILD_LIB_DIR "${FLANGRT_BUILD_LIB_DIR}/windows")
----------------
jhuber6 wrote:
I meant `COMPILER_RT`, thanks. I'd say it's best to be consistent here and use `FLANG_RT` everywhere.
https://github.com/llvm/llvm-project/pull/110217
More information about the llvm-branch-commits
mailing list