[Openmp-commits] [openmp] e46f727 - Revert "[Libomptarget] Make libomptarget an LLVM library"

Jon Chesterfield via Openmp-commits openmp-commits at lists.llvm.org
Tue Jul 19 09:59:56 PDT 2022


Author: Jon Chesterfield
Date: 2022-07-19T17:59:45+01:00
New Revision: e46f727b38f541ee4f8c2ef7b13e8826982c68a9

URL: https://github.com/llvm/llvm-project/commit/e46f727b38f541ee4f8c2ef7b13e8826982c68a9
DIFF: https://github.com/llvm/llvm-project/commit/e46f727b38f541ee4f8c2ef7b13e8826982c68a9.diff

LOG: Revert "[Libomptarget] Make libomptarget an LLVM library"

This reverts commit 70039be62774ae8fc53bb3b8f1bdbd2b0efb3355.

Added: 
    

Modified: 
    openmp/libomptarget/src/CMakeLists.txt

Removed: 
    


################################################################################
diff  --git a/openmp/libomptarget/src/CMakeLists.txt b/openmp/libomptarget/src/CMakeLists.txt
index 0d7d10e2c5414..8de88e567f957 100644
--- a/openmp/libomptarget/src/CMakeLists.txt
+++ b/openmp/libomptarget/src/CMakeLists.txt
@@ -12,27 +12,35 @@
 
 libomptarget_say("Building offloading runtime library libomptarget.")
 
-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
+  ${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
+)
 
-  LINK_COMPONENTS
-  Support
-  Object
+set(LIBOMPTARGET_SRC_FILES ${LIBOMPTARGET_SRC_FILES} PARENT_SCOPE)
 
-  LINK_LIBS
+# 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
   ${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}")


        


More information about the Openmp-commits mailing list