From af33b0aba4dafe82cb5d25811e5e737af6c7faad Mon Sep 17 00:00:00 2001 From: Robert Maynard Date: Thu, 11 Apr 2024 16:13:09 -0400 Subject: [PATCH] nanoarrow uses package override for proper pinned versions generation (#15515) The usage of `PATCH_COMMAND` with `rapids_cpm_find` isn't capturable by `+rapids_cpm_generate_pinned_versions`. So we use a nanoarrow json override file to hold the patch we need applied and the custom SHA1 to check out. Authors: - Robert Maynard (https://github.com/robertmaynard) Approvers: - Jason Lowe (https://github.com/jlowe) - Vyas Ramasubramani (https://github.com/vyasr) URL: https://github.com/rapidsai/cudf/pull/15515 --- cpp/cmake/thirdparty/get_nanoarrow.cmake | 36 ++++--------------- .../patches/nanoarrow_override.json | 18 ++++++++++ 2 files changed, 24 insertions(+), 30 deletions(-) create mode 100644 cpp/cmake/thirdparty/patches/nanoarrow_override.json diff --git a/cpp/cmake/thirdparty/get_nanoarrow.cmake b/cpp/cmake/thirdparty/get_nanoarrow.cmake index 884e5a2f368..dc0b8d09746 100644 --- a/cpp/cmake/thirdparty/get_nanoarrow.cmake +++ b/cpp/cmake/thirdparty/get_nanoarrow.cmake @@ -14,44 +14,20 @@ # This function finds nanoarrow and sets any additional necessary environment variables. function(find_and_configure_nanoarrow) - set(oneValueArgs VERSION FORK PINNED_TAG) - cmake_parse_arguments(PKG "${options}" "${oneValueArgs}" "${multiValueArgs}" ${ARGN}) + include(${rapids-cmake-dir}/cpm/package_override.cmake) - # Only run if PKG_VERSION is < 0.5.0 - if(PKG_VERSION VERSION_LESS 0.5.0) - set(patch_files_to_run "${CMAKE_CURRENT_FUNCTION_LIST_DIR}/patches/nanoarrow_cmake.diff") - set(patch_issues_to_ref - "Fix issues with nanoarrow CMake [https://github.com/apache/arrow-nanoarrow/pull/406]" - ) - set(patch_script "${CMAKE_BINARY_DIR}/rapids-cmake/patches/nanoarrow/patch.cmake") - set(log_file "${CMAKE_BINARY_DIR}/rapids-cmake/patches/nanoarrow/log") - string(TIMESTAMP current_year "%Y" UTC) - configure_file( - ${rapids-cmake-dir}/cpm/patches/command_template.cmake.in "${patch_script}" @ONLY - ) - else() - message( - FATAL_ERROR - "Nanoarrow version ${PKG_VERSION} already contains the necessary patch. Please remove this patch from cudf." - ) - endif() + set(cudf_patch_dir "${CMAKE_CURRENT_FUNCTION_LIST_DIR}/patches") + rapids_cpm_package_override("${cudf_patch_dir}/nanoarrow_override.json") + # The git_repo and git_tag are provided by the nanoarrow_override file rapids_cpm_find( - nanoarrow ${PKG_VERSION} + nanoarrow 0.4.0 GLOBAL_TARGETS nanoarrow CPM_ARGS - GIT_REPOSITORY https://github.com/${PKG_FORK}/arrow-nanoarrow.git - GIT_TAG ${PKG_PINNED_TAG} - # TODO: Commit hashes are not supported with shallow clones. Can switch this if and when we pin - # to an actual tag. - GIT_SHALLOW FALSE - PATCH_COMMAND ${CMAKE_COMMAND} -P ${patch_script} OPTIONS "BUILD_SHARED_LIBS OFF" "NANOARROW_NAMESPACE cudf" ) set_target_properties(nanoarrow PROPERTIES POSITION_INDEPENDENT_CODE ON) rapids_export_find_package_root(BUILD nanoarrow "${nanoarrow_BINARY_DIR}" EXPORT_SET cudf-exports) endfunction() -find_and_configure_nanoarrow( - VERSION 0.4.0 FORK apache PINNED_TAG c97720003ff863b81805bcdb9f7c91306ab6b6a8 -) +find_and_configure_nanoarrow() diff --git a/cpp/cmake/thirdparty/patches/nanoarrow_override.json b/cpp/cmake/thirdparty/patches/nanoarrow_override.json new file mode 100644 index 00000000000..0b83d1808cb --- /dev/null +++ b/cpp/cmake/thirdparty/patches/nanoarrow_override.json @@ -0,0 +1,18 @@ + +{ + "packages" : { + "nanoarrow" : { + "version" : "0.4.0", + "git_url" : "https://github.com/apache/arrow-nanoarrow.git", + "git_tag" : "c97720003ff863b81805bcdb9f7c91306ab6b6a8", + "git_shallow" : false, + "patches" : [ + { + "file" : "${current_json_dir}/nanoarrow_cmake.diff", + "issue" : "Fix add support for global setup to initialize RMM in nvbench [https://github.com/NVIDIA/nvbench/pull/123]", + "fixed_in" : "0.5.0" + } + ] + } + } +}