Skip to content

[Flang] Remove FLANG_INCLUDE_RUNTIME #124126

New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Merged
Prev Previous commit
Next Next commit
Implicitly enable Flang-RT
  • Loading branch information
Meinersbur committed Feb 21, 2025
commit 2bf7d33978d965a68ed8697108e566a13fbb6340
7 changes: 6 additions & 1 deletion flang-rt/README.md
Original file line number Diff line number Diff line change
Expand Up @@ -91,7 +91,12 @@ can be any compiler supporting the same ABI.
In addition to the compiler, the build be able to find LLVM development tools
such as `lit` and `FileCheck` that are not found in an LLVM's install
directory. Use `CMAKE_BINARY_DIR` to point to directory where LLVM has
been built. A simple build configuration might look like the following:
been built. When building Flang as part of a bootstrapping build
(`LLVM_ENABLE_PROJECTS=flang`), Flang-RT has already been automatically added
unless configured with `-DFLANG_ENABLE_FLANG_RT=OFF`. Add that option to avoid
having two conflicting versions of the same library.

A simple build configuration might look like the following:

```bash
cmake -S <path-to-llvm-project-source>/runtimes \
Expand Down
13 changes: 13 additions & 0 deletions llvm/CMakeLists.txt
Original file line number Diff line number Diff line change
Expand Up @@ -187,6 +187,19 @@ foreach(proj IN LISTS LLVM_ENABLE_RUNTIMES)
endif()
endforeach()

option(FLANG_ENABLE_FLANG_RT "Implicitly add LLVM_ENABLE_RUNTIMES=flang-rt when compiling Flang" ON)
if ("flang" IN_LIST LLVM_ENABLE_PROJECTS)
if (NOT "flang-rt" IN_LIST LLVM_ENABLE_RUNTIMES)
message(STATUS "Enabling Flang-RT as a dependency of Flang"
"Flang-RT is required for a fully working Flang toolchain."
"If you intend to compile Flang-RT separately following the instructions at"
"https://github.com/llvm/llvm-project/blob/main/flang-rt/README.md#standalone-runtimes-build"
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Directly linking to a github readme is a little weird. Do we not have a documentation page for this?

Copy link
Member Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

There is no flang-rt.llvm.org . I do find several links to github.com in llvm/docs, such as

`README <https://github.com/llvm/llvm-project/blob/main/llvm/utils/TableGen/README.md>`_.

Copy link
Contributor

@jhuber6 jhuber6 Mar 14, 2025

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

There's https://flang.llvm.org/docs/ right? it's not a blocking issue, I just feel like build configs are better shared through CMake config files or actual documentation.

Copy link
Member Author

@Meinersbur Meinersbur Mar 17, 2025

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Is it ok to update the docs in a follow-up? Consolidating this README.md and https://flang.llvm.org/docs/GettingStarted.html#building-flang itself would be a larger patch. Also think that advanced topics like FLANG_RT_EXPERIMENTAL_OFFLOAD_SUPPORT does not belong into a GettingStarted.

Copy link
Member Author

@Meinersbur Meinersbur Mar 17, 2025

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I moved the help message(...) to flang/ so a message is also emitted in a flang-standalone build (which is does not process LLVM_ENABLE_RUNTIMES at all). I also shortened it without the README link, may update it after consolidation.

"you should use -DFLANG_ENABLE_FLANG_RT=OFF to not build Flang-RT as part of this build."
)
list(APPEND LLVM_ENABLE_RUNTIMES "flang-rt")
endif()
endif ()

# Set a shorthand option to enable the GPU build of the 'libc' project.
option(LIBC_GPU_BUILD "Enable the 'libc' project targeting the GPU" OFF)
if(LIBC_GPU_BUILD)
Expand Down