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

raft-config is idempotent no matter RAFT_COMPILE_LIBRARIES value #516

Merged
Merged
Show file tree
Hide file tree
Changes from 1 commit
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
12 changes: 9 additions & 3 deletions cpp/CMakeLists.txt
Original file line number Diff line number Diff line change
Expand Up @@ -267,7 +267,7 @@ install(TARGETS raft
DESTINATION ${lib_dir}
EXPORT raft-exports)
install(TARGETS raft_distance
DESTINATION ${lib_dir}
DESTINATION $lib_dir}
robertmaynard marked this conversation as resolved.
Show resolved Hide resolved
EXPORT raft-distance-exports)
install(TARGETS raft_nn
DESTINATION ${lib_dir}
Expand All @@ -276,13 +276,13 @@ install(TARGETS raft_nn
if(TARGET raft_distance_lib)
install(TARGETS raft_distance_lib
DESTINATION ${lib_dir}
EXPORT raft-distance-exports)
EXPORT raft-distance-lib-exports)
endif()

if(TARGET raft_nn_lib)
install(TARGETS raft_nn_lib
DESTINATION ${lib_dir}
EXPORT raft-nn-exports)
EXPORT raft-nn-lib-exports)
endif()


Expand Down Expand Up @@ -364,6 +364,12 @@ raft_export(BUILD raft
include("${rapids-cmake-dir}/export/write_dependencies.cmake")

set(raft_components distance nn)
if(TARGET raft_distance_lib)
list(APPEND raft_components distance-lib)
endif()
if(TARGET raft_nn_lib)
list(APPEND raft_components nn-lib)
endif()
foreach(comp IN LISTS raft_components)
install(
EXPORT raft-${comp}-exports
Expand Down
5 changes: 4 additions & 1 deletion cpp/cmake/modules/config.cmake.in
Original file line number Diff line number Diff line change
Expand Up @@ -40,7 +40,8 @@ foreach(lang IN LISTS rapids_global_languages)
endforeach()
unset(rapids_global_languages)

set(rapids_allowed_components @RAPIDS_COMPONENTS@)
set(rapids_base_components @RAPIDS_COMPONENTS@)
set(rapids_allowed_components ${rapids_base_components})

if(EXISTS "${CMAKE_CURRENT_LIST_DIR}/@[email protected]")
include("${CMAKE_CURRENT_LIST_DIR}/@[email protected]")
Expand All @@ -50,6 +51,7 @@ foreach(comp IN LISTS rapids_allowed_components)
# this way if a dependency can't be found we fail
if(${comp} IN_LIST @project_name@_FIND_COMPONENTS)
include("${CMAKE_CURRENT_LIST_DIR}/@project_name@-${comp}-dependencies.cmake" OPTIONAL)
include("${CMAKE_CURRENT_LIST_DIR}/@project_name@-${comp}-lib-dependencies.cmake" OPTIONAL)
endif()
endforeach()

Expand All @@ -58,6 +60,7 @@ include("${CMAKE_CURRENT_LIST_DIR}/@[email protected]" OPTIONAL)
foreach(comp IN LISTS rapids_allowed_components)
if(${comp} IN_LIST @project_name@_FIND_COMPONENTS)
include("${CMAKE_CURRENT_LIST_DIR}/@project_name@-${comp}-targets.cmake" OPTIONAL)
include("${CMAKE_CURRENT_LIST_DIR}/@project_name@-${comp}-lib-targets.cmake" OPTIONAL)
set(@project_name@_${comp}_FOUND TRUE)
endif()
endforeach()
Expand Down
4 changes: 2 additions & 2 deletions cpp/cmake/thirdparty/get_faiss.cmake
Original file line number Diff line number Diff line change
Expand Up @@ -59,8 +59,8 @@ function(find_and_configure_faiss)

# We generate the faiss-config files when we built faiss locally, so always do `find_dependency`
rapids_export_package(BUILD OpenMP raft-nn-exports) # faiss uses openMP but doesn't export a need for it
rapids_export_package(BUILD faiss raft-nn-exports)
rapids_export_package(INSTALL faiss raft-nn-exports)
rapids_export_package(BUILD faiss raft-nn-exports GLOBAL_TARGETS faiss::faiss faiss)
rapids_export_package(INSTALL faiss raft-nn-exports GLOBAL_TARGETS faiss::faiss faiss)

# Tell cmake where it can find the generated faiss-config.cmake we wrote.
include("${rapids-cmake-dir}/export/find_package_root.cmake")
Expand Down