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

Map CMake install components to conda library packages #653

Merged
Show file tree
Hide file tree
Changes from all commits
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
80 changes: 40 additions & 40 deletions cpp/CMakeLists.txt
Original file line number Diff line number Diff line change
Expand Up @@ -356,12 +356,12 @@ install(TARGETS raft

install(TARGETS raft_distance
DESTINATION ${lib_dir}
COMPONENT raft_distance
COMPONENT raft
EXPORT raft-distance-exports)

install(TARGETS raft_nn
DESTINATION ${lib_dir}
COMPONENT raft_nn
COMPONENT raft
EXPORT raft-nn-exports)

if(TARGET raft_distance_lib)
Expand Down Expand Up @@ -394,6 +394,44 @@ install(FILES ${CMAKE_CURRENT_BINARY_DIR}/include/raft/version_config.hpp
COMPONENT raft
DESTINATION include/raft)

##############################################################################
# - export/install optional components --------------------------------------

include("${rapids-cmake-dir}/export/write_dependencies.cmake")

set(raft_components distance nn)
set(raft_install_comp "" "")
if(TARGET raft_distance_lib)
list(APPEND raft_components distance-lib)
list(APPEND raft_install_comp _distance)
endif()
if(TARGET raft_nn_lib)
list(APPEND raft_components nn-lib)
list(APPEND raft_install_comp _nn)
endif()

foreach(comp install_comp IN ZIP_LISTS raft_components raft_install_comp)
install(
EXPORT raft-${comp}-exports
FILE raft-${comp}-targets.cmake
NAMESPACE raft::
DESTINATION "${lib_dir}/cmake/raft"
COMPONENT raft${install_comp}
)
export(
EXPORT raft-${comp}-exports
FILE ${RAFT_BINARY_DIR}/raft-${comp}-targets.cmake
NAMESPACE raft::
)
rapids_export_write_dependencies(
BUILD raft-${comp}-exports "${PROJECT_BINARY_DIR}/raft-${comp}-dependencies.cmake"
)
rapids_export_write_dependencies(
INSTALL raft-${comp}-exports "${PROJECT_BINARY_DIR}/rapids-cmake/raft/export/${install_comp}/raft-${comp}-dependencies.cmake"
)

endforeach()

##############################################################################
# - install export -----------------------------------------------------------
set(doc_string
Expand Down Expand Up @@ -462,44 +500,6 @@ raft_export(BUILD raft
NAMESPACE raft::
FINAL_CODE_BLOCK code_string)

##############################################################################
# - export/install optional components --------------------------------------

include("${rapids-cmake-dir}/export/write_dependencies.cmake")

set(raft_components distance nn)
set(raft_install_comp distance nn)
if(TARGET raft_distance_lib)
list(APPEND raft_components distance-lib)
list(APPEND raft_install_comp distance)
endif()
if(TARGET raft_nn_lib)
list(APPEND raft_components nn-lib)
list(APPEND raft_install_comp nn)
endif()

foreach(comp install_comp IN ZIP_LISTS raft_components raft_install_comp)
install(
EXPORT raft-${comp}-exports
FILE raft-${comp}-targets.cmake
NAMESPACE raft::
DESTINATION "${lib_dir}/cmake/raft"
COMPONENT raft_${install_comp}
)
export(
EXPORT raft-${comp}-exports
FILE ${RAFT_BINARY_DIR}/raft-${comp}-targets.cmake
NAMESPACE raft::
)
rapids_export_write_dependencies(
BUILD raft-${comp}-exports "${PROJECT_BINARY_DIR}/raft-${comp}-dependencies.cmake"
)
rapids_export_write_dependencies(
INSTALL raft-${comp}-exports "${PROJECT_BINARY_DIR}/rapids-cmake/raft/export/${install_comp}/raft-${comp}-dependencies.cmake"
)

endforeach()

##############################################################################
# - build test executable ----------------------------------------------------

Expand Down
4 changes: 4 additions & 0 deletions cpp/cmake/modules/raft_export.cmake
Original file line number Diff line number Diff line change
Expand Up @@ -210,6 +210,10 @@ function(raft_export type project_name)
file(MAKE_DIRECTORY "${scratch_dir}")
install(DIRECTORY "${scratch_dir}" DESTINATION "${install_location}"
COMPONENT raft_${comp})
if(EXISTS "${scratch_dir}/raft-${comp}-dependencies.cmake")
install(FILES "${scratch_dir}/raft-${comp}-dependencies.cmake" DESTINATION "${install_location}"
COMPONENT raft)
endif()
endforeach()

else()
Expand Down