Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Allow consumers of static builds to find nanoarrow #15456

Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
1 change: 1 addition & 0 deletions cpp/cmake/thirdparty/get_nanoarrow.cmake
Original file line number Diff line number Diff line change
Expand Up @@ -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(
Expand Down
39 changes: 31 additions & 8 deletions cpp/cmake/thirdparty/patches/nanoarrow_cmake.diff
Original file line number Diff line number Diff line change
@@ -1,5 +1,5 @@
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()
Expand All @@ -10,7 +10,15 @@ index 8714c70..1feec13 100644

# 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})
Expand All @@ -19,33 +27,39 @@ index 8714c70..1feec13 100644
target_compile_definitions(nanoarrow PUBLIC "$<$<CONFIG:Debug>: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 $<BUILD_INTERFACE:${CMAKE_CURRENT_SOURCE_DIR}/src>
@@ -154,13 +156,50 @@ else()
- $<INSTALL_INTERFACE:include>)
+ $<INSTALL_INTERFACE:${CMAKE_INSTALL_INCLUDEDIR}>)
target_include_directories(nanoarrow
PUBLIC $<BUILD_INTERFACE:${CMAKE_CURRENT_BINARY_DIR}/generated>
)
@@ -154,13 +157,49 @@ else()
endif()
endif()

- install(TARGETS nanoarrow DESTINATION lib)
+ install(TARGETS nanoarrow
+ DESTINATION lib
+ 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")
Expand Down Expand Up @@ -80,6 +94,15 @@ index 8714c70..1feec13 100644
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 $<BUILD_INTERFACE:${CMAKE_CURRENT_SOURCE_DIR}/src>
- $<INSTALL_INTERFACE:include>)
+ $<INSTALL_INTERFACE:${CMAKE_INSTALL_INCLUDEDIR}>)
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)

Expand Down
Loading