Skip to content

Commit

Permalink
Update to use rapids-export(COMPONENTS) feature. (#12959)
Browse files Browse the repository at this point in the history
Not only does this simplify the `cudf` CMakeLists.txt it removes a bug where we failed to install the testing dependencies file since it relied on internal rapids-cmake details.

Expected to fix the following:

- cuspatial issues with not finding GTest targets
- [spark-rapids-jni](https://github.com/NVIDIA/spark-rapids-jni) issues with not finding GTest targets

Fixes #12976

Authors:
  - Robert Maynard (https://github.com/robertmaynard)
  - Vyas Ramasubramani (https://github.com/vyasr)

Approvers:
  - Bradley Dice (https://github.com/bdice)
  - Mike Wilson (https://github.com/hyperbolic2346)
  - Jason Lowe (https://github.com/jlowe)

URL: #12959
  • Loading branch information
robertmaynard authored Mar 20, 2023
1 parent 565efb7 commit d171fda
Showing 1 changed file with 11 additions and 38 deletions.
49 changes: 11 additions & 38 deletions cpp/CMakeLists.txt
Original file line number Diff line number Diff line change
Expand Up @@ -890,31 +890,20 @@ install(
EXPORT cudf-exports
)

install(DIRECTORY ${CUDF_SOURCE_DIR}/include/cudf ${CUDF_SOURCE_DIR}/include/cudf_test
${CUDF_SOURCE_DIR}/include/nvtext DESTINATION ${CMAKE_INSTALL_INCLUDEDIR}
)

if(CUDF_BUILD_TESTUTIL)
set(_components_export_string)
if(TARGET cudftestutil)
install(
TARGETS cudftest_default_stream cudftestutil
DESTINATION ${lib_dir}
EXPORT cudf-testing-exports
)

install(
EXPORT cudf-testing-exports
FILE cudf-testing-targets.cmake
NAMESPACE cudf::
DESTINATION "${lib_dir}/cmake/cudf"
)

include("${rapids-cmake-dir}/export/write_dependencies.cmake")
rapids_export_write_dependencies(
INSTALL cudf-testing-exports
"${PROJECT_BINARY_DIR}/rapids-cmake/cudf/export/cudf-testing-dependencies.cmake"
)
set(_components_export_string COMPONENTS testing COMPONENTS_EXPORT_SET cudf-testing-exports)
endif()

install(DIRECTORY ${CUDF_SOURCE_DIR}/include/cudf ${CUDF_SOURCE_DIR}/include/cudf_test
${CUDF_SOURCE_DIR}/include/nvtext DESTINATION ${CMAKE_INSTALL_INCLUDEDIR}
)

if(CUDF_BUILD_STREAMS_TEST_UTIL)
install(TARGETS cudf_identify_stream_usage_mode_cudf DESTINATION ${lib_dir})
install(TARGETS cudf_identify_stream_usage_mode_testing DESTINATION ${lib_dir})
Expand Down Expand Up @@ -976,21 +965,15 @@ string(
[=[
if(testing IN_LIST cudf_FIND_COMPONENTS)
enable_language(CUDA)
if(EXISTS "${CMAKE_CURRENT_LIST_DIR}/cudf-testing-dependencies.cmake")
include("${CMAKE_CURRENT_LIST_DIR}/cudf-testing-dependencies.cmake")
endif()
if(EXISTS "${CMAKE_CURRENT_LIST_DIR}/cudf-testing-targets.cmake")
include("${CMAKE_CURRENT_LIST_DIR}/cudf-testing-targets.cmake")
endif()
endif()
]=]
)
string(APPEND install_code_string "${common_code_string}")

rapids_export(
INSTALL cudf
EXPORT_SET cudf-exports
GLOBAL_TARGETS cudf
EXPORT_SET cudf-exports ${_components_export_string}
GLOBAL_TARGETS cudf cudftestutil
NAMESPACE cudf::
DOCUMENTATION doc_string
FINAL_CODE_BLOCK install_code_string
Expand All @@ -1013,23 +996,13 @@ string(APPEND build_code_string "${common_code_string}")

rapids_export(
BUILD cudf
EXPORT_SET cudf-exports
GLOBAL_TARGETS cudf
EXPORT_SET cudf-exports ${_components_export_string}
GLOBAL_TARGETS cudf cudftestutil
NAMESPACE cudf::
DOCUMENTATION doc_string
FINAL_CODE_BLOCK build_code_string
)

if(CUDF_BUILD_TESTUTIL)
export(
EXPORT cudf-testing-exports
FILE ${CUDF_BINARY_DIR}/cudf-testing-targets.cmake
NAMESPACE cudf::
)
rapids_export_write_dependencies(
BUILD cudf-testing-exports "${CUDF_BINARY_DIR}/cudf-testing-dependencies.cmake"
)
endif()
# ##################################################################################################
# * make documentation ----------------------------------------------------------------------------

Expand Down

0 comments on commit d171fda

Please sign in to comment.