Skip to content

Commit bb40e67

Browse files
committed
[OpenMP] Fix building using LLVM_ENABLE_RUNTIMES
Fix when time profiling is enabled. Related to: D94855 Reviewed By: JonChesterfield Differential Revision: https://reviews.llvm.org/D95398
1 parent 12de8e1 commit bb40e67

File tree

2 files changed

+14
-5
lines changed

2 files changed

+14
-5
lines changed

openmp/CMakeLists.txt

Lines changed: 5 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -55,11 +55,6 @@ set(OPENMP_TEST_FLAGS "" CACHE STRING
5555
set(OPENMP_TEST_OPENMP_FLAGS ${OPENMP_TEST_COMPILER_OPENMP_FLAGS} CACHE STRING
5656
"OpenMP compiler flag to use for testing OpenMP runtime libraries.")
5757

58-
59-
# Build host runtime library.
60-
add_subdirectory(runtime)
61-
62-
6358
set(ENABLE_LIBOMPTARGET ON)
6459
# Currently libomptarget cannot be compiled on Windows or MacOS X.
6560
# Since the device plugins are only supported on Linux anyway,
@@ -86,6 +81,11 @@ option(OPENMP_ENABLE_LIBOMPTARGET "Enable building libomptarget for offloading."
8681
${ENABLE_LIBOMPTARGET})
8782
option(OPENMP_ENABLE_LIBOMPTARGET_PROFILING "Enable time profiling for libomptarget."
8883
${ENABLE_LIBOMPTARGET})
84+
85+
# Build host runtime library, after LIBOMPTARGET variables are set since they are needed
86+
# to enable time profiling support in the OpenMP runtime.
87+
add_subdirectory(runtime)
88+
8989
if (OPENMP_ENABLE_LIBOMPTARGET)
9090
# Check that the library can actually be built.
9191
if (APPLE OR WIN32)

openmp/runtime/src/CMakeLists.txt

Lines changed: 9 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -50,6 +50,15 @@ if(${LIBOMP_USE_HWLOC})
5050
include_directories(${LIBOMP_HWLOC_INSTALL_DIR}/include)
5151
endif()
5252

53+
# Building with time profiling support for libomptarget requires
54+
# LLVM directory includes.
55+
if(LIBOMPTARGET_PROFILING_SUPPORT)
56+
include_directories(
57+
${LLVM_MAIN_INCLUDE_DIR}
58+
${LLVM_INCLUDE_DIR}
59+
)
60+
endif()
61+
5362
# Getting correct source files to build library
5463
set(LIBOMP_CXXFILES)
5564
set(LIBOMP_ASMFILES)

0 commit comments

Comments
 (0)