diff --git a/python/pylibraft/CMakeLists.txt b/python/pylibraft/CMakeLists.txt index f3dd7eaaa2..7432b98e30 100644 --- a/python/pylibraft/CMakeLists.txt +++ b/python/pylibraft/CMakeLists.txt @@ -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 @@ -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() diff --git a/python/pylibraft/pylibraft/common/CMakeLists.txt b/python/pylibraft/pylibraft/common/CMakeLists.txt index d9ed2d12fc..f8d86e0386 100644 --- a/python/pylibraft/pylibraft/common/CMakeLists.txt +++ b/python/pylibraft/pylibraft/common/CMakeLists.txt @@ -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() diff --git a/python/pylibraft/pylibraft/distance/CMakeLists.txt b/python/pylibraft/pylibraft/distance/CMakeLists.txt index d074171e58..01cdbd0876 100644 --- a/python/pylibraft/pylibraft/distance/CMakeLists.txt +++ b/python/pylibraft/pylibraft/distance/CMakeLists.txt @@ -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() diff --git a/python/pylibraft/pylibraft/random/CMakeLists.txt b/python/pylibraft/pylibraft/random/CMakeLists.txt index bc7357bb8a..c44b0cea67 100644 --- a/python/pylibraft/pylibraft/random/CMakeLists.txt +++ b/python/pylibraft/pylibraft/random/CMakeLists.txt @@ -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()