[OpenMP][libomptarget] amdgpu plugin adds runpath for dependencies

amdgpu plugin depends on libhsa-runtime64 library. Add runpath in case it is not on the LD_LIBRARY_PATH.

Reviewed By: JonChesterfield

Differential Revision: https://reviews.llvm.org/D115198
This commit is contained in:
Ye Luo 2021-12-06 18:19:08 -06:00
parent caea440a11
commit 21a51cebf1

View File

@ -81,6 +81,7 @@ add_library(omptarget.rtl.amdgpu SHARED
# Install plugin under the lib destination folder. # Install plugin under the lib destination folder.
# When we build for debug, OPENMP_LIBDIR_SUFFIX get set to -debug # When we build for debug, OPENMP_LIBDIR_SUFFIX get set to -debug
install(TARGETS omptarget.rtl.amdgpu LIBRARY DESTINATION "lib${OPENMP_LIBDIR_SUFFIX}") install(TARGETS omptarget.rtl.amdgpu LIBRARY DESTINATION "lib${OPENMP_LIBDIR_SUFFIX}")
set_property(TARGET omptarget.rtl.amdgpu PROPERTY INSTALL_RPATH_USE_LINK_PATH ON)
if(CMAKE_SYSTEM_NAME MATCHES "FreeBSD") if(CMAKE_SYSTEM_NAME MATCHES "FreeBSD")
# On FreeBSD, the 'environ' symbol is undefined at link time, but resolved by # On FreeBSD, the 'environ' symbol is undefined at link time, but resolved by
@ -91,7 +92,6 @@ else()
set(LDFLAGS_UNDEFINED "-Wl,-z,defs") set(LDFLAGS_UNDEFINED "-Wl,-z,defs")
endif() endif()
set_property(TARGET omptarget.rtl.amdgpu PROPERTY INSTALL_RPATH "$ORIGIN")
target_link_libraries( target_link_libraries(
omptarget.rtl.amdgpu omptarget.rtl.amdgpu
PRIVATE PRIVATE