aboutsummaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorGiorgis Georgakoudis <georgakoudis1@llnl.gov>2021-01-25 14:10:50 -0800
committerGiorgis Georgakoudis <georgakoudis1@llnl.gov>2021-01-27 06:43:57 -0800
commitbb40e6731843de92f1c73ad6efceb8a89e045ea6 (patch)
treed2fe47c673f4d010b63b7267ca5ba5fd60ebbeb7
parent12de8e1399fecf691639ba430b3824acb1311e70 (diff)
downloadllvm-bb40e6731843de92f1c73ad6efceb8a89e045ea6.zip
llvm-bb40e6731843de92f1c73ad6efceb8a89e045ea6.tar.gz
llvm-bb40e6731843de92f1c73ad6efceb8a89e045ea6.tar.bz2
[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
-rw-r--r--openmp/CMakeLists.txt10
-rw-r--r--openmp/runtime/src/CMakeLists.txt9
2 files changed, 14 insertions, 5 deletions
diff --git a/openmp/CMakeLists.txt b/openmp/CMakeLists.txt
index 67600be..f89857d 100644
--- a/openmp/CMakeLists.txt
+++ b/openmp/CMakeLists.txt
@@ -55,11 +55,6 @@ set(OPENMP_TEST_FLAGS "" CACHE STRING
set(OPENMP_TEST_OPENMP_FLAGS ${OPENMP_TEST_COMPILER_OPENMP_FLAGS} CACHE STRING
"OpenMP compiler flag to use for testing OpenMP runtime libraries.")
-
-# Build host runtime library.
-add_subdirectory(runtime)
-
-
set(ENABLE_LIBOMPTARGET ON)
# Currently libomptarget cannot be compiled on Windows or MacOS X.
# Since the device plugins are only supported on Linux anyway,
@@ -86,6 +81,11 @@ option(OPENMP_ENABLE_LIBOMPTARGET "Enable building libomptarget for offloading."
${ENABLE_LIBOMPTARGET})
option(OPENMP_ENABLE_LIBOMPTARGET_PROFILING "Enable time profiling for libomptarget."
${ENABLE_LIBOMPTARGET})
+
+# Build host runtime library, after LIBOMPTARGET variables are set since they are needed
+# to enable time profiling support in the OpenMP runtime.
+add_subdirectory(runtime)
+
if (OPENMP_ENABLE_LIBOMPTARGET)
# Check that the library can actually be built.
if (APPLE OR WIN32)
diff --git a/openmp/runtime/src/CMakeLists.txt b/openmp/runtime/src/CMakeLists.txt
index 2e927df..9c5dba55 100644
--- a/openmp/runtime/src/CMakeLists.txt
+++ b/openmp/runtime/src/CMakeLists.txt
@@ -50,6 +50,15 @@ if(${LIBOMP_USE_HWLOC})
include_directories(${LIBOMP_HWLOC_INSTALL_DIR}/include)
endif()
+# Building with time profiling support for libomptarget requires
+# LLVM directory includes.
+if(LIBOMPTARGET_PROFILING_SUPPORT)
+ include_directories(
+ ${LLVM_MAIN_INCLUDE_DIR}
+ ${LLVM_INCLUDE_DIR}
+ )
+endif()
+
# Getting correct source files to build library
set(LIBOMP_CXXFILES)
set(LIBOMP_ASMFILES)