Skip to content

Commit 9472538

Browse files
committed
Fix FortranFloat128Math include path
1 parent 3cf5f3f commit 9472538

File tree

2 files changed

+14
-0
lines changed

2 files changed

+14
-0
lines changed

flang-rt/README.md

Lines changed: 5 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -100,10 +100,15 @@ cmake -S <path-to-llvm-project>/runtimes \
100100
-GNinja \
101101
-DLLVM_BINARY_DIR=<path-to-llvm-builddir> \
102102
-DCMAKE_Fortran_COMPILER=<path-to-llvm-builddir>/bin/flang-new \
103+
-DCMAKE_Fortran_COMPILER_WORKS=yes \
103104
-DLLVM_ENABLE_RUNTIMES=flang-rt \
104105
...
105106
```
106107

108+
The `CMAKE_Fortran_COMPILER_WORKS` parameter must be set because otherwise CMake
109+
will test whether the Fortran compiler can compile and link programs which will
110+
obviously fail without a runtime library available yet.
111+
107112
Building flang-rt for cross-compilation triple, the target triple can
108113
be selected using `LLVM_DEFAULT_TARGET_TRIPLE` AND `LLVM_RUNTIMES_TARGET`.
109114
Of course, flang-rt can be built multiple times with different build

flang-rt/lib/FortranFloat128Math/CMakeLists.txt

Lines changed: 9 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -98,13 +98,19 @@ if (FLANG_RUNTIME_F128_MATH_LIB)
9898
add_flangrt_library(FortranFloat128Math STATIC INSTALL_WITH_TOOLCHAIN
9999
${sources})
100100
endif ()
101+
target_include_directories(FortranFloat128Math PRIVATE
102+
"${FLANGRT_SOURCE_DIR}/lib/flang_rt"
103+
)
101104
elseif (HAVE_LDBL_MANT_DIG_113)
102105
# We can use 'long double' versions from libc.
103106
check_library_exists(m sinl "" FOUND_LIBM)
104107
if (FOUND_LIBM)
105108
target_compile_definitions(FortranFloat128MathILib INTERFACE
106109
HAS_LIBM
107110
)
111+
target_include_directories(FortranFloat128MathILib INTERFACE
112+
"${FLANGRT_SOURCE_DIR}/lib/flang_rt"
113+
)
108114
target_sources(FortranFloat128MathILib INTERFACE ${sources})
109115
else()
110116
message(FATAL_ERROR "flang-rt cannot build without libm")
@@ -116,6 +122,9 @@ else()
116122
target_compile_definitions(FortranFloat128MathILib INTERFACE
117123
HAS_LIBMF128
118124
)
125+
target_include_directories(FortranFloat128MathILib INTERFACE
126+
"${FLANGRT_SOURCE_DIR}/lib/flang_rt"
127+
)
119128
# Enable this, when math-entries.h and complex-math.h is ready.
120129
# target_sources(FortranFloat128MathILib INTERFACE ${sources})
121130
endif()

0 commit comments

Comments
 (0)