[Openmp-commits] [PATCH] D129875: [Libomptarget] Make libomptarget an LLVM library
Joseph Huber via Phabricator via Openmp-commits
openmp-commits at lists.llvm.org
Wed Jul 20 06:51:45 PDT 2022
jhuber6 updated this revision to Diff 446141.
jhuber6 added a comment.
Adding another installation directory. This will install the library at the previous location as well as the standard LLVM one. This isn't the ideal solution, but it's much less noisy until we totally migrate all the plugins and libraries. Once we do that we can just update the `LIBOMPTARGET_LIBRARY_DIR` variable to be `LLVM_LIBRARY_DIR`.
Repository:
rG LLVM Github Monorepo
CHANGES SINCE LAST ACTION
https://reviews.llvm.org/D129875/new/
https://reviews.llvm.org/D129875
Files:
openmp/libomptarget/cmake/Modules/LibomptargetGetDependencies.cmake
openmp/libomptarget/src/CMakeLists.txt
Index: openmp/libomptarget/src/CMakeLists.txt
===================================================================
--- openmp/libomptarget/src/CMakeLists.txt
+++ openmp/libomptarget/src/CMakeLists.txt
@@ -12,35 +12,30 @@
libomptarget_say("Building offloading runtime library libomptarget.")
-set(LIBOMPTARGET_SRC_FILES
- ${CMAKE_CURRENT_SOURCE_DIR}/api.cpp
- ${CMAKE_CURRENT_SOURCE_DIR}/device.cpp
- ${CMAKE_CURRENT_SOURCE_DIR}/interface.cpp
- ${CMAKE_CURRENT_SOURCE_DIR}/interop.cpp
- ${CMAKE_CURRENT_SOURCE_DIR}/omptarget.cpp
- ${CMAKE_CURRENT_SOURCE_DIR}/rtl.cpp
- ${CMAKE_CURRENT_SOURCE_DIR}/LegacyAPI.cpp
-)
+add_llvm_library(omptarget
+ SHARED
+
+ api.cpp
+ device.cpp
+ interface.cpp
+ interop.cpp
+ omptarget.cpp
+ rtl.cpp
+ LegacyAPI.cpp
+
+ ADDITIONAL_HEADER_DIRS
+ ${LIBOMPTARGET_INCLUDE_DIR}
-set(LIBOMPTARGET_SRC_FILES ${LIBOMPTARGET_SRC_FILES} PARENT_SCOPE)
-
-# Build libomptarget library with libdl dependency.
-add_library(omptarget SHARED ${LIBOMPTARGET_SRC_FILES})
-set_target_properties(omptarget PROPERTIES INSTALL_RPATH "$ORIGIN" BUILD_RPATH "$ORIGIN")
-if (OPENMP_ENABLE_LIBOMPTARGET_PROFILING)
- # Add LLVMSupport dependency if profiling is enabled.
- # Linking with LLVM component libraries also requires
- # aligning the compile flags.
- llvm_update_compile_flags(omptarget)
- target_compile_definitions(omptarget PUBLIC OMPTARGET_PROFILE_ENABLED)
- target_link_libraries(omptarget PRIVATE LLVMSupport)
-endif()
-target_include_directories(omptarget PRIVATE
- ${LIBOMPTARGET_INCLUDE_DIR})
-target_link_libraries(omptarget PRIVATE
+ LINK_COMPONENTS
+ Support
+ Object
+
+ LINK_LIBS
${CMAKE_DL_LIBS}
- "-Wl,--version-script=${CMAKE_CURRENT_SOURCE_DIR}/exports")
+ "-Wl,--version-script=${CMAKE_CURRENT_SOURCE_DIR}/exports"
+)
+
+target_include_directories(omptarget PRIVATE ${LIBOMPTARGET_INCLUDE_DIR})
-# Install libomptarget under the lib destination folder.
-install(TARGETS omptarget LIBRARY COMPONENT omptarget
- DESTINATION "${OPENMP_INSTALL_LIBDIR}")
+# Also install plugin under the standard lib destination folder.
+install(TARGETS omptarget LIBRARY DESTINATION "${OPENMP_INSTALL_LIBDIR}")
Index: openmp/libomptarget/cmake/Modules/LibomptargetGetDependencies.cmake
===================================================================
--- openmp/libomptarget/cmake/Modules/LibomptargetGetDependencies.cmake
+++ openmp/libomptarget/cmake/Modules/LibomptargetGetDependencies.cmake
@@ -26,7 +26,7 @@
if (OPENMP_STANDALONE_BUILD)
# Complete LLVM package is required for building libomptarget
# in an out-of-tree mode.
- find_package(LLVM REQUIRED)
+ find_package(LLVM REQUIRED HINTS "${LLVM_CMAKE_DIR}")
message(STATUS "Found LLVM ${LLVM_PACKAGE_VERSION}")
message(STATUS "Using LLVM in: ${LLVM_DIR}")
list(APPEND LIBOMPTARGET_LLVM_INCLUDE_DIRS ${LLVM_INCLUDE_DIRS})
-------------- next part --------------
A non-text attachment was scrubbed...
Name: D129875.446141.patch
Type: text/x-patch
Size: 2854 bytes
Desc: not available
URL: <http://lists.llvm.org/pipermail/openmp-commits/attachments/20220720/4cf33ccf/attachment.bin>
More information about the Openmp-commits
mailing list