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 new rapids-cmake functionality for rpath handling. #976

Merged
merged 3 commits into from
Nov 1, 2022
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
11 changes: 8 additions & 3 deletions python/pylibraft/CMakeLists.txt
Original file line number Diff line number Diff line change
Expand Up @@ -41,6 +41,8 @@ else()
set(raft_FOUND OFF)
endif()

include(rapids-cython)

if(NOT raft_FOUND)
# TODO: This will not be necessary once we upgrade to CMake 3.22, which will
# pull in the required languages for the C++ project even if this project
Expand All @@ -61,14 +63,17 @@ if(NOT raft_FOUND)
# When building the C++ libraries from source we must copy
# libraft_distance.so alongside the pairwise_distance and random Cython libraries
# TODO: when we have a single 'compiled' raft library, we shouldn't need this
install(TARGETS raft_distance_lib DESTINATION pylibraft/distance)
install(TARGETS raft_distance_lib DESTINATION pylibraft/random)
set(cython_lib_dir pylibraft)
install(TARGETS raft_distance_lib DESTINATION ${cython_lib_dir})
endif()

include(rapids-cython)
rapids_cython_init()

add_subdirectory(pylibraft/common)
add_subdirectory(pylibraft/distance)
add_subdirectory(pylibraft/random)
add_subdirectory(pylibraft/cluster)

if(DEFINED cython_lib_dir)
rapids_cython_add_rpath_entries(TARGET raft PATHS "${cython_lib_dir}")
endif()
5 changes: 1 addition & 4 deletions python/pylibraft/pylibraft/common/CMakeLists.txt
Original file line number Diff line number Diff line change
Expand Up @@ -21,8 +21,5 @@ rapids_cython_create_modules(
CXX
SOURCE_FILES "${cython_sources}"
LINKED_LIBRARIES "${linked_libraries}"
ASSOCIATED_TARGETS raft
MODULE_PREFIX common_)

foreach(cython_module IN LISTS RAPIDS_CYTHON_CREATED_TARGETS)
set_target_properties(${cython_module} PROPERTIES INSTALL_RPATH "\$ORIGIN;\$ORIGIN/../library")
endforeach()
5 changes: 1 addition & 4 deletions python/pylibraft/pylibraft/distance/CMakeLists.txt
Original file line number Diff line number Diff line change
Expand Up @@ -22,8 +22,5 @@ rapids_cython_create_modules(
CXX
SOURCE_FILES "${cython_sources}"
LINKED_LIBRARIES "${linked_libraries}"
ASSOCIATED_TARGETS raft
MODULE_PREFIX distance_)

foreach(cython_module IN LISTS RAPIDS_CYTHON_CREATED_TARGETS)
set_target_properties(${cython_module} PROPERTIES INSTALL_RPATH "\$ORIGIN;\$ORIGIN/../library")
endforeach()
5 changes: 1 addition & 4 deletions python/pylibraft/pylibraft/random/CMakeLists.txt
Original file line number Diff line number Diff line change
Expand Up @@ -23,8 +23,5 @@ rapids_cython_create_modules(
CXX
SOURCE_FILES "${cython_sources}"
LINKED_LIBRARIES "${linked_libraries}"
ASSOCIATED_TARGETS raft
MODULE_PREFIX random_)

foreach(cython_module IN LISTS RAPIDS_CYTHON_CREATED_TARGETS)
set_target_properties(${cython_module} PROPERTIES INSTALL_RPATH "\$ORIGIN;\$ORIGIN/../library")
endforeach()