Skip to content

Commit

Permalink
Fail to build the Python library if linking against a pre-built C++ l…
Browse files Browse the repository at this point in the history
…ibrary without the distance component.
  • Loading branch information
vyasr committed May 12, 2022
1 parent 549c765 commit fb28a5d
Show file tree
Hide file tree
Showing 2 changed files with 8 additions and 8 deletions.
8 changes: 0 additions & 8 deletions cpp/CMakeLists.txt
Original file line number Diff line number Diff line change
Expand Up @@ -137,14 +137,6 @@ if(RAFT_COMPILE_LIBRARIES)
set(RAFT_COMPILE_NN_LIBRARY ON)
endif()

if(distance IN_LIST raft_FIND_COMPONENTS)
set(RAFT_COMPILE_DIST_LIBRARY ON)
endif()

if(nn IN_LIST raft_FIND_COMPONENTS)
set(RAFT_COMPILE_NN_LIBRARY ON)
endif()

if(RAFT_COMPILE_DIST_LIBRARY)
set(RAFT_ENABLE_cuco_DEPENDENCY ON)
endif()
Expand Down
8 changes: 8 additions & 0 deletions python/pylibraft/CMakeLists.txt
Original file line number Diff line number Diff line change
Expand Up @@ -36,6 +36,14 @@ option(FIND_RAFT_CPP "Search for existing RAFT C++ installations before defaulti
# If the user requested it we attempt to find RAFT.
if(FIND_RAFT_CPP)
find_package(raft ${pylibraft_version} REQUIRED COMPONENTS distance)
# TODO: I find it odd that the raft-config.cmake includes the corresponding
# component lib-target/dependency as OPTIONAL. This leads to the variables
# raft_distance_FOUND and raft_nn_FOUND to always be set to true, and it
# means that the find_package call won't fail if a user requests a
# component that hasn't been installed. Is that an error?
if(NOT TARGET raft::raft_distance_lib)
message(FATAL_ERROR "Building against a preexisting libraft library requires the distance component of that library to have been built!")
endif()
else()
set(raft_FOUND OFF)
endif()
Expand Down

0 comments on commit fb28a5d

Please sign in to comment.