[llvm] [openmp] [Offload] Move `/openmp/libomptarget` to `/offload` (PR #75125)

David Tenty via llvm-commits llvm-commits at lists.llvm.org
Fri May 3 14:06:45 PDT 2024


================
@@ -113,7 +113,17 @@ option(OPENMP_ENABLE_LIBOMP_PROFILING "Enable time profiling for libomp." OFF)
 
 # Header install location
 if(${OPENMP_STANDALONE_BUILD})
-  set(LIBOMP_HEADERS_INSTALL_PATH "${CMAKE_INSTALL_INCLUDEDIR}")
+  if(CMAKE_CXX_COMPILER_ID MATCHES "Clang")
+    execute_process(
+      OUTPUT_STRIP_TRAILING_WHITESPACE
+      COMMAND ${CMAKE_CXX_COMPILER} --print-resource-dir
+      RESULT_VARIABLE COMMAND_RETURN_CODE
+      OUTPUT_VARIABLE COMPILER_RESOURCE_DIR
+    )
+    set(LIBOMP_HEADERS_INSTALL_PATH "${COMPILER_RESOURCE_DIR}/include")
----------------
daltenty wrote:

I think there's some confusion here about the effects of this.

Just for terminology clarity, my understanding is there are roughly three ways we can build runtimes subprojects of LLVM (defined by the top-level CMake source directory and CMake options you use):

1. **Projects+Runtimes build** with Clang (i.e. ):
`cmake -S llvm-project/llvm -DENABLE_PROJECTS=clang -DENABLE_RUNTIMES=openmp`
2. **Runtimes-only build**
`cmake -S llvm-project/runtimes -DENABLE_RUNTIMES=openmp`
3. **Stand-alone build** (from before the monorepo existed, doesn't really work for all subprojects anymore)
`cmake -S llvm-project/openmp -DOPENMP_LLVM_TOOLS_DIR=/path/to/llvm/build/bin`

> Yeah that's definitely wrong for a standalone build. For a runtimes build it's so we install it in a place where the compiler can find it so `./bin/clang` actually works. We'll need to fix a lot of this.

I assume this code was intended for a Projects+Runtimes build with clang. But it's inside a `if(OPENMP_STANDALONE_BUILD)` block which only seems to be true for standalone builds. 

There are some misleading comments in the source about this here https://github.com/llvm/llvm-project/blob/3e921d3c52542b3284c4bd0ef29a70511d38c79c/openmp/CMakeLists.txt#L3 but I checked my builds and I don't see it being set by llvm/runtimes at all and seems to be false during the tests. So I'm not sure this doing what was intended.

https://github.com/llvm/llvm-project/pull/75125


More information about the llvm-commits mailing list