[flang] Disable Plugins in out-of-tree builds

https://reviews.llvm.org/D106137 added support for plugins in Flang. The
CMake configuration for plugins requires some LLVM variables that are
not available in out-of-tree builds (e.g. `LLVM_SHLIB_OUTPUT_INTDIR`).
This has caused the out-of-tree BuildBot worker to start failing:
  * https://lab.llvm.org/buildbot/#/builders/175

This patch effectively disables plugins in out-of-tree builds and fixes
the configuration error. In order to support plugins in out-of-tree
builds, we would have to find a way to access the missing CMake
variables from LLVM. This could be implemented at a later time.

Differential Revision: https://reviews.llvm.org/D107973
This commit is contained in:
Andrzej Warzynski 2021-08-12 16:11:54 +00:00
parent 18f9e25ce1
commit 8150c1bd8e
2 changed files with 14 additions and 1 deletions

View file

@ -392,6 +392,9 @@ endif()
add_subdirectory(runtime)
option(FLANG_BUILD_EXAMPLES "Build Flang example programs by default." OFF)
if (FLANG_BUILD_EXAMPLES AND FLANG_STANDALONE_BUILD)
message(FATAL_ERROR "Examples are not supported in out-of-tree builds.")
endif()
add_subdirectory(examples)
if (FLANG_INCLUDE_TESTS)

View file

@ -9,13 +9,23 @@ llvm_canonicalize_cmake_booleans(
set(FLANG_TOOLS_DIR ${FLANG_BINARY_DIR}/bin)
# FIXME In out-of-tree builds, "SHLIBDIR" is undefined and passing it to
# `configure_lit_site_cfg` leads to a configuration error. This is currently
# only required by plugins/examples, which are not supported in out-of-tree
# builds.
if (FLANG_STANDALONE_BUILD)
set(PATHS_FOR_PLUGINS "")
else ()
set(PATHS_FOR_PLUGINS "SHLIBDIR")
endif ()
configure_lit_site_cfg(
${CMAKE_CURRENT_SOURCE_DIR}/lit.site.cfg.py.in
${CMAKE_CURRENT_BINARY_DIR}/lit.site.cfg.py
MAIN_CONFIG
${CMAKE_CURRENT_SOURCE_DIR}/lit.cfg.py
PATHS
"SHLIBDIR"
${PATHS_FOR_PLUGINS}
)
configure_lit_site_cfg(