Skip to content

Commit 96d1bae

Browse files
authored
[Flang] Remove FLANG_INCLUDE_RUNTIME (#124126)
Remove the FLANG_INCLUDE_RUNTIME option which was replaced by LLVM_ENABLE_RUNTIMES=flang-rt. The FLANG_INCLUDE_RUNTIME option was added in #122336 which disables the non-runtimes build instructions for the Flang runtime so they do not conflict with the LLVM_ENABLE_RUNTIMES=flang-rt option added in #110217. In order to not maintain multiple build instructions for the same thing, this PR completely removes the old build instructions (effectively forcing FLANG_INCLUDE_RUNTIME=OFF). As per discussion in https://discourse.llvm.org/t/buildbot-changes-with-llvm-enable-runtimes-flang-rt/83571/2 we now implicitly add LLVM_ENABLE_RUNTIMES=flang-rt whenever Flang is compiled in a bootstrapping (non-standalone) build. Because it is possible to build Flang-RT separately, this behavior can be disabled using `-DFLANG_ENABLE_FLANG_RT=OFF`. Also see the discussion an implicitly adding runtimes/projects in #123964.
1 parent 4cabee3 commit 96d1bae

File tree

17 files changed

+19
-902
lines changed

17 files changed

+19
-902
lines changed

flang-rt/README.md

+6-1
Original file line numberDiff line numberDiff line change
@@ -91,7 +91,12 @@ can be any compiler supporting the same ABI.
9191
In addition to the compiler, the build must be able to find LLVM development
9292
tools such as `lit` and `FileCheck` that are not found in an LLVM's install
9393
directory. Use `CMAKE_BINARY_DIR` to point to directory where LLVM has
94-
been built. A simple build configuration might look like the following:
94+
been built. When building Flang as part of a bootstrapping build
95+
(`LLVM_ENABLE_PROJECTS=flang`), Flang-RT is automatically added
96+
unless configured with `-DFLANG_ENABLE_FLANG_RT=OFF`. Add that option to avoid
97+
having two conflicting versions of the same library.
98+
99+
A simple build configuration might look like the following:
95100

96101
```bash
97102
cmake -S <path-to-llvm-project-source>/runtimes \

flang/CMakeLists.txt

+4-29
Original file line numberDiff line numberDiff line change
@@ -23,7 +23,6 @@ if (LLVM_ENABLE_EH)
2323
endif()
2424

2525
set(FLANG_SOURCE_DIR ${CMAKE_CURRENT_SOURCE_DIR})
26-
set(FLANG_RT_SOURCE_DIR "${CMAKE_CURRENT_SOURCE_DIR}/../flang-rt")
2726

2827
# Python is needed for symbol extracting tool
2928
set(LLVM_MINIMUM_PYTHON_VERSION 3.8)
@@ -259,24 +258,10 @@ else()
259258
include_directories(SYSTEM ${MLIR_TABLEGEN_OUTPUT_DIR})
260259
endif()
261260

262-
set(FLANG_INCLUDE_RUNTIME_default ON)
263-
if ("flang-rt" IN_LIST LLVM_ENABLE_RUNTIMES)
264-
set(FLANG_INCLUDE_RUNTIME_default OFF)
265-
endif ()
266-
option(FLANG_INCLUDE_RUNTIME "Build the runtime in-tree (deprecated; to be replaced with LLVM_ENABLE_RUNTIMES=flang-rt)" ${FLANG_INCLUDE_RUNTIME_default})
267-
if (FLANG_INCLUDE_RUNTIME)
268-
if ("flang-rt" IN_LIST LLVM_ENABLE_RUNTIMES)
269-
message(WARNING "Building Flang-RT using LLVM_ENABLE_RUNTIMES. FLANG_INCLUDE_RUNTIME=${FLANG_INCLUDE_RUNTIME} ignored.")
270-
set(FLANG_INCLUDE_RUNTIME OFF)
271-
else ()
272-
message(STATUS "Building Flang-RT in-tree")
273-
endif ()
274-
else ()
275-
if ("flang-rt" IN_LIST LLVM_ENABLE_RUNTIMES)
276-
message(STATUS "Building Flang-RT using LLVM_ENABLE_RUNTIMES")
277-
else ()
278-
message(STATUS "Not building Flang-RT. For a usable Fortran toolchain, either add LLVM_ENABLE_RUNTIMES=flang-rt, or compile a standalone Flang-RT.")
279-
endif ()
261+
if (FLANG_STANDALONE_BUILD)
262+
message(STATUS "Not building Flang-RT. For a usable Fortran toolchain, compile a standalone Flang-RT.")
263+
elseif (NOT "flang-rt" IN_LIST LLVM_ENABLE_RUNTIMES)
264+
message(STATUS "Not building Flang-RT. For a usable Fortran toolchain, either set FLANG_ENABLE_FLANG_RT=ON, add LLVM_ENABLE_RUNTIMES=flang-rt, or compile a standalone Flang-RT.")
280265
endif ()
281266

282267
set(FLANG_TOOLS_INSTALL_DIR "${CMAKE_INSTALL_BINDIR}" CACHE PATH
@@ -501,12 +486,6 @@ if (FLANG_INCLUDE_TESTS)
501486
add_compile_definitions(FLANG_INCLUDE_TESTS=1)
502487
endif()
503488

504-
option(FLANG_CUF_RUNTIME
505-
"Compile CUDA Fortran runtime sources" OFF)
506-
if (FLANG_CUF_RUNTIME)
507-
find_package(CUDAToolkit REQUIRED)
508-
endif()
509-
510489
add_subdirectory(include)
511490
add_subdirectory(lib)
512491
add_subdirectory(cmake/modules)
@@ -517,10 +496,6 @@ if (FLANG_BUILD_TOOLS)
517496
add_subdirectory(tools)
518497
endif()
519498

520-
if (FLANG_INCLUDE_RUNTIME)
521-
add_subdirectory(runtime)
522-
endif ()
523-
524499
if (LLVM_INCLUDE_EXAMPLES)
525500
add_subdirectory(examples)
526501
endif()

flang/cmake/modules/AddFlangOffloadRuntime.cmake

-146
This file was deleted.

flang/examples/CMakeLists.txt

-3
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,3 @@
1-
if (FLANG_INCLUDE_RUNTIME)
2-
add_subdirectory(ExternalHelloWorld)
3-
endif ()
41
add_subdirectory(PrintFlangFunctionNames)
52
add_subdirectory(FlangOmpReport)
63
add_subdirectory(FeatureList)

flang/examples/ExternalHelloWorld/CMakeLists.txt

-9
This file was deleted.

0 commit comments

Comments
 (0)