File tree Expand file tree Collapse file tree 8 files changed +30
-13
lines changed Expand file tree Collapse file tree 8 files changed +30
-13
lines changed Original file line number Diff line number Diff line change @@ -294,14 +294,14 @@ elseif (FLANG_RT_GCC_RESOURCE_DIR)
294
294
endif ()
295
295
296
296
# Check if 128-bit float computations can be done via long double.
297
- check_cxx_source_compiles (
298
- "#include <cfloat>
299
- #if LDBL_MANT_DIG != 113
300
- #error LDBL_MANT_DIG != 113
301
- #endif
302
- int main() { return 0; }
303
- "
304
- HAVE_LDBL_MANT_DIG_113 )
297
+ # check_cxx_source_compiles(
298
+ # "#include <cfloat>
299
+ # #if LDBL_MANT_DIG != 113
300
+ # #error LDBL_MANT_DIG != 113
301
+ # #endif
302
+ # int main() { return 0; }
303
+ # "
304
+ # HAVE_LDBL_MANT_DIG_113)
305
305
306
306
307
307
#####################
@@ -325,7 +325,9 @@ set(CMAKE_CXX_STANDARD_REQUIRED YES)
325
325
326
326
327
327
configure_file (cmake/config.h.cmake.in config.h )
328
-
328
+ if (FLANG_RT_INCLUDE_QUADMATH_H )
329
+ configure_file ("cmake/quadmath_wrapper.h.in" "${FLANG_RT_BINARY_DIR} /quadmath_wrapper.h" )
330
+ endif ()
329
331
330
332
# The bootstrap build will create a phony target with the same as the top-level
331
333
# directory ("flang-rt") and delegate it to the runtimes build dir.
Original file line number Diff line number Diff line change
1
+ int main () { return 0 ; }
Original file line number Diff line number Diff line change
1
+ /*===-- cmake/quadmath_wrapper.h.in ---------------------=-----------*- C -*-===
2
+ *
3
+ * Part of the LLVM Project, under the Apache License v2.0 with LLVM Exceptions.
4
+ * See https://llvm.org/LICENSE.txt for license information.
5
+ * SPDX-License-Identifier: Apache-2.0 WITH LLVM-exception
6
+ *
7
+ *===----------------------------------------------------------------------===*/
8
+
9
+ #include $ {FLANG_RT_INCLUDE_QUADMATH_H }
Original file line number Diff line number Diff line change @@ -78,8 +78,7 @@ target_include_directories(FortranFloat128MathILib INTERFACE
78
78
79
79
if (FLANG_RUNTIME_F128_MATH_LIB )
80
80
if (${FLANG_RUNTIME_F128_MATH_LIB} STREQUAL "libquadmath" )
81
- check_include_file (quadmath.h FOUND_QUADMATH_HEADER )
82
- if (FOUND_QUADMATH_HEADER )
81
+ if (FLANG_RT_INCLUDE_QUADMATH_H )
83
82
add_compile_definitions (HAS_QUADMATHLIB )
84
83
else ()
85
84
message (FATAL_ERROR
Original file line number Diff line number Diff line change 13
13
#include "flang/Runtime/entry-names.h"
14
14
15
15
#if HAS_QUADMATHLIB
16
- #include "quadmath .h"
16
+ #include "quadmath_wrapper .h"
17
17
#define CAbs (x ) cabsq(x)
18
18
#define CAcos (x ) cacosq(x)
19
19
#define CAcosh (x ) cacoshq(x)
Original file line number Diff line number Diff line change @@ -112,7 +112,7 @@ DEFINE_FALLBACK_F128(Yn)
112
112
113
113
#if HAS_QUADMATHLIB
114
114
// Define wrapper callers for libquadmath.
115
- #include " quadmath .h"
115
+ #include " quadmath_wrapper .h"
116
116
DEFINE_SIMPLE_ALIAS (Abs, fabsq)
117
117
DEFINE_SIMPLE_ALIAS(Acos, acosq)
118
118
DEFINE_SIMPLE_ALIAS(Acosh, acoshq)
Original file line number Diff line number Diff line change @@ -132,6 +132,12 @@ elseif (CMAKE_CXX_COMPILER_ID MATCHES "XL")
132
132
set (NO_RTTI_FLAGS "-qnoeh -qnortti" )
133
133
endif ()
134
134
135
+ # When compiling LLVM_ENABLE_RUNTIMES=flang-rt, the build system looks for the
136
+ # full path of quadmath.h. In this non-runtimes build, preserve the old behavior
137
+ # of just including <quadmath.h>.
138
+ set (FLANG_RT_INCLUDE_QUADMATH_H "<quadmath.h>" )
139
+ configure_file ("${FLANG_RT_SOURCE_DIR} /cmake/quadmath_wrapper.h.in" "quadmath_wrapper.h" )
140
+
135
141
configure_file ("${FLANG_RT_SOURCE_DIR} /cmake/config.h.cmake.in" config.h )
136
142
# include_directories is used here instead of target_include_directories
137
143
# because add_flang_library creates multiple objects (STATIC/SHARED, OBJECT)
You can’t perform that action at this time.
0 commit comments