From dbfe5a8cfe456d0843fde0477a4dd8ed26e10e13 Mon Sep 17 00:00:00 2001 From: Michael Kruse Date: Mon, 21 Jul 2025 18:54:26 +0200 Subject: [PATCH 1/2] [OpenMP] default build fix --- openmp/CMakeLists.txt | 2 +- openmp/runtime/src/CMakeLists.txt | 2 +- runtimes/CMakeLists.txt | 9 +++++++++ 3 files changed, 11 insertions(+), 2 deletions(-) diff --git a/openmp/CMakeLists.txt b/openmp/CMakeLists.txt index c206386fa6b61..ab34851d8961c 100644 --- a/openmp/CMakeLists.txt +++ b/openmp/CMakeLists.txt @@ -115,7 +115,7 @@ option(OPENMP_ENABLE_LIBOMPTARGET "Enable building libomptarget for offloading." option(OPENMP_ENABLE_LIBOMP_PROFILING "Enable time profiling for libomp." OFF) # Header install location -if(${OPENMP_STANDALONE_BUILD}) +if(NOT LLVM_TREE_AVAILABLE) set(LIBOMP_HEADERS_INSTALL_PATH "${CMAKE_INSTALL_INCLUDEDIR}") else() include(GetClangResourceDir) diff --git a/openmp/runtime/src/CMakeLists.txt b/openmp/runtime/src/CMakeLists.txt index 698e185d9c4dd..569061c6494b8 100644 --- a/openmp/runtime/src/CMakeLists.txt +++ b/openmp/runtime/src/CMakeLists.txt @@ -11,7 +11,7 @@ include(ExtendPath) # The generated headers will be placed in clang's resource directory if present. -if(OPENMP_STANDALONE_BUILD OR NOT LLVM_RUNTIMES_BUILD) +if(NOT LLVM_TREE_AVAILABLE) set(LIBOMP_HEADERS_INTDIR ${CMAKE_CURRENT_BINARY_DIR}) else() set(LIBOMP_HEADERS_INTDIR ${LLVM_BINARY_DIR}/${LIBOMP_HEADERS_INSTALL_PATH}) diff --git a/runtimes/CMakeLists.txt b/runtimes/CMakeLists.txt index e4dd4ebfc678d..051eb5991f6f6 100644 --- a/runtimes/CMakeLists.txt +++ b/runtimes/CMakeLists.txt @@ -92,6 +92,15 @@ 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 From 9fce817ded96f37f9ae7f0f774b1fcc31948ddae Mon Sep 17 00:00:00 2001 From: Michael Kruse Date: Tue, 22 Jul 2025 17:36:15 +0200 Subject: [PATCH 2/2] Apply change suggested by @jhuber6 Co-authored-by: Joseph Huber --- runtimes/CMakeLists.txt | 1 - 1 file changed, 1 deletion(-) diff --git a/runtimes/CMakeLists.txt b/runtimes/CMakeLists.txt index 051eb5991f6f6..d0d2a538e1e85 100644 --- a/runtimes/CMakeLists.txt +++ b/runtimes/CMakeLists.txt @@ -100,7 +100,6 @@ if (LLVM_LIBRARY_OUTPUT_INTDIR AND LLVM_RUNTIME_OUTPUT_INTDIR AND PACKAGE_VERSIO 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