[amdgpu-arch] Fix rpath to run from build dir

[amdgpu-arch] Fix rpath to run from build dir

Prior to this, amdgpu-arch has RUNPATH set to $ORIGIN/../lib which works
for some installs, but not from the build directory where clang executes
the tool from when running tests.

This cmake option adds the location of the rocr runtime to the RUNPATH
(note, it amends RUNPATH here, despite the cmake option referring to RPATH)
to create a binary that runs from build or install location.

Before:
RUNPATH [$ORIGIN/../lib]
After:
RUNPATH [$ORIGIN/../lib:$HOME/llvm-install/lib]

Credit to Greg for knowing this trick and pointing to examples of it in use
for the aomp build scripts.

Reviewed By: pdhaliwal

Differential Revision: https://reviews.llvm.org/D101926
This commit is contained in:
Jon Chesterfield 2021-05-06 13:06:59 +01:00
parent 67cfefebbb
commit b24e9f82b7
1 changed files with 2 additions and 0 deletions

View File

@ -14,4 +14,6 @@ endif()
add_clang_tool(amdgpu-arch AMDGPUArch.cpp)
set_target_properties(amdgpu-arch PROPERTIES INSTALL_RPATH_USE_LINK_PATH ON)
clang_target_link_libraries(amdgpu-arch PRIVATE hsa-runtime64::hsa-runtime64)