This is an automated email from the ASF dual-hosted git repository.
paleolimbot pushed a commit to branch main
in repository https://gitbox.apache.org/repos/asf/arrow-nanoarrow.git
The following commit(s) were added to refs/heads/main by this push:
new 8fbb9458 chore: Enable extensions to be built from the main CMake
project (#481)
8fbb9458 is described below
commit 8fbb9458918195d161dd6d678c5de6b0f07ffb0d
Author: Dewey Dunnington <[email protected]>
AuthorDate: Fri May 24 10:10:31 2024 -0300
chore: Enable extensions to be built from the main CMake project (#481)
This is part of a solution to #407 in that it enables `cmake .
-DNANOARROW_IPC=ON`; however, I don't think it completely solves it
since I am not sure that the full suite of bundle/install/fetchcontent
will work here yet.
The motivation for this is to make it easier to move pieces of the
extensions into the main nanoarrow library that make sense (e.g., the
definitions for the device structs), and eventually eliminate the
extensions folder. I am planning in the next month or so to clean up the
device extension and after that to work on the write component of the
IPC extension. In combination with the testing utilities that were
recently added, I think it makes the most sense for these to live at the
top level and be developed together.
---
CMakeLists.txt | 14 +++++++++++++-
extensions/nanoarrow_device/CMakeLists.txt | 20 ++++++++++----------
2 files changed, 23 insertions(+), 11 deletions(-)
diff --git a/CMakeLists.txt b/CMakeLists.txt
index 00410f39..d5c7d972 100644
--- a/CMakeLists.txt
+++ b/CMakeLists.txt
@@ -32,6 +32,11 @@ set(NANOARROW_VERSION_MAJOR "${nanoarrow_VERSION_MAJOR}")
set(NANOARROW_VERSION_MINOR "${nanoarrow_VERSION_MINOR}")
set(NANOARROW_VERSION_PATCH "${nanoarrow_VERSION_PATCH}")
+# Feature options
+option(NANOARROW_IPC "Build IPC extension" OFF)
+option(NANOARROW_DEVICE "Build device extension" OFF)
+
+# Development options
option(NANOARROW_BUILD_TESTS "Build tests" OFF)
option(NANOARROW_BUILD_BENCHMARKS "Build benchmarks" OFF)
option(NANOARROW_BUILD_INTEGRATION_TESTS
@@ -307,7 +312,14 @@ if(NANOARROW_BUILD_TESTS)
gtest_discover_tests(c_data_integration_test DISCOVERY_TIMEOUT 10)
endif()
-if(NANOARROW_BUILD_BENCHMARKS)
+if(NANOARROW_BUILD_BENCHMARKS OR NANOARROW_IPC)
add_subdirectory(extensions/nanoarrow_ipc)
+endif()
+
+if(NANOARROW_DEVICE)
+ add_subdirectory(extensions/nanoarrow_device)
+endif()
+
+if(NANOARROW_BUILD_BENCHMARKS)
add_subdirectory(dev/benchmarks)
endif()
diff --git a/extensions/nanoarrow_device/CMakeLists.txt
b/extensions/nanoarrow_device/CMakeLists.txt
index 40a102c6..9667303a 100644
--- a/extensions/nanoarrow_device/CMakeLists.txt
+++ b/extensions/nanoarrow_device/CMakeLists.txt
@@ -35,16 +35,16 @@ option(NANOARROW_DEVICE_CODE_COVERAGE "Enable coverage
reporting" OFF)
add_library(device_coverage_config INTERFACE)
if(NANOARROW_DEVICE_BUILD_TESTS OR NOT NANOARROW_DEVICE_BUNDLE)
- # Add the nanoarrow dependency. nanoarrow is not linked into the
- # nanoarrow_device library (the caller must link this themselves);
- # however, we need nanoarrow.h to build nanoarrow_device.c.
- fetchcontent_declare(nanoarrow SOURCE_DIR ${CMAKE_CURRENT_LIST_DIR}/../..)
-
- # Don't install nanoarrow because of this configuration
- fetchcontent_getproperties(nanoarrow)
- if(NOT nanoarrow_POPULATED)
- fetchcontent_populate(nanoarrow)
- add_subdirectory(${nanoarrow_SOURCE_DIR} ${nanoarrow_BINARY_DIR}
EXCLUDE_FROM_ALL)
+ # Lazily add the nanoarrow dependency
+ if(NOT TARGET nanoarrow)
+ fetchcontent_declare(nanoarrow SOURCE_DIR ${CMAKE_CURRENT_LIST_DIR}/../..)
+
+ # Don't install nanoarrow because of this configuration
+ fetchcontent_getproperties(nanoarrow)
+ if(NOT nanoarrow_POPULATED)
+ fetchcontent_populate(nanoarrow)
+ add_subdirectory(${nanoarrow_SOURCE_DIR} ${nanoarrow_BINARY_DIR}
EXCLUDE_FROM_ALL)
+ endif()
endif()
endif()