Skip to content

Commit

Permalink
Enable components installation using CMake
Browse files Browse the repository at this point in the history
Signed-off-by: Jordan Jacobelli <[email protected]>
  • Loading branch information
jjacobelli committed Apr 26, 2022
1 parent d0601af commit c479caa
Show file tree
Hide file tree
Showing 2 changed files with 15 additions and 3 deletions.
10 changes: 10 additions & 0 deletions cpp/CMakeLists.txt
Original file line number Diff line number Diff line change
Expand Up @@ -330,36 +330,45 @@ include(CPack)

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

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

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

if(TARGET raft_distance_lib)
install(TARGETS raft_distance_lib
DESTINATION ${lib_dir}
COMPONENT raft_distance
EXPORT raft-distance-lib-exports)
endif()

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


install(DIRECTORY include/raft
COMPONENT raft
DESTINATION ${CMAKE_INSTALL_INCLUDEDIR})

# Temporary install of raft.hpp while the file is removed
install(FILES include/raft.hpp
COMPONENT raft
DESTINATION ${CMAKE_INSTALL_INCLUDEDIR}/raft)

install(FILES ${CMAKE_CURRENT_BINARY_DIR}/include/raft/version_config.hpp
COMPONENT raft
DESTINATION include/raft)

##############################################################################
Expand Down Expand Up @@ -448,6 +457,7 @@ foreach(comp IN LISTS raft_components)
FILE raft-${comp}-targets.cmake
NAMESPACE raft::
DESTINATION "${lib_dir}/cmake/raft"
COMPONENT raft
)
export(
EXPORT raft-${comp}-exports
Expand Down
8 changes: 5 additions & 3 deletions cpp/cmake/modules/raft_export.cmake
Original file line number Diff line number Diff line change
Expand Up @@ -185,7 +185,8 @@ function(raft_export type project_name)
endif()

install(EXPORT ${RAPIDS_EXPORT_SET} FILE ${project_name}-targets.cmake
NAMESPACE ${RAPIDS_PROJECT_VERSION} DESTINATION "${install_location}")
NAMESPACE ${RAPIDS_PROJECT_VERSION} DESTINATION "${install_location}"
COMPONENT raft)

if(TARGET rapids_export_install_${RAPIDS_EXPORT_SET})
include("${rapids-cmake-dir}/export/write_dependencies.cmake")
Expand All @@ -202,7 +203,8 @@ function(raft_export type project_name)
endif()

# Install everything we have generated
install(DIRECTORY "${scratch_dir}/" DESTINATION "${install_location}")
install(DIRECTORY "${scratch_dir}/" DESTINATION "${install_location}"
COMPONENT raft)

else()
set(install_location "${PROJECT_BINARY_DIR}")
Expand Down Expand Up @@ -235,4 +237,4 @@ function(raft_export type project_name)

endif()

endfunction()
endfunction()

0 comments on commit c479caa

Please sign in to comment.