[OpenMP] Install ompt-multiplex.h alongside omp.h
authorserge-sans-paille <sguelton@redhat.com>
Wed, 7 Sep 2022 12:48:10 +0000 (14:48 +0200)
committerserge-sans-paille <sguelton@redhat.com>
Fri, 9 Sep 2022 07:42:08 +0000 (09:42 +0200)
The default install direction may not be in the compiler search path.

Differential Revision: https://reviews.llvm.org/D133420

openmp/CMakeLists.txt
openmp/runtime/src/CMakeLists.txt
openmp/tools/multiplex/CMakeLists.txt

index a038dc0..502a06e 100644 (file)
@@ -75,6 +75,14 @@ option(OPENMP_ENABLE_LIBOMPTARGET "Enable building libomptarget for offloading."
        ${ENABLE_LIBOMPTARGET})
 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}")
+else()
+  string(REGEX MATCH "[0-9]+\\.[0-9]+(\\.[0-9]+)?" CLANG_VERSION ${PACKAGE_VERSION})
+  set(LIBOMP_HEADERS_INSTALL_PATH "${OPENMP_INSTALL_LIBDIR}/clang/${CLANG_VERSION}/include")
+endif()
+
 # 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)
index df1ca9d..d1e79b2 100644 (file)
@@ -355,12 +355,6 @@ add_dependencies(libomp-micro-tests libomp-test-deps)
 # Install rules
 # We want to install libomp in ${DESTDIR}/${CMAKE_INSTALL_FULL_LIBDIR}
 # We want to install headers in ${DESTDIR}/${CMAKE_INSTALL_FULL_INCLUDEDIR}
-if(${OPENMP_STANDALONE_BUILD})
-  set(LIBOMP_HEADERS_INSTALL_PATH "${CMAKE_INSTALL_INCLUDEDIR}")
-else()
-  string(REGEX MATCH "[0-9]+\\.[0-9]+(\\.[0-9]+)?" CLANG_VERSION ${PACKAGE_VERSION})
-  set(LIBOMP_HEADERS_INSTALL_PATH "${OPENMP_INSTALL_LIBDIR}/clang/${CLANG_VERSION}/include")
-endif()
 if(WIN32)
   install(TARGETS omp RUNTIME DESTINATION "${CMAKE_INSTALL_BINDIR}")
   install(TARGETS ${LIBOMP_IMP_LIB_TARGET} ARCHIVE DESTINATION "${OPENMP_INSTALL_LIBDIR}")
index 8b50e95..afc7fc5 100644 (file)
@@ -4,7 +4,7 @@ if(LIBOMP_OMPT_SUPPORT)
   add_library(ompt-multiplex INTERFACE)
   target_include_directories(ompt-multiplex INTERFACE ${CMAKE_CURRENT_SOURCE_DIR})
 
-  install(FILES ompt-multiplex.h DESTINATION "${CMAKE_INSTALL_INCLUDEDIR}")
+  install(FILES ompt-multiplex.h DESTINATION "${LIBOMP_HEADERS_INSTALL_PATH}")
 
   add_subdirectory(tests)
 endif()