Skip to content

Commit

Permalink
Use rapids-cmake new COMPONENT exporting feature
Browse files Browse the repository at this point in the history
  • Loading branch information
robertmaynard committed Mar 21, 2023
1 parent 56ac43a commit 84a8935
Show file tree
Hide file tree
Showing 4 changed files with 21 additions and 431 deletions.
63 changes: 20 additions & 43 deletions cpp/CMakeLists.txt
Original file line number Diff line number Diff line change
Expand Up @@ -555,41 +555,6 @@ install(
DESTINATION include/raft
)

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

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

set(raft_components compiled distributed)
set(raft_install_comp raft raft)
if(TARGET raft_lib)
list(APPEND raft_components compiled-lib)
list(APPEND raft_install_comp compiled)
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 ${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 @@ -632,19 +597,31 @@ if(compiled IN_LIST raft_FIND_COMPONENTS)
endif()
]=]
)
set(raft_components compiled distributed)
set(raft_export_sets raft-compiled-exports raft-distributed-exports)
if(TARGET raft_lib)
list(APPEND raft_components compiled)
list(APPEND raft_export_sets raft-compiled-lib-exports)
endif()

# Use `rapids_export` for 22.04 as it will have COMPONENT support
include(cmake/modules/raft_export.cmake)
raft_export(
INSTALL raft COMPONENTS compiled distributed EXPORT_SET raft-exports GLOBAL_TARGETS raft compiled
distributed NAMESPACE raft:: DOCUMENTATION doc_string FINAL_CODE_BLOCK code_string
rapids_export(
INSTALL raft
EXPORT_SET raft-exports
COMPONENTS ${raft_components}
COMPONENTS_EXPORT_SET ${raft_export_sets}
GLOBAL_TARGETS raft compiled distributed
NAMESPACE raft:: DOCUMENTATION doc_string FINAL_CODE_BLOCK code_string
)

# ##################################################################################################
# * build export -------------------------------------------------------------
raft_export(
BUILD raft EXPORT_SET raft-exports COMPONENTS compiled distributed GLOBAL_TARGETS raft compiled
distributed DOCUMENTATION doc_string NAMESPACE raft:: FINAL_CODE_BLOCK code_string
rapids_export(
BUILD raft
EXPORT_SET raft-exports
COMPONENTS ${raft_components}
COMPONENTS_EXPORT_SET ${raft_export_sets}
GLOBAL_TARGETS raft
compiled distributed DOCUMENTATION doc_string NAMESPACE raft:: FINAL_CODE_BLOCK code_string
)

# ##################################################################################################
Expand Down
123 changes: 0 additions & 123 deletions cpp/cmake/modules/config.cmake.in

This file was deleted.

Loading

0 comments on commit 84a8935

Please sign in to comment.