Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Use @loader_path instead of $ORIGIN on MacOS #403

Merged
merged 7 commits into from
May 30, 2023
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
4 changes: 2 additions & 2 deletions example/CMakeLists.txt
Original file line number Diff line number Diff line change
Expand Up @@ -98,8 +98,8 @@ rapids_cpm_find(fmt 7.1.3
add_library(example SHARED source.cu)

set_target_properties(example
PROPERTIES BUILD_RPATH "\$ORIGIN"
INSTALL_RPATH "\$ORIGIN"
PROPERTIES BUILD_RPATH "$ORIGIN"
INSTALL_RPATH "$ORIGIN"
# set target compile options
CXX_STANDARD 17
CXX_STANDARD_REQUIRED ON
Expand Down
7 changes: 6 additions & 1 deletion rapids-cmake/cython/add_rpath_entries.cmake
Original file line number Diff line number Diff line change
Expand Up @@ -72,14 +72,19 @@ function(rapids_cython_add_rpath_entries)
list(APPEND cleaned_paths "${path}")
endforeach()

if(CMAKE_SYSTEM_NAME STREQUAL "Darwin")
set(platform_rpath_origin "@loader_path")
else()
set(platform_rpath_origin "$ORIGIN")
endif()
get_property(targets GLOBAL PROPERTY "rapids_cython_associations_${_RAPIDS_CYTHON_TARGET}")
foreach(target IN LISTS targets)
# Compute the path relative to the current target.
set(target_paths)
get_target_property(target_source_dir ${target} SOURCE_DIR)
foreach(target_path IN LISTS cleaned_paths)
cmake_path(RELATIVE_PATH target_path BASE_DIRECTORY "${target_source_dir}")
list(APPEND target_paths "$ORIGIN/${target_path}")
list(APPEND target_paths "${platform_rpath_origin}/${target_path}")
endforeach()
list(JOIN target_paths ";" target_paths)

Expand Down
7 changes: 6 additions & 1 deletion rapids-cmake/cython/create_modules.cmake
Original file line number Diff line number Diff line change
Expand Up @@ -127,7 +127,12 @@ function(rapids_cython_create_modules)
install(TARGETS ${cython_module} DESTINATION ${_RAPIDS_CYTHON_INSTALL_DIR})

# Default the INSTALL_RPATH for all modules to $ORIGIN.
set_target_properties(${cython_module} PROPERTIES INSTALL_RPATH "\$ORIGIN")
if(CMAKE_SYSTEM_NAME STREQUAL "Darwin")
set(platform_rpath_origin "@loader_path")
else()
set(platform_rpath_origin "$ORIGIN")
endif()
set_target_properties(${cython_module} PROPERTIES INSTALL_RPATH "${platform_rpath_origin}")

# Store any provided associated targets in a global list
foreach(associated_target IN LISTS _RAPIDS_CYTHON_ASSOCIATED_TARGETS)
Expand Down