From 326cfec071f16523d6e2554c5702d82e3f78eb89 Mon Sep 17 00:00:00 2001 From: Vyas Ramasubramani Date: Tue, 1 Nov 2022 11:07:06 -0700 Subject: [PATCH 1/3] Use new rapids-cmake functionality for rpath handling. --- python/pylibraft/pylibraft/common/CMakeLists.txt | 5 +---- python/pylibraft/pylibraft/distance/CMakeLists.txt | 5 +---- python/pylibraft/pylibraft/random/CMakeLists.txt | 5 +---- 3 files changed, 3 insertions(+), 12 deletions(-) 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..7ee913cac6 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 cuml 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..268d7183cd 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 cuml MODULE_PREFIX random_) - -foreach(cython_module IN LISTS RAPIDS_CYTHON_CREATED_TARGETS) - set_target_properties(${cython_module} PROPERTIES INSTALL_RPATH "\$ORIGIN;\$ORIGIN/../library") -endforeach() From bc6ecbcd7118da87ae4a5a55f4238d66b3bbf0ff Mon Sep 17 00:00:00 2001 From: Vyas Ramasubramani Date: Tue, 1 Nov 2022 11:18:35 -0700 Subject: [PATCH 2/3] Fix typos. --- python/pylibraft/pylibraft/distance/CMakeLists.txt | 2 +- python/pylibraft/pylibraft/random/CMakeLists.txt | 2 +- 2 files changed, 2 insertions(+), 2 deletions(-) diff --git a/python/pylibraft/pylibraft/distance/CMakeLists.txt b/python/pylibraft/pylibraft/distance/CMakeLists.txt index 7ee913cac6..01cdbd0876 100644 --- a/python/pylibraft/pylibraft/distance/CMakeLists.txt +++ b/python/pylibraft/pylibraft/distance/CMakeLists.txt @@ -22,5 +22,5 @@ rapids_cython_create_modules( CXX SOURCE_FILES "${cython_sources}" LINKED_LIBRARIES "${linked_libraries}" - ASSOCIATED_TARGETS cuml + ASSOCIATED_TARGETS raft MODULE_PREFIX distance_) diff --git a/python/pylibraft/pylibraft/random/CMakeLists.txt b/python/pylibraft/pylibraft/random/CMakeLists.txt index 268d7183cd..c44b0cea67 100644 --- a/python/pylibraft/pylibraft/random/CMakeLists.txt +++ b/python/pylibraft/pylibraft/random/CMakeLists.txt @@ -23,5 +23,5 @@ rapids_cython_create_modules( CXX SOURCE_FILES "${cython_sources}" LINKED_LIBRARIES "${linked_libraries}" - ASSOCIATED_TARGETS cuml + ASSOCIATED_TARGETS raft MODULE_PREFIX random_) From cf4e907403a4d3d216a55afe707ecbca904e9afb Mon Sep 17 00:00:00 2001 From: Vyas Ramasubramani Date: Tue, 1 Nov 2022 11:51:34 -0700 Subject: [PATCH 3/3] Set the rpath for raft lib. --- python/pylibraft/CMakeLists.txt | 11 ++++++++--- 1 file changed, 8 insertions(+), 3 deletions(-) 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()