mirror of
https://github.com/llvm/llvm-project.git
synced 2025-04-16 16:06:41 +00:00

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.
131 lines
3.4 KiB
CMake
131 lines
3.4 KiB
CMake
# Test runner infrastructure for Flang. This configures the Flang test trees
|
|
# for use by Lit, and delegates to LLVM's lit test handlers.
|
|
add_subdirectory(lib)
|
|
|
|
llvm_canonicalize_cmake_booleans(
|
|
FLANG_STANDALONE_BUILD
|
|
LLVM_BUILD_EXAMPLES
|
|
LLVM_BYE_LINK_INTO_TOOLS
|
|
LLVM_ENABLE_PLUGINS
|
|
)
|
|
|
|
set(FLANG_TOOLS_DIR ${FLANG_BINARY_DIR}/bin)
|
|
|
|
# Check if 128-bit float computations can be done via long double
|
|
check_cxx_source_compiles(
|
|
"#include <cfloat>
|
|
#if LDBL_MANT_DIG != 113
|
|
#error LDBL_MANT_DIG != 113
|
|
#endif
|
|
int main() { return 0; }
|
|
"
|
|
HAVE_LDBL_MANT_DIG_113)
|
|
|
|
# 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
|
|
${PATHS_FOR_PLUGINS}
|
|
)
|
|
|
|
configure_lit_site_cfg(
|
|
${CMAKE_CURRENT_SOURCE_DIR}/Unit/lit.site.cfg.py.in
|
|
${CMAKE_CURRENT_BINARY_DIR}/Unit/lit.site.cfg.py
|
|
MAIN_CONFIG
|
|
${CMAKE_CURRENT_SOURCE_DIR}/Unit/lit.cfg.py
|
|
)
|
|
|
|
configure_lit_site_cfg(
|
|
${CMAKE_CURRENT_SOURCE_DIR}/NonGtestUnit/lit.site.cfg.py.in
|
|
${CMAKE_CURRENT_BINARY_DIR}/NonGtestUnit/lit.site.cfg.py
|
|
MAIN_CONFIG
|
|
${CMAKE_CURRENT_SOURCE_DIR}/NonGtestUnit/lit.cfg.py
|
|
)
|
|
|
|
set(FLANG_TEST_PARAMS
|
|
flang_site_config=${CMAKE_CURRENT_BINARY_DIR}/lit.site.cfg.py)
|
|
|
|
set(FLANG_TEST_DEPENDS
|
|
flang
|
|
module_files
|
|
fir-opt
|
|
tco
|
|
bbc
|
|
FortranDecimal
|
|
)
|
|
if (NOT FLANG_STANDALONE_BUILD)
|
|
list(APPEND FLANG_TEST_DEPENDS
|
|
llvm-config
|
|
FileCheck
|
|
count
|
|
not
|
|
llvm-dis
|
|
llvm-objdump
|
|
llvm-readobj
|
|
split-file
|
|
)
|
|
endif ()
|
|
|
|
if (LLVM_ENABLE_PLUGINS AND NOT WIN32 AND NOT FLANG_STANDALONE_BUILD)
|
|
list(APPEND FLANG_TEST_DEPENDS Bye)
|
|
endif()
|
|
|
|
if (FLANG_INCLUDE_TESTS)
|
|
if (FLANG_GTEST_AVAIL)
|
|
list(APPEND FLANG_TEST_DEPENDS FlangUnitTests)
|
|
endif()
|
|
endif()
|
|
|
|
if (LLVM_BUILD_EXAMPLES)
|
|
list(APPEND FLANG_TEST_DEPENDS
|
|
flangPrintFunctionNames
|
|
flangOmpReport
|
|
flangFeatureList
|
|
)
|
|
endif ()
|
|
|
|
if ("openmp" IN_LIST LLVM_ENABLE_RUNTIMES AND NOT FLANG_STANDALONE_BUILD)
|
|
list(APPEND FLANG_TEST_DEPENDS "libomp-mod")
|
|
endif ()
|
|
|
|
add_custom_target(flang-test-depends DEPENDS ${FLANG_TEST_DEPENDS})
|
|
set_target_properties(flang-test-depends PROPERTIES FOLDER "Flang/Meta")
|
|
|
|
add_lit_testsuite(check-flang "Running the Flang regression tests"
|
|
${CMAKE_CURRENT_BINARY_DIR}
|
|
PARAMS ${FLANG_TEST_PARAMS}
|
|
DEPENDS ${FLANG_TEST_DEPENDS}
|
|
)
|
|
set_target_properties(check-flang PROPERTIES FOLDER "Flang/Meta")
|
|
|
|
# In case of standalone builds.
|
|
if (FLANG_STANDALONE_BUILD)
|
|
add_lit_testsuites(FLANG ${CMAKE_CURRENT_BINARY_DIR}
|
|
PARAMS ${FLANG_TEST_PARAMS}
|
|
DEPENDS ${FLANG_TEST_DEPENDS})
|
|
else()
|
|
add_lit_testsuites(FLANG ${CMAKE_CURRENT_SOURCE_DIR}
|
|
PARAMS ${FLANG_TEST_PARAMS}
|
|
DEPENDS ${FLANG_TEST_DEPENDS})
|
|
endif()
|
|
|
|
# To modify the default target triple for flang tests.
|
|
if (DEFINED FLANG_TEST_TARGET_TRIPLE)
|
|
if (NOT DEFINED LLVM_TARGET_TRIPLE_ENV OR LLVM_TARGET_TRIPLE_ENV STREQUAL "")
|
|
message(FATAL_ERROR "LLVM_TARGET_TRIPLE_ENV must also be defined in order "
|
|
"to use FLANG_TEST_TARGET_TRIPLE.")
|
|
endif()
|
|
endif()
|