[Flang-RT][libc] LLVM-independent unittests #164794
Draft
+80
−56
Add this suggestion to a batch that can be applied as a single commit.
This suggestion is invalid because no changes were made to the code.
Suggestions cannot be applied while the pull request is closed.
Suggestions cannot be applied while viewing a subset of changes.
Only one suggestion per line can be applied in a batch.
Add this suggestion to a batch that can be applied as a single commit.
Applying suggestions on deleted lines is not supported.
You must change the existing code in this line in order to create a valid suggestion.
Outdated suggestions cannot be applied.
This suggestion has been applied or marked resolved.
Suggestions cannot be applied from pending reviews.
Suggestions cannot be applied on multi-line comments.
Suggestions cannot be applied while the pull request is queued to merge.
Suggestion cannot be applied right now. Please check back later.
The LLVM-customized GTest has a dependency on LLVM to support
llvm::raw_ostream
and hence has to link to LLVMSupport. The runtimes use the LLVMSupport from the bootstrapping LLVM build. The problem is that the boostrapping compiler and the runtimes target can diverge in their ABI, even in the runtimes default build. For instance, Clang is built using gcc which uses libstdc++, but the runtimes is built by Clang which can be configured to use libcxx by default. This has caused flang-aarch64-libcxx) to break, and is still broken.This patch makes the runtimes' GTest independent from LLVMSupport so we do not link any runtimes component with LLVM components.
Runtime projects that use GTest unittests:
The current state of this PR tries to reuse https://github.com/llvm/llvm-project/blob/main/third-party/unittest/CMakeLists.txt as much as possible, altough personally I would prefer to make it use "modern CMake" style. A new macro
build_gtest
adds a configurable build of GTest, one for LLVM (llvm_gtest
, NFCI) and another one for the runtimes (runtimes_gtest
). It is not possible to reusellvm_gtest
for both sincellvm_gtest
is imported usingfind_package(LLVM)
if LLVM_INSTALL_GTEST. An aliasdefault_gtest
is used to select between the two.default_gtest
could also be used for openmp which also supports standalone and LLVM_ENABLE_PROJECTS build mode.