
The Offload and Flang-RT had the ability to compile GTest themselves. But in bootstrapping builds, LLVM_LIBRARY_OUTPUT_INTDIR points to the same location as the stage1 build. If both are building GTest, they everwrite each others `libllvm_gtest.a` and `libllvm_test_main.a` which causes #143134. This PR removes the ability for the Offload/Flang-RT runtimes to build their own GTest and instead relies on the stage1 build of GTest. This was already the case with LLVM_INSTALL_GTEST=ON configurations. For LLVM_INSTALL_GTEST=OFF configurations, we now also export gtest into the buildtree configuration. Ultimately, this reduces combinatorial explosion of configurations in which unittests could be built (LLVM_INSTALL_GTEST=ON, GTest built by Offload, GTest built by Flang-RT, GTest built by Offload and also used by Flang-RT). GTest and therefore Offload/Runtime unittests will not be available if the runtimes are configured against an LLVM install tree. Since llvm-lit isn't available in the install tree either, it doesn't matter. Note that compiler-rt and libc also use GTest in non-default configrations. libc also depends on LLVM's GTest build (and would error-out if unavailable), but compiler-rt builds it completely different. Fixes #143134
56 lines
1.7 KiB
CMake
56 lines
1.7 KiB
CMake
#===-- test/CMakeLists.txt -------------------------------------------------===#
|
|
#
|
|
# 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
|
|
#
|
|
#===------------------------------------------------------------------------===#
|
|
|
|
# Test runner infrastructure for Flang. This configures the Flang test trees
|
|
# for use by Lit, and delegates to LLVM's lit test handlers.
|
|
|
|
llvm_canonicalize_cmake_booleans(
|
|
FLANG_STANDALONE_BUILD
|
|
LLVM_BUILD_EXAMPLES
|
|
LLVM_BYE_LINK_INTO_TOOLS
|
|
LLVM_ENABLE_PLUGINS
|
|
)
|
|
|
|
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
|
|
)
|
|
|
|
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
|
|
)
|
|
|
|
|
|
add_custom_target(flang-rt-test-depends)
|
|
set_target_properties(flang-rt-test-depends PROPERTIES FOLDER "Flang-RT/Meta")
|
|
add_dependencies(flang-rt-test-depends
|
|
flang_rt.runtime
|
|
)
|
|
|
|
add_lit_testsuite(check-flang-rt "Running the Flang-RT regression tests"
|
|
${CMAKE_CURRENT_BINARY_DIR}
|
|
DEPENDS flang-rt-test-depends
|
|
)
|
|
set_target_properties(check-flang-rt PROPERTIES FOLDER "Flang-RT/Meta")
|
|
|
|
add_lit_testsuites(flang-rt ${CMAKE_CURRENT_SOURCE_DIR}
|
|
DEPENDS flang-rt-test-depends
|
|
)
|