
Extract Flang's runtime library to use the LLVM_ENABLE_RUNTIME mechanism. It will only become active when `LLVM_ENABLE_RUNTIMES=flang-rt` is used, which also changes the `FLANG_INCLUDE_RUNTIME` to `OFF` so the old runtime build rules do not conflict. This also means that unless `LLVM_ENABLE_RUNTIMES=flang-rt` is passed, nothing changes with the current build process. Motivation: * Consistency with LLVM's other runtime libraries (compiler-rt, libc, libcxx, openmp offload, ...) * Allows compiling the runtime for multiple targets at once using the LLVM_RUNTIME_TARGETS configuration options * Installs the runtime into the compiler's per-target resource directory so it can be automatically found even when cross-compiling Also see RFC discussion at https://discourse.llvm.org/t/rfc-use-llvm-enable-runtimes-for-flangs-runtime/80826
44 lines
1.6 KiB
CMake
44 lines
1.6 KiB
CMake
#===-- cmake/modules/FlangCommon.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
|
|
#
|
|
#===------------------------------------------------------------------------===#
|
|
#
|
|
# CMake definitions shared between Flang and Flang-RT
|
|
#
|
|
#===------------------------------------------------------------------------===#
|
|
|
|
# The out of tree builds of the compiler and the Fortran runtime
|
|
# must use the same setting of FLANG_RUNTIME_F128_MATH_LIB
|
|
# to be composable. Failure to synchronize this setting may result
|
|
# in linking errors or fatal failures in F128 runtime functions.
|
|
set(FLANG_RUNTIME_F128_MATH_LIB "" CACHE STRING
|
|
"Specifies the target library used for implementing IEEE-754 128-bit float \
|
|
math in F18 runtime, e.g. it might be libquadmath for targets where \
|
|
REAL(16) is mapped to __float128, or libm for targets where REAL(16) \
|
|
is mapped to long double, etc."
|
|
)
|
|
if (FLANG_RUNTIME_F128_MATH_LIB)
|
|
add_compile_definitions(FLANG_RUNTIME_F128_MATH_LIB="${FLANG_RUNTIME_F128_MATH_LIB}")
|
|
endif()
|
|
|
|
# Check if 128-bit float computations can be done via long double
|
|
check_cxx_source_compiles(
|
|
"#include <cfloat>
|
|
#if LDBL_MANT_DIG != 113
|
|
#error LDBL_MANT_DIG != 113
|
|
#endif
|
|
int main() { return 0; }
|
|
"
|
|
HAVE_LDBL_MANT_DIG_113)
|
|
|
|
include(TestBigEndian)
|
|
test_big_endian(IS_BIGENDIAN)
|
|
if (IS_BIGENDIAN)
|
|
add_compile_definitions(FLANG_BIG_ENDIAN=1)
|
|
else ()
|
|
add_compile_definitions(FLANG_LITTLE_ENDIAN=1)
|
|
endif ()
|