summaryrefslogtreecommitdiff
path: root/runtimes
diff options
context:
space:
mode:
authorMichael Kruse <llvm-project@meinersbur.de>2025-07-26 01:56:57 +0200
committerGitHub <noreply@github.com>2025-07-26 01:56:57 +0200
commit799f28d7a5f155ae5456c87a511fbd18498f6396 (patch)
tree078f9032e6091095a8b4d0cac8e3702c965f6fd0 /runtimes
parent15b03687ff655e2e64afb8554645457d2e4cabd7 (diff)
[OpenMP] Fix runtimes default build (#149871)
The default build of openmp (`cmake -S <llvm-project>/runtimes -DLLVM_ENABLE_RUNTIMES=openmp`) current fails with ``` CMake Error at /home/meinersbur/src/llvm/flangrt/_src/cmake/Modules/GetClangResourceDir.cmake:17 (string): string sub-command REGEX, mode MATCH needs at least 5 arguments total to command. Call Stack (most recent call first): /home/meinersbur/src/llvm/flangrt/_src/openmp/CMakeLists.txt:126 (get_clang_resource_dir) ``` The reason is that because it is not a bootstrapping-build, the clang resource dir that it intends to write files such as `omp-tools.h` into, is unavailable. Using the Clang resource dir for writing files is conceptually broken, as that dir might be located in `/usr/lib/clang/<version>/`. Writing to it is only intended in bootstrapping builds where Clang is built alongside openmp. This patch unifies the identification of being in a bootstrapping built. The same `LLVM_TREE_AVAILABLE` definition is going to be used in #137828. No reason for each runtime to define its own.
Diffstat (limited to 'runtimes')
-rw-r--r--runtimes/CMakeLists.txt8
1 files changed, 8 insertions, 0 deletions
diff --git a/runtimes/CMakeLists.txt b/runtimes/CMakeLists.txt
index e4dd4ebfc678..d0d2a538e1e8 100644
--- a/runtimes/CMakeLists.txt
+++ b/runtimes/CMakeLists.txt
@@ -92,6 +92,14 @@ include(LLVMCheckCompilerLinkerFlag)
include(CheckCCompilerFlag)
include(CheckCXXCompilerFlag)
+
+# Determine whether we are in the runtimes/runtimes-bins directory of a
+# bootstrap build.
+set(LLVM_TREE_AVAILABLE OFF)
+if (LLVM_LIBRARY_OUTPUT_INTDIR AND LLVM_RUNTIME_OUTPUT_INTDIR AND PACKAGE_VERSION)
+ set(LLVM_TREE_AVAILABLE ON)
+endif()
+
# CMake omits default compiler include paths, but in runtimes build, we use
# -nostdinc and -nostdinc++ and control include paths manually so this behavior
# is undesirable. Filtering CMAKE_{LANG}_IMPLICIT_INCLUDE_DIRECTORIES to remove