================ @@ -0,0 +1,198 @@ +<!--===- README.md + + 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 + +--> + +# Fortran Runtime (flang-rt) + +Flang-rt is the runtime library for code emitted by the Flang compiler +(https://flang.llvm.org). + + +## Getting Started + +There are two build modes for the flang-rt. The bootstrap build, also +called the in-tree build, and the runtime-only build, also called the +out-of-tree build. +Not to be confused with the terms +[in-source and out-of-source](https://cmake.org/cmake/help/latest/manual/cmake.1.html#introduction-to-cmake-buildsystems) +builds as defined by CMake. In an in-source build, the source directory and the +build directory are identical, whereas with an out-of-source build the +build artifacts are stored somewhere else, possibly in a subdirectory of the +source directory. LLVM does not support in-source builds. + + +### Requirements + +Requirements: + * [Same as LLVM](https://llvm.org/docs/GettingStarted.html#requirements). + + +### Bootstrap/In-Tree Build + +The bootstrap build will first build Clang and Flang, then use these compilers +to compile flang-rt. CMake will create a secondary build tree in +configured with these just-built compilers. The secondary build will reuse the +same build options (Flags, Debug/Release, ...) as the primary build. It will +also ensure that once built, flang-rt is found by Flang from either +the build- or install-prefix. To enable, add `flang-rt` to +`LLVM_ENABLE_RUNTIMES`: + +```bash +cmake -S <path-to-llvm-project>/llvm \ + -DNinja \ + -DLLVM_ENABLE_PROJECTS=flang \ + -DLLVM_ENABLE_RUNTIMES=flang-rt \ + ... +``` + +It is recommended to enable building OpenMP alongside Flang and flang-rt +as well. This will build `omp_lib.mod` required to use OpenMP from Fortran. +Building Compiler-RT may also be required, particularly on platforms that do +not provide all C-ABI functionality (such as Windows). + +```bash +cmake -S <path-to-llvm-project>/llvm \ + -DNinja \ + -DCMAKE_BUILD_TYPE=Release \ + -DLLVM_ENABLE_PROJECTS="flang;openmp" \ + -DLLVM_ENABLE_RUNTIMES="compiler-rt;flang-rt" \ + ... +``` + +By default, the enabled runtimes will only be built for the host platform +(`-DLLVM_RUNTIME_TARGETS=default`). To add additional targets to support +cross-compilation via `flang-new --target=<target-triple>`, add more triples to ---------------- h-vetinari wrote:
```suggestion cross-compilation via `flang --target=<target-triple>`, add more triples to ``` https://github.com/llvm/llvm-project/pull/110217 _______________________________________________ llvm-branch-commits mailing list llvm-branch-commits@lists.llvm.org https://lists.llvm.org/cgi-bin/mailman/listinfo/llvm-branch-commits