[flang-commits] [flang] [flang] Added lowering and runtime for COMPLEX(16) intrinsics. (PR #83874)
via flang-commits
flang-commits at lists.llvm.org
Tue Mar 5 01:31:25 PST 2024
================
@@ -94,18 +66,62 @@ set(sources
)
include_directories(AFTER "${CMAKE_CURRENT_SOURCE_DIR}/..")
-add_flang_library(FortranFloat128Math STATIC INSTALL_WITH_TOOLCHAIN ${sources})
+add_library(FortranFloat128MathILib INTERFACE)
-if (DEFINED MSVC)
- set(CMAKE_MSVC_RUNTIME_LIBRARY MultiThreaded)
- add_flang_library(FortranFloat128Math.static STATIC INSTALL_WITH_TOOLCHAIN
- ${sources}
- )
- set(CMAKE_MSVC_RUNTIME_LIBRARY MultiThreadedDebug)
- add_flang_library(FortranFloat128Math.static_dbg STATIC INSTALL_WITH_TOOLCHAIN
- ${sources}
- )
- add_dependencies(FortranFloat128Math FortranFloat128Math.static
- FortranFloat128Math.static_dbg
- )
+if (FLANG_RUNTIME_F128_MATH_LIB)
+ if (${FLANG_RUNTIME_F128_MATH_LIB} STREQUAL "libquadmath")
+ check_include_file(quadmath.h FOUND_QUADMATH_HEADER)
+ if(FOUND_QUADMATH_HEADER)
+ add_compile_definitions(HAS_QUADMATHLIB)
+ else()
+ message(FATAL_ERROR
+ "FLANG_RUNTIME_F128_MATH_LIB setting requires quadmath.h "
+ "to be available: ${FLANG_RUNTIME_F128_MATH_LIB}"
+ )
+ endif()
+ else()
+ message(FATAL_ERROR
+ "Unsupported third-party library for Fortran F128 math runtime: "
+ "${FLANG_RUNTIME_F128_MATH_LIB}"
+ )
+ endif()
+
+ add_flang_library(FortranFloat128Math STATIC INSTALL_WITH_TOOLCHAIN
+ ${sources})
+
+ if (DEFINED MSVC)
+ set(CMAKE_MSVC_RUNTIME_LIBRARY MultiThreaded)
+ add_flang_library(FortranFloat128Math.static STATIC INSTALL_WITH_TOOLCHAIN
+ ${sources}
+ )
+ set(CMAKE_MSVC_RUNTIME_LIBRARY MultiThreadedDebug)
+ add_flang_library(FortranFloat128Math.static_dbg STATIC INSTALL_WITH_TOOLCHAIN
+ ${sources}
+ )
+ add_dependencies(FortranFloat128Math FortranFloat128Math.static
+ FortranFloat128Math.static_dbg
+ )
+ endif()
+elseif (HAVE_LDBL_MANT_DIG_113)
+ # We can use 'long double' versions from libc.
+ check_library_exists(m sinl "" FOUND_LIBM)
+ if (NOT FOUND_LIBM)
+ message(FATAL_ERROR "FortranRuntime cannot build without libm")
+ endif()
+ if (FOUND_LIBM)
----------------
jeanPerier wrote:
nit: in your cmake logic above, you usually do `if (FOUND_...) ... else() message(FATAL_ERROR ...) endif()`
https://github.com/llvm/llvm-project/pull/83874
More information about the flang-commits
mailing list