From 45f18f5ab1b6562566ddc5f5f72d6a71cd8f6f54 Mon Sep 17 00:00:00 2001 From: Robert Maynard Date: Wed, 3 Apr 2024 13:04:29 -0400 Subject: [PATCH 1/4] Allow consumers of static builds to find nanoarrow --- cpp/cmake/thirdparty/get_nanoarrow.cmake | 1 + cpp/cmake/thirdparty/patches/nanoarrow_cmake.diff | 2 +- 2 files changed, 2 insertions(+), 1 deletion(-) diff --git a/cpp/cmake/thirdparty/get_nanoarrow.cmake b/cpp/cmake/thirdparty/get_nanoarrow.cmake index 4316db99a8d..884e5a2f368 100644 --- a/cpp/cmake/thirdparty/get_nanoarrow.cmake +++ b/cpp/cmake/thirdparty/get_nanoarrow.cmake @@ -49,6 +49,7 @@ function(find_and_configure_nanoarrow) 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( diff --git a/cpp/cmake/thirdparty/patches/nanoarrow_cmake.diff b/cpp/cmake/thirdparty/patches/nanoarrow_cmake.diff index b53e134ed2c..a87dfbe833f 100644 --- a/cpp/cmake/thirdparty/patches/nanoarrow_cmake.diff +++ b/cpp/cmake/thirdparty/patches/nanoarrow_cmake.diff @@ -33,7 +33,7 @@ index 8714c70..1feec13 100644 - install(TARGETS nanoarrow DESTINATION lib) + install(TARGETS nanoarrow -+ DESTINATION lib ++ DESTINATION "${CMAKE_INSTALL_LIBDIR}" + EXPORT nanoarrow-exports) install(DIRECTORY src/ DESTINATION include From f5dc004b0748fd3af691c48ffbe19f414c0acac3 Mon Sep 17 00:00:00 2001 From: Vyas Ramasubramani Date: Wed, 3 Apr 2024 17:46:55 +0000 Subject: [PATCH 2/4] Fully update patch --- .../thirdparty/patches/nanoarrow_cmake.diff | 55 +++++++++++++------ 1 file changed, 39 insertions(+), 16 deletions(-) diff --git a/cpp/cmake/thirdparty/patches/nanoarrow_cmake.diff b/cpp/cmake/thirdparty/patches/nanoarrow_cmake.diff index a87dfbe833f..e4a83c603b9 100644 --- a/cpp/cmake/thirdparty/patches/nanoarrow_cmake.diff +++ b/cpp/cmake/thirdparty/patches/nanoarrow_cmake.diff @@ -1,16 +1,24 @@ diff --git a/CMakeLists.txt b/CMakeLists.txt -index 8714c70..1feec13 100644 +index 8714c70..6a9e505 100644 --- a/CMakeLists.txt +++ b/CMakeLists.txt @@ -49,7 +49,6 @@ else() endif() - + option(NANOARROW_CODE_COVERAGE "Enable coverage reporting" OFF) -add_library(coverage_config INTERFACE) - + # Avoids a warning about timestamps on downloaded files (prefer new policy # if available)) -@@ -111,6 +110,8 @@ if(NANOARROW_BUNDLE) +@@ -59,6 +58,7 @@ endif() + + configure_file(src/nanoarrow/nanoarrow_config.h.in generated/nanoarrow_config.h) + ++include(GNUInstallDirs) + if(NANOARROW_BUNDLE) + # Combine all headers into amalgamation/nanoarrow.h in the build directory + file(MAKE_DIRECTORY ${CMAKE_BINARY_DIR}/amalgamation) +@@ -111,6 +111,8 @@ if(NANOARROW_BUNDLE) if(NANOARROW_BUILD_TESTS) include_directories(${CMAKE_BINARY_DIR}/amalgamation) add_library(nanoarrow ${NANOARROW_C_TEMP}) @@ -18,34 +26,40 @@ index 8714c70..1feec13 100644 + target_compile_definitions(nanoarrow PUBLIC "$<$:NANOARROW_DEBUG>") endif() - -@@ -120,6 +121,7 @@ if(NANOARROW_BUNDLE) + +@@ -120,10 +122,11 @@ if(NANOARROW_BUNDLE) else() add_library(nanoarrow src/nanoarrow/array.c src/nanoarrow/schema.c src/nanoarrow/array_stream.c src/nanoarrow/utils.c) + add_library(nanoarrow::nanoarrow ALIAS nanoarrow) - + target_include_directories(nanoarrow PUBLIC $ -@@ -154,13 +156,50 @@ else() +- $) ++ $) + target_include_directories(nanoarrow + PUBLIC $ + ) +@@ -154,13 +157,49 @@ else() endif() endif() - + - install(TARGETS nanoarrow DESTINATION lib) + install(TARGETS nanoarrow + DESTINATION "${CMAKE_INSTALL_LIBDIR}" + EXPORT nanoarrow-exports) install(DIRECTORY src/ - DESTINATION include +- DESTINATION include ++ DESTINATION "${CMAKE_INSTALL_INCLUDEDIR}" FILES_MATCHING - PATTERN "*.h") + PATTERN "*.h*") install(FILES ${CMAKE_CURRENT_BINARY_DIR}/generated/nanoarrow_config.h - DESTINATION include/nanoarrow) +- DESTINATION include/nanoarrow) ++ DESTINATION "${CMAKE_INSTALL_INCLUDEDIR}/nanoarrow") + + # Generate package files for the build and install trees. + include(CMakePackageConfigHelpers) -+ include(GNUInstallDirs) + + foreach(tree_type BUILD INSTALL) + if(tree_type STREQUAL "BUILD") @@ -78,11 +92,20 @@ index 8714c70..1feec13 100644 + endif() + endforeach() endif() - + # Always build integration test if building tests +@@ -171,7 +210,7 @@ if(NANOARROW_BUILD_TESTS OR NANOARROW_BUILD_INTEGRATION_TESTS) + src/nanoarrow/integration/c_data_integration.cc) + target_include_directories(nanoarrow_c_data_integration + PUBLIC $ +- $) ++ $) + target_link_libraries(nanoarrow_c_data_integration PRIVATE nanoarrow nlohmann_json) + endif() + @@ -215,34 +254,18 @@ if(NANOARROW_BUILD_TESTS) src/nanoarrow/integration/c_data_integration_test.cc) - + if(NANOARROW_CODE_COVERAGE) - target_compile_options(coverage_config INTERFACE -O0 -g --coverage) - target_link_options(coverage_config INTERFACE --coverage) @@ -90,7 +113,7 @@ index 8714c70..1feec13 100644 + target_compile_options(nanoarrow PUBLIC -O0 -g --coverage) + target_link_options(nanoarrow PUBLIC --coverage) endif() - + - target_link_libraries(utils_test - nanoarrow - gtest_main @@ -124,7 +147,7 @@ index 8714c70..1feec13 100644 + nlohmann_json::nlohmann_json) target_link_libraries(c_data_integration_test nanoarrow nanoarrow_c_data_integration gtest_main) - + diff --git a/cmake/config.cmake.in b/cmake/config.cmake.in new file mode 100644 index 0000000..021dc31 From 7c22c7a72c2cd0a28a035bbd7df509f36953cc48 Mon Sep 17 00:00:00 2001 From: Vyas Ramasubramani Date: Wed, 3 Apr 2024 19:14:40 +0000 Subject: [PATCH 3/4] Strip trailing whitespace --- .../thirdparty/patches/nanoarrow_cmake.diff | 24 +++++++++---------- 1 file changed, 12 insertions(+), 12 deletions(-) diff --git a/cpp/cmake/thirdparty/patches/nanoarrow_cmake.diff b/cpp/cmake/thirdparty/patches/nanoarrow_cmake.diff index e4a83c603b9..a9ad2d8d894 100644 --- a/cpp/cmake/thirdparty/patches/nanoarrow_cmake.diff +++ b/cpp/cmake/thirdparty/patches/nanoarrow_cmake.diff @@ -4,16 +4,16 @@ index 8714c70..6a9e505 100644 +++ b/CMakeLists.txt @@ -49,7 +49,6 @@ else() endif() - + option(NANOARROW_CODE_COVERAGE "Enable coverage reporting" OFF) -add_library(coverage_config INTERFACE) - + # Avoids a warning about timestamps on downloaded files (prefer new policy # if available)) @@ -59,6 +58,7 @@ endif() - + configure_file(src/nanoarrow/nanoarrow_config.h.in generated/nanoarrow_config.h) - + +include(GNUInstallDirs) if(NANOARROW_BUNDLE) # Combine all headers into amalgamation/nanoarrow.h in the build directory @@ -26,13 +26,13 @@ index 8714c70..6a9e505 100644 + target_compile_definitions(nanoarrow PUBLIC "$<$:NANOARROW_DEBUG>") endif() - + @@ -120,10 +122,11 @@ if(NANOARROW_BUNDLE) else() add_library(nanoarrow src/nanoarrow/array.c src/nanoarrow/schema.c src/nanoarrow/array_stream.c src/nanoarrow/utils.c) + add_library(nanoarrow::nanoarrow ALIAS nanoarrow) - + target_include_directories(nanoarrow PUBLIC $ - $) @@ -43,7 +43,7 @@ index 8714c70..6a9e505 100644 @@ -154,13 +157,49 @@ else() endif() endif() - + - install(TARGETS nanoarrow DESTINATION lib) + install(TARGETS nanoarrow + DESTINATION "${CMAKE_INSTALL_LIBDIR}" @@ -92,7 +92,7 @@ index 8714c70..6a9e505 100644 + endif() + endforeach() endif() - + # Always build integration test if building tests @@ -171,7 +210,7 @@ if(NANOARROW_BUILD_TESTS OR NANOARROW_BUILD_INTEGRATION_TESTS) src/nanoarrow/integration/c_data_integration.cc) @@ -102,10 +102,10 @@ index 8714c70..6a9e505 100644 + $) target_link_libraries(nanoarrow_c_data_integration PRIVATE nanoarrow nlohmann_json) endif() - + @@ -215,34 +254,18 @@ if(NANOARROW_BUILD_TESTS) src/nanoarrow/integration/c_data_integration_test.cc) - + if(NANOARROW_CODE_COVERAGE) - target_compile_options(coverage_config INTERFACE -O0 -g --coverage) - target_link_options(coverage_config INTERFACE --coverage) @@ -113,7 +113,7 @@ index 8714c70..6a9e505 100644 + target_compile_options(nanoarrow PUBLIC -O0 -g --coverage) + target_link_options(nanoarrow PUBLIC --coverage) endif() - + - target_link_libraries(utils_test - nanoarrow - gtest_main @@ -147,7 +147,7 @@ index 8714c70..6a9e505 100644 + nlohmann_json::nlohmann_json) target_link_libraries(c_data_integration_test nanoarrow nanoarrow_c_data_integration gtest_main) - + diff --git a/cmake/config.cmake.in b/cmake/config.cmake.in new file mode 100644 index 0000000..021dc31 From c5d535d8f8e98ddc1db2fceab33b3a73b5695650 Mon Sep 17 00:00:00 2001 From: Vyas Ramasubramani Date: Wed, 3 Apr 2024 19:21:57 +0000 Subject: [PATCH 4/4] typo --- cpp/cmake/thirdparty/patches/nanoarrow_cmake.diff | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/cpp/cmake/thirdparty/patches/nanoarrow_cmake.diff b/cpp/cmake/thirdparty/patches/nanoarrow_cmake.diff index a9ad2d8d894..1262a38c0a4 100644 --- a/cpp/cmake/thirdparty/patches/nanoarrow_cmake.diff +++ b/cpp/cmake/thirdparty/patches/nanoarrow_cmake.diff @@ -36,7 +36,7 @@ index 8714c70..6a9e505 100644 target_include_directories(nanoarrow PUBLIC $ - $) -+ $) ++ $) target_include_directories(nanoarrow PUBLIC $ )