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

[FIX] Always add raft::raft_nn_lib and raft::raft_distance_lib aliases #727

Conversation

trxcllnt
Copy link
Collaborator

@trxcllnt trxcllnt commented Jun 29, 2022

Always add raft::raft_nn_lib and raft::raft_distance_lib aliases so adding raft as a submodule provides the same library targets as using it as a package.

Here's an example of the differences between using RAFT as a submodule and using it as a package (preinstalled or otherwise):

# Build raft from source
set(RAFT_COMPILE_LIBRARIES ON)
add_subdirectory(/raft/cpp)
if(TARGET raft_nn_lib) # FALSE
if(TARGET raft_distance_lib) # FALSE
if(TARGET raft::raft_nn_lib) # TRUE
if(TARGET raft::raft_distance_lib) # TRUE

# Find the RAFT package
set(raft_ROOT /raft/cpp/build)
find_package(raft)
if(TARGET raft_nn_lib) # FALSE
if(TARGET raft_distance_lib) # FALSE
if(TARGET raft::raft_nn_lib) # TRUE
if(TARGET raft::raft_distance_lib) # TRUE

The problem is exacerbated if we use CPMFindPackage, since the available raft targets will be different based on whether this is the first time we've configured or if we're re-configuring:

if(EXISTS ${CMAKE_BINARY_DIR}/_deps/raft-build)
  set(raft_ROOT ${CMAKE_BINARY_DIR}/_deps/raft-build)
endif()
# Find or build RAFT from source
CPMFindPackage(NAME raft ...)
if(TARGET raft_nn_lib) # initial configure=TRUE, reconfigure=FALSE
if(TARGET raft_distance_lib) # initial configure=TRUE, reconfigure=FALSE
if(TARGET raft::raft_nn_lib) # initial configure=FALSE, reconfigure=TRUE
if(TARGET raft::raft_distance_lib) # initial configure=FALSE, reconfigure=TRUE

…dding raft as a submodule provides the same library targets as using it as a package
@trxcllnt trxcllnt requested a review from robertmaynard June 29, 2022 18:14
@trxcllnt trxcllnt requested a review from a team as a code owner June 29, 2022 18:14
@trxcllnt trxcllnt added 3 - Ready for Review improvement Improvement / enhancement to an existing function non-breaking Non-breaking change labels Jun 29, 2022
@cjnolet
Copy link
Member

cjnolet commented Jun 29, 2022

@gpucibot merge

@rapids-bot rapids-bot bot merged commit 5f12112 into rapidsai:branch-22.08 Jun 29, 2022
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
3 - Ready for Review CMake cpp improvement Improvement / enhancement to an existing function non-breaking Non-breaking change
Projects
None yet
Development

Successfully merging this pull request may close these issues.

3 participants