Skip to content
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
14 changes: 11 additions & 3 deletions c/CMakeLists.txt
Original file line number Diff line number Diff line change
Expand Up @@ -29,9 +29,17 @@ set(CMAKE_CXX_STANDARD_REQUIRED ON)

include(CTest)

add_subdirectory(vendor/fmt EXCLUDE_FROM_ALL)
set_target_properties(fmt PROPERTIES POSITION_INDEPENDENT_CODE ON)
add_subdirectory(vendor/nanoarrow)
if(ADBC_WITH_VENDORED_FMT)
add_subdirectory(vendor/fmt EXCLUDE_FROM_ALL)
set_target_properties(fmt PROPERTIES POSITION_INDEPENDENT_CODE ON)
else()
find_package(fmt REQUIRED)
endif()
if(ADBC_WITH_VENDORED_NANOARROW)
add_subdirectory(vendor/nanoarrow)
else()
find_package(nanoarrow REQUIRED)
endif()
add_subdirectory(driver/common)
add_subdirectory(driver/framework)

Expand Down
4 changes: 4 additions & 0 deletions c/cmake_modules/DefineOptions.cmake
Original file line number Diff line number Diff line change
Expand Up @@ -133,6 +133,10 @@ if("${CMAKE_SOURCE_DIR}" STREQUAL "${CMAKE_CURRENT_SOURCE_DIR}")

define_option(ADBC_GGDB_DEBUG "Pass -ggdb flag to debug builds" ON)

define_option(ADBC_WITH_VENDORED_FMT "Use vendored copy of fmt" ON)

define_option(ADBC_WITH_VENDORED_NANOARROW "Use vendored copy of nanoarrow" ON)

#----------------------------------------------------------------------
set_option_category("Test and benchmark")

Expand Down
6 changes: 1 addition & 5 deletions c/driver/bigquery/CMakeLists.txt
Original file line number Diff line number Diff line change
Expand Up @@ -36,7 +36,6 @@ add_go_lib("${REPOSITORY_ROOT}/go/adbc/pkg/bigquery/"
foreach(LIB_TARGET ${ADBC_LIBRARIES})
target_include_directories(${LIB_TARGET} SYSTEM
INTERFACE ${REPOSITORY_ROOT} ${REPOSITORY_ROOT}/c/
${REPOSITORY_ROOT}/c/vendor
${REPOSITORY_ROOT}/c/driver)
endforeach()

Expand All @@ -57,13 +56,10 @@ if(ADBC_BUILD_TESTS)
EXTRA_LINK_LIBS
adbc_driver_common
adbc_validation
nanoarrow
${TEST_LINK_LIBS})
target_compile_features(adbc-driver-bigquery-test PRIVATE cxx_std_17)
target_include_directories(adbc-driver-bigquery-test SYSTEM
PRIVATE ${REPOSITORY_ROOT}/c/
${REPOSITORY_ROOT}/c/include/
${REPOSITORY_ROOT}/c/vendor
PRIVATE ${REPOSITORY_ROOT}/c/ ${REPOSITORY_ROOT}/c/include/
${REPOSITORY_ROOT}/c/driver
${REPOSITORY_ROOT}/c/driver/common)
adbc_configure_target(adbc-driver-bigquery-test)
Expand Down
10 changes: 4 additions & 6 deletions c/driver/common/CMakeLists.txt
Original file line number Diff line number Diff line change
Expand Up @@ -18,8 +18,8 @@
add_library(adbc_driver_common STATIC utils.c)
adbc_configure_target(adbc_driver_common)
set_target_properties(adbc_driver_common PROPERTIES POSITION_INDEPENDENT_CODE ON)
target_include_directories(adbc_driver_common PRIVATE "${REPOSITORY_ROOT}/c/include"
"${REPOSITORY_ROOT}/c/vendor")
target_include_directories(adbc_driver_common PRIVATE "${REPOSITORY_ROOT}/c/include")
target_link_libraries(adbc_driver_common PUBLIC nanoarrow::nanoarrow)

if(ADBC_BUILD_TESTS)
add_test_case(driver_common_test
Expand All @@ -30,11 +30,9 @@ if(ADBC_BUILD_TESTS)
SOURCES
utils_test.cc
EXTRA_LINK_LIBS
adbc_driver_common
nanoarrow)
adbc_driver_common)
target_compile_features(adbc-driver-common-test PRIVATE cxx_std_17)
target_include_directories(adbc-driver-common-test
PRIVATE "${REPOSITORY_ROOT}/c/include"
"${REPOSITORY_ROOT}/c/vendor")
PRIVATE "${REPOSITORY_ROOT}/c/include")
adbc_configure_target(adbc-driver-common-test)
endif()
3 changes: 0 additions & 3 deletions c/driver/flightsql/CMakeLists.txt
Original file line number Diff line number Diff line change
Expand Up @@ -37,7 +37,6 @@ foreach(LIB_TARGET ${ADBC_LIBRARIES})
target_include_directories(${LIB_TARGET} SYSTEM
INTERFACE ${REPOSITORY_ROOT}/c/
${REPOSITORY_ROOT}/c/include/
${REPOSITORY_ROOT}/c/vendor
${REPOSITORY_ROOT}/c/driver)
endforeach()

Expand All @@ -59,12 +58,10 @@ if(ADBC_BUILD_TESTS)
EXTRA_LINK_LIBS
adbc_driver_common
adbc_validation
nanoarrow
${TEST_LINK_LIBS})
target_compile_features(adbc-driver-flightsql-test PRIVATE cxx_std_17)
target_include_directories(adbc-driver-flightsql-test SYSTEM
PRIVATE ${REPOSITORY_ROOT}/c/ ${REPOSITORY_ROOT}/c/include/
${REPOSITORY_ROOT}/c/vendor
${REPOSITORY_ROOT}/c/driver)
adbc_configure_target(adbc-driver-flightsql-test)
endif()
3 changes: 1 addition & 2 deletions c/driver/framework/CMakeLists.txt
Original file line number Diff line number Diff line change
Expand Up @@ -34,8 +34,7 @@ if(ADBC_BUILD_TESTS)
SOURCES
base_driver_test.cc
EXTRA_LINK_LIBS
adbc_driver_framework
nanoarrow)
adbc_driver_framework)
target_compile_features(adbc-driver-framework-test PRIVATE cxx_std_17)
target_include_directories(adbc-driver-framework-test
PRIVATE "${REPOSITORY_ROOT}/c/"
Expand Down
27 changes: 6 additions & 21 deletions c/driver/postgresql/CMakeLists.txt
Original file line number Diff line number Diff line change
Expand Up @@ -46,23 +46,18 @@ add_arrow_lib(adbc_driver_postgresql
SHARED_LINK_LIBS
adbc_driver_common
adbc_driver_framework
nanoarrow
${LIBPQ_LINK_LIBRARIES}
STATIC_LINK_LIBS
${LIBPQ_LINK_LIBRARIES}
adbc_driver_common
adbc_driver_framework
nanoarrow
${LIBPQ_STATIC_LIBRARIES})

foreach(LIB_TARGET ${ADBC_LIBRARIES})
target_compile_definitions(${LIB_TARGET} PRIVATE ADBC_EXPORTING)
target_include_directories(${LIB_TARGET} SYSTEM
PRIVATE ${REPOSITORY_ROOT}/c/
${REPOSITORY_ROOT}/c/include/
${LIBPQ_INCLUDE_DIRS}
${REPOSITORY_ROOT}/c/vendor
${REPOSITORY_ROOT}/c/driver)
PRIVATE ${REPOSITORY_ROOT}/c/ ${REPOSITORY_ROOT}/c/include/
${LIBPQ_INCLUDE_DIRS} ${REPOSITORY_ROOT}/c/driver)
endforeach()

if(ADBC_TEST_LINKAGE STREQUAL "shared")
Expand All @@ -83,15 +78,11 @@ if(ADBC_BUILD_TESTS)
EXTRA_LINK_LIBS
adbc_driver_common
adbc_validation
nanoarrow
${TEST_LINK_LIBS})
target_compile_features(adbc-driver-postgresql-test PRIVATE cxx_std_17)
target_include_directories(adbc-driver-postgresql-test SYSTEM
PRIVATE ${REPOSITORY_ROOT}/c/
${REPOSITORY_ROOT}/c/include/
${LIBPQ_INCLUDE_DIRS}
${REPOSITORY_ROOT}/c/vendor
${REPOSITORY_ROOT}/c/driver)
PRIVATE ${REPOSITORY_ROOT}/c/ ${REPOSITORY_ROOT}/c/include/
${LIBPQ_INCLUDE_DIRS} ${REPOSITORY_ROOT}/c/driver)
adbc_configure_target(adbc-driver-postgresql-test)

add_test_case(driver_postgresql_copy_test
Expand All @@ -105,15 +96,11 @@ if(ADBC_BUILD_TESTS)
EXTRA_LINK_LIBS
adbc_driver_common
adbc_validation
nanoarrow
${TEST_LINK_LIBS})
target_compile_features(adbc-driver-postgresql-copy-test PRIVATE cxx_std_17)
target_include_directories(adbc-driver-postgresql-copy-test SYSTEM
PRIVATE ${REPOSITORY_ROOT}/c/
${REPOSITORY_ROOT}/c/include/
${LIBPQ_INCLUDE_DIRS}
${REPOSITORY_ROOT}/c/vendor
${REPOSITORY_ROOT}/c/driver)
PRIVATE ${REPOSITORY_ROOT}/c/ ${REPOSITORY_ROOT}/c/include/
${LIBPQ_INCLUDE_DIRS} ${REPOSITORY_ROOT}/c/driver)
adbc_configure_target(adbc-driver-postgresql-copy-test)
endif()

Expand All @@ -124,12 +111,10 @@ if(ADBC_BUILD_BENCHMARKS)
EXTRA_LINK_LIBS
adbc_driver_common
adbc_validation
nanoarrow
${TEST_LINK_LIBS}
benchmark::benchmark)
# add_benchmark replaces _ with - when creating target
target_include_directories(postgresql-benchmark
PRIVATE ${REPOSITORY_ROOT}/c/ ${REPOSITORY_ROOT}/c/include/
${REPOSITORY_ROOT}/c/vendor
${REPOSITORY_ROOT}/c/driver)
endif()
5 changes: 1 addition & 4 deletions c/driver/snowflake/CMakeLists.txt
Original file line number Diff line number Diff line change
Expand Up @@ -37,7 +37,6 @@ foreach(LIB_TARGET ${ADBC_LIBRARIES})
target_include_directories(${LIB_TARGET} SYSTEM
INTERFACE ${REPOSITORY_ROOT}/c/
${REPOSITORY_ROOT}/c/include/
${REPOSITORY_ROOT}/c/vendor
${REPOSITORY_ROOT}/c/driver)
endforeach()

Expand All @@ -62,9 +61,7 @@ if(ADBC_BUILD_TESTS)
${TEST_LINK_LIBS})
target_compile_features(adbc-driver-snowflake-test PRIVATE cxx_std_17)
target_include_directories(adbc-driver-snowflake-test SYSTEM
PRIVATE ${REPOSITORY_ROOT}/c/
${REPOSITORY_ROOT}/c/include/
${REPOSITORY_ROOT}/c/vendor
PRIVATE ${REPOSITORY_ROOT}/c/ ${REPOSITORY_ROOT}/c/include/
${REPOSITORY_ROOT}/c/driver
${REPOSITORY_ROOT}/c/driver/common)
adbc_configure_target(adbc-driver-snowflake-test)
Expand Down
17 changes: 4 additions & 13 deletions c/driver/sqlite/CMakeLists.txt
Original file line number Diff line number Diff line change
Expand Up @@ -52,23 +52,18 @@ add_arrow_lib(adbc_driver_sqlite
${SQLite3_LINK_LIBRARIES}
adbc_driver_common
adbc_driver_framework
nanoarrow
STATIC_LINK_LIBS
${SQLite3_LINK_LIBRARIES}
adbc_driver_common
adbc_driver_framework
nanoarrow
${LIBPQ_STATIC_LIBRARIES})

foreach(LIB_TARGET ${ADBC_LIBRARIES})
target_compile_definitions(${LIB_TARGET} PRIVATE ADBC_EXPORTING
${ADBC_SQLITE_COMPILE_DEFINES})
target_include_directories(${LIB_TARGET} SYSTEM
PRIVATE ${REPOSITORY_ROOT}/c/
${REPOSITORY_ROOT}/c/include/
${SQLite3_INCLUDE_DIRS}
${REPOSITORY_ROOT}/c/vendor
${REPOSITORY_ROOT}/c/driver)
PRIVATE ${REPOSITORY_ROOT}/c/ ${REPOSITORY_ROOT}/c/include/
${SQLite3_INCLUDE_DIRS} ${REPOSITORY_ROOT}/c/driver)
endforeach()

include(CheckTypeSize)
Expand All @@ -92,16 +87,12 @@ if(ADBC_BUILD_TESTS)
EXTRA_LINK_LIBS
adbc_driver_common
adbc_validation
nanoarrow
${TEST_LINK_LIBS})
target_compile_definitions(adbc-driver-sqlite-test
PRIVATE ${ADBC_SQLITE_COMPILE_DEFINES})
target_compile_features(adbc-driver-sqlite-test PRIVATE cxx_std_17)
target_include_directories(adbc-driver-sqlite-test SYSTEM
PRIVATE ${REPOSITORY_ROOT}/c/
${REPOSITORY_ROOT}/c/include/
${LIBPQ_INCLUDE_DIRS}
${REPOSITORY_ROOT}/c/vendor
${REPOSITORY_ROOT}/c/driver)
PRIVATE ${REPOSITORY_ROOT}/c/ ${REPOSITORY_ROOT}/c/include/
${LIBPQ_INCLUDE_DIRS} ${REPOSITORY_ROOT}/c/driver)
adbc_configure_target(adbc-driver-sqlite-test)
endif()
6 changes: 0 additions & 6 deletions c/driver_manager/CMakeLists.txt
Original file line number Diff line number Diff line change
Expand Up @@ -60,11 +60,8 @@ if(ADBC_BUILD_TESTS)
EXTRA_LINK_LIBS
adbc_driver_common
adbc_validation
nanoarrow
${TEST_LINK_LIBS})
target_compile_features(adbc-driver-manager-test PRIVATE cxx_std_17)
target_include_directories(adbc-driver-manager-test SYSTEM
PRIVATE ${REPOSITORY_ROOT}/c/vendor/nanoarrow/)

add_test_case(version_100_compatibility_test
PREFIX
Expand All @@ -76,9 +73,6 @@ if(ADBC_BUILD_TESTS)
adbc_version_100_compatibility_test.cc
EXTRA_LINK_LIBS
adbc_validation_util
nanoarrow
${TEST_LINK_LIBS})
target_compile_features(adbc-version-100-compatibility-test PRIVATE cxx_std_17)
target_include_directories(adbc-version-100-compatibility-test SYSTEM
PRIVATE ${REPOSITORY_ROOT}/c/vendor/nanoarrow/)
endif()
4 changes: 1 addition & 3 deletions c/integration/duckdb/CMakeLists.txt
Original file line number Diff line number Diff line change
Expand Up @@ -63,13 +63,11 @@ if(ADBC_BUILD_TESTS)
adbc_driver_common
adbc_driver_manager_static
adbc_validation
duckdb
nanoarrow)
duckdb)
add_dependencies(adbc-integration-duckdb-test duckdb)
target_compile_features(adbc-integration-duckdb-test PRIVATE cxx_std_17)
target_include_directories(adbc-integration-duckdb-test SYSTEM
PRIVATE ${REPOSITORY_ROOT}/c/ ${REPOSITORY_ROOT}/c/include/
${REPOSITORY_ROOT}/c/vendor
${REPOSITORY_ROOT}/c/driver)
adbc_configure_target(adbc-integration-duckdb-test)
endif()
21 changes: 7 additions & 14 deletions c/validation/CMakeLists.txt
Original file line number Diff line number Diff line change
Expand Up @@ -20,23 +20,16 @@ adbc_configure_target(adbc_validation_util)
target_compile_features(adbc_validation_util PRIVATE cxx_std_17)
target_include_directories(adbc_validation_util SYSTEM
PRIVATE "${REPOSITORY_ROOT}/c/include/"
"${REPOSITORY_ROOT}/c/driver/"
"${REPOSITORY_ROOT}/c/vendor/")
target_link_libraries(adbc_validation_util PUBLIC adbc_driver_common nanoarrow
GTest::gtest GTest::gmock)
"${REPOSITORY_ROOT}/c/driver/")
target_link_libraries(adbc_validation_util PUBLIC adbc_driver_common GTest::gtest
GTest::gmock)

add_library(adbc_validation OBJECT
adbc_validation.cc adbc_validation_connection.cc adbc_validation_database.cc
adbc_validation_statement.cc)
adbc_configure_target(adbc_validation)
target_compile_features(adbc_validation PRIVATE cxx_std_17)
target_include_directories(adbc_validation SYSTEM
PRIVATE "${REPOSITORY_ROOT}/c/include/"
"${REPOSITORY_ROOT}/c/driver/"
"${REPOSITORY_ROOT}/c/vendor/")
target_link_libraries(adbc_validation
PUBLIC adbc_driver_common
adbc_validation_util
nanoarrow
GTest::gtest
GTest::gmock)
target_include_directories(adbc_validation SYSTEM PRIVATE "${REPOSITORY_ROOT}/c/include/"
"${REPOSITORY_ROOT}/c/driver/")
target_link_libraries(adbc_validation PUBLIC adbc_driver_common adbc_validation_util
GTest::gtest GTest::gmock)
2 changes: 2 additions & 0 deletions c/vendor/nanoarrow/CMakeLists.txt
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

@paleolimbot seems we should upstream this change?

Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I think this CMakeLists.txt lives in ADBC...is the suggestion that nanoarrow should include a CMakeLists.txt with the bundled nanoarrow.c/h? It may also be time to just use CMake install or build-time dependency for nanoarrow (since our existing CMakeLists.txt now supports that and is tested against a number of scenarios).

Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Ah, sorry, I see then.

Original file line number Diff line number Diff line change
Expand Up @@ -21,6 +21,8 @@ add_library(
nanoarrow.c
)

target_include_directories(nanoarrow PUBLIC "${CMAKE_CURRENT_LIST_DIR}/..")
set_target_properties(
nanoarrow PROPERTIES POSITION_INDEPENDENT_CODE ON
)
add_library(nanoarrow::nanoarrow ALIAS nanoarrow)
Loading