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
15 changes: 14 additions & 1 deletion .github/workflows/nightly-verify.yml
Original file line number Diff line number Diff line change
Expand Up @@ -201,10 +201,23 @@ jobs:
pushd arrow-adbc
docker compose run --rm cpp-gcc-latest

- name: cpp-shared-no-common-entrypoints-test
run: |
pushd arrow-adbc
docker compose run --rm cpp-shared-no-common-entrypoints-test

- name: cpp-static-test
run: |
pushd arrow-adbc
docker compose run --rm cpp-static-test

- name: python-debug
run: |
# Need to set this or ASAN inside the container gets stuck
# printing a loop of DEADLYSIGNAL
sudo sysctl vm.mmap_rnd_bits=28
pushd arrow-adbc
docker compose run -e PYTHON=3.12 --rm python-debug
docker compose run -e PYTHON=3.13 --rm python-debug

source-verify-docker:
name: "Verify Source (OS)/${{ matrix.os }} ${{ matrix.version }}"
Expand Down
2 changes: 1 addition & 1 deletion .pre-commit-config.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -114,7 +114,7 @@ repos:
name: Ensure CGO adbc.h is syncd
language: script
pass_filenames: true
files: '^c/include/arrow-adbc/.*\.h$'
files: '^c/include/arrow-adbc/[^/]*\.h$'
entry: "./ci/scripts/run_cgo_drivermgr_check.sh"
# https://infra.apache.org/github-actions-policy.html
- id: check-pin
Expand Down
16 changes: 16 additions & 0 deletions c/CMakeLists.txt
Original file line number Diff line number Diff line change
Expand Up @@ -29,6 +29,12 @@ set(CMAKE_CXX_STANDARD_REQUIRED ON)

include(CTest)

set(ADBC_TARGET_COMPILE_DEFINITIONS)
if(NOT ADBC_DEFINE_COMMON_ENTRYPOINTS)
message(STATUS "Defining ADBC_NO_COMMON_ENTRYPOINTS")
set(ADBC_TARGET_COMPILE_DEFINITIONS "ADBC_NO_COMMON_ENTRYPOINTS")
endif()

if(ADBC_WITH_VENDORED_FMT)
add_subdirectory(vendor/fmt EXCLUDE_FROM_ALL)
set_target_properties(fmt PROPERTIES POSITION_INDEPENDENT_CODE ON)
Expand Down Expand Up @@ -58,6 +64,8 @@ if(ADBC_INTEGRATION_DUCKDB)
endif()

if(ADBC_DRIVER_FLIGHTSQL)
install(FILES "${REPOSITORY_ROOT}/c/include/arrow-adbc/driver/flightsql.h"
DESTINATION include/arrow-adbc/driver)
add_subdirectory(driver/flightsql)
endif()

Expand All @@ -69,18 +77,26 @@ if(ADBC_DRIVER_MANAGER)
endif()

if(ADBC_DRIVER_POSTGRESQL)
install(FILES "${REPOSITORY_ROOT}/c/include/arrow-adbc/driver/postgresql.h"
DESTINATION include/arrow-adbc/driver)
add_subdirectory(driver/postgresql)
endif()

if(ADBC_DRIVER_SQLITE)
install(FILES "${REPOSITORY_ROOT}/c/include/arrow-adbc/driver/sqlite.h"
DESTINATION include/arrow-adbc/driver)
add_subdirectory(driver/sqlite)
endif()

if(ADBC_DRIVER_SNOWFLAKE)
install(FILES "${REPOSITORY_ROOT}/c/include/arrow-adbc/driver/snowflake.h"
DESTINATION include/arrow-adbc/driver)
add_subdirectory(driver/snowflake)
endif()

if(ADBC_DRIVER_BIGQUERY)
install(FILES "${REPOSITORY_ROOT}/c/include/arrow-adbc/driver/bigquery.h"
DESTINATION include/arrow-adbc/driver)
add_subdirectory(driver/bigquery)
endif()

Expand Down
34 changes: 1 addition & 33 deletions c/cmake_modules/BuildUtils.cmake
Original file line number Diff line number Diff line change
Expand Up @@ -67,12 +67,6 @@ function(add_thirdparty_lib LIB_NAME LIB_TYPE LIB)
endif()
endfunction()

function(REUSE_PRECOMPILED_HEADER_LIB TARGET_NAME LIB_NAME)
if(ADBC_USE_PRECOMPILED_HEADERS)
target_precompile_headers(${TARGET_NAME} REUSE_FROM ${LIB_NAME})
endif()
endfunction()

function(arrow_install_cmake_package PACKAGE_NAME EXPORT_NAME)
set(CONFIG_CMAKE "${PACKAGE_NAME}Config.cmake")
set(BUILT_CONFIG_CMAKE "${CMAKE_CURRENT_BINARY_DIR}/${CONFIG_CMAKE}")
Expand Down Expand Up @@ -102,11 +96,9 @@ function(ADD_ARROW_LIB LIB_NAME)
BUILD_STATIC
CMAKE_PACKAGE_NAME
PKG_CONFIG_NAME
SHARED_LINK_FLAGS
PRECOMPILED_HEADER_LIB)
SHARED_LINK_FLAGS)
set(multi_value_args
SOURCES
PRECOMPILED_HEADERS
OUTPUTS
STATIC_LINK_LIBS
SHARED_LINK_LIBS
Expand Down Expand Up @@ -172,12 +164,6 @@ function(ADD_ARROW_LIB LIB_NAME)
if(ARG_DEPENDENCIES)
add_dependencies(${LIB_NAME}_objlib ${ARG_DEPENDENCIES})
endif()
if(ARG_PRECOMPILED_HEADER_LIB)
reuse_precompiled_header_lib(${LIB_NAME}_objlib ${ARG_PRECOMPILED_HEADER_LIB})
endif()
if(ARG_PRECOMPILED_HEADERS AND ADBC_USE_PRECOMPILED_HEADERS)
target_precompile_headers(${LIB_NAME}_objlib PRIVATE ${ARG_PRECOMPILED_HEADERS})
endif()
set(LIB_DEPS $<TARGET_OBJECTS:${LIB_NAME}_objlib>)
set(LIB_INCLUDES)
set(EXTRA_DEPS)
Expand Down Expand Up @@ -220,10 +206,6 @@ function(ADD_ARROW_LIB LIB_NAME)
add_dependencies(${LIB_NAME}_shared ${EXTRA_DEPS})
endif()

if(ARG_PRECOMPILED_HEADER_LIB)
reuse_precompiled_header_lib(${LIB_NAME}_shared ${ARG_PRECOMPILED_HEADER_LIB})
endif()

if(ARG_OUTPUTS)
list(APPEND ${ARG_OUTPUTS} ${LIB_NAME}_shared)
endif()
Expand Down Expand Up @@ -318,10 +300,6 @@ function(ADD_ARROW_LIB LIB_NAME)
add_dependencies(${LIB_NAME}_static ${EXTRA_DEPS})
endif()

if(ARG_PRECOMPILED_HEADER_LIB)
reuse_precompiled_header_lib(${LIB_NAME}_static ${ARG_PRECOMPILED_HEADER_LIB})
endif()

if(ARG_OUTPUTS)
list(APPEND ${ARG_OUTPUTS} ${LIB_NAME}_static)
endif()
Expand Down Expand Up @@ -550,10 +528,8 @@ endfunction()
# names must exist
function(ADD_TEST_CASE REL_TEST_NAME)
set(options NO_VALGRIND ENABLED)
set(one_value_args PRECOMPILED_HEADER_LIB)
set(multi_value_args
SOURCES
PRECOMPILED_HEADERS
STATIC_LINK_LIBS
EXTRA_LINK_LIBS
EXTRA_INCLUDES
Expand Down Expand Up @@ -613,14 +589,6 @@ function(ADD_TEST_CASE REL_TEST_NAME)
target_link_libraries(${TEST_NAME} PRIVATE ${ADBC_TEST_LINK_LIBS})
endif()

if(ARG_PRECOMPILED_HEADER_LIB)
reuse_precompiled_header_lib(${TEST_NAME} ${ARG_PRECOMPILED_HEADER_LIB})
endif()

if(ARG_PRECOMPILED_HEADERS AND ADBC_USE_PRECOMPILED_HEADERS)
target_precompile_headers(${TEST_NAME} PRIVATE ${ARG_PRECOMPILED_HEADERS})
endif()

if(ARG_EXTRA_LINK_LIBS)
target_link_libraries(${TEST_NAME} PRIVATE ${ARG_EXTRA_LINK_LIBS})
endif()
Expand Down
27 changes: 5 additions & 22 deletions c/cmake_modules/DefineOptions.cmake
Original file line number Diff line number Diff line change
Expand Up @@ -98,34 +98,13 @@ if("${CMAKE_SOURCE_DIR}" STREQUAL "${CMAKE_CURRENT_SOURCE_DIR}")

define_option(ADBC_BUILD_SHARED "Build shared libraries" ON)

define_option_string(ADBC_PACKAGE_KIND
"Arbitrary string that identifies the kind of package;\
(for informational purposes)" "")

define_option_string(ADBC_GIT_ID "The Arrow git commit id (if any)" "")

define_option_string(ADBC_GIT_DESCRIPTION "The Arrow git commit description (if any)"
"")

define_option(ADBC_NO_DEPRECATED_API "Exclude deprecated APIs from build" OFF)

define_option(ADBC_USE_CCACHE "Use ccache when compiling (if available)" ON)

define_option(ADBC_USE_PRECOMPILED_HEADERS "Use precompiled headers when compiling" OFF)

# Arm64 architectures and extensions can lead to exploding combinations.
# So set it directly through cmake command line.
#
# If you change this, you need to change the definition in
# python/CMakeLists.txt too.
define_option_string(ADBC_ARMV8_ARCH
"Arm64 arch and extensions"
"armv8-a" # Default
"armv8-a"
"armv8-a+crc+crypto")

define_option(ADBC_ALTIVEC "Build with Altivec if compiler has support" ON)

define_option(ADBC_RPATH_ORIGIN "Build Arrow libraries with RATH set to \$ORIGIN" OFF)

define_option(ADBC_INSTALL_NAME_RPATH
Expand Down Expand Up @@ -230,7 +209,11 @@ if("${CMAKE_SOURCE_DIR}" STREQUAL "${CMAKE_CURRENT_SOURCE_DIR}")
#----------------------------------------------------------------------
set_option_category("Advanced developer")

option(ADBC_BUILD_CONFIG_SUMMARY_JSON "Summarize build configuration in a JSON file" ON)
define_option(ADBC_BUILD_CONFIG_SUMMARY_JSON
"Summarize build configuration in a JSON file" ON)

define_option(ADBC_DEFINE_COMMON_ENTRYPOINTS
"Define the Adbc functions in static/shared driver libraries" ON)

#----------------------------------------------------------------------
set_option_category("Project components")
Expand Down
17 changes: 11 additions & 6 deletions c/cmake_modules/GoUtils.cmake
Original file line number Diff line number Diff line change
Expand Up @@ -57,7 +57,7 @@ function(adbc_add_static_library target_name base_name)
PROPERTIES
IMPORTED_LOCATION "${_IMPORT_PREFIX}/bin/${static_base_name}")
else()
set(prefix "${_IMPORT_PREFIX}/${ADBC_IMPORT_LIB_DIR}")
set(prefix "${_IMPORT_PREFIX}/${ADBC_INSTALL_LIBDIR}")
set_target_properties(${target_name}
PROPERTIES
IMPORTED_LOCATION "${prefix}/${static_base_name}")
Expand All @@ -74,7 +74,7 @@ function(add_go_lib GO_MOD_DIR GO_LIBNAME)
PKG_CONFIG_NAME
BUILD_STATIC
BUILD_SHARED)
set(multi_value_args SOURCES OUTPUTS)
set(multi_value_args SOURCES DEFINES OUTPUTS)

cmake_parse_arguments(ARG
"${options}"
Expand Down Expand Up @@ -135,10 +135,15 @@ function(add_go_lib GO_MOD_DIR GO_LIBNAME)
"${GO_BUILD_FLAGS} $<$<CONFIG:DEBUG>:-gcflags=\"-N -l\">")

# if we're building debug mode then change the default CGO_CFLAGS and CGO_CXXFLAGS from "-g O2" to "-g3"
set(GO_ENV_VARS
"CGO_ENABLED=1 $<$<CONFIG:DEBUG>:CGO_CFLAGS=-g3> $<$<CONFIG:DEBUG>:CGO_CXXFLAGS=-g3>"
)
separate_arguments(GO_ENV_VARS NATIVE_COMMAND "${GO_ENV_VARS}")
set(GO_FLAGS "$<$<CONFIG:Debug>:-g3>")
foreach(DEFINE ${ARG_DEFINES})
string(APPEND GO_FLAGS " -D${DEFINE}")
endforeach()

set(GO_ENV_VARS)
list(APPEND GO_ENV_VARS "CGO_ENABLED=1")
list(APPEND GO_ENV_VARS "CGO_CFLAGS=${GO_FLAGS}")
list(APPEND GO_ENV_VARS "CGO_CXXFLAGS=${GO_FLAGS}")

if(BUILD_SHARED)
set(LIB_NAME_SHARED
Expand Down
2 changes: 1 addition & 1 deletion c/driver/bigquery/AdbcDriverBigQueryConfig.cmake.in
Original file line number Diff line number Diff line change
Expand Up @@ -33,7 +33,7 @@ if(ADBC_BUILD_SHARED)
endif()

if(ADBC_BUILD_STATIC)
adbc_add_shared_library(
adbc_add_static_library(
AdbcDriverBigQuery::adbc_driver_bigquery_static
adbc_driver_bigquery)
endif()
Expand Down
2 changes: 2 additions & 0 deletions c/driver/bigquery/CMakeLists.txt
Original file line number Diff line number Diff line change
Expand Up @@ -32,6 +32,8 @@ add_go_lib("${REPOSITORY_ROOT}/go/adbc/pkg/bigquery/"
adbc-driver-bigquery
SHARED_LINK_FLAGS
${LDFLAGS}
DEFINES
${ADBC_TARGET_COMPILE_DEFINITIONS}
OUTPUTS
ADBC_LIBRARIES)

Expand Down
24 changes: 24 additions & 0 deletions c/driver/common/AdbcDriverCommonConfig.cmake.in
Original file line number Diff line number Diff line change
@@ -0,0 +1,24 @@
# Licensed to the Apache Software Foundation (ASF) under one
# or more contributor license agreements. See the NOTICE file
# distributed with this work for additional information
# regarding copyright ownership. The ASF licenses this file
# to you under the Apache License, Version 2.0 (the
# "License"); you may not use this file except in compliance
# with the License. You may obtain a copy of the License at
#
# http://www.apache.org/licenses/LICENSE-2.0
#
# Unless required by applicable law or agreed to in writing,
# software distributed under the License is distributed on an
# "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
# KIND, either express or implied. See the License for the
# specific language governing permissions and limitations
# under the License.

@PACKAGE_INIT@

set(ADBC_VERSION "@ADBC_VERSION@")

include("${CMAKE_CURRENT_LIST_DIR}/AdbcDriverCommonTargets.cmake")

check_required_components(AdbcDriverCommon)
16 changes: 16 additions & 0 deletions c/driver/common/CMakeLists.txt
Original file line number Diff line number Diff line change
Expand Up @@ -21,6 +21,22 @@ set_target_properties(adbc_driver_common PROPERTIES POSITION_INDEPENDENT_CODE ON
target_include_directories(adbc_driver_common PRIVATE "${REPOSITORY_ROOT}/c/include")
target_link_libraries(adbc_driver_common PUBLIC nanoarrow::nanoarrow)

# For static builds, we need to install the static library here so downstream
# applications can link to it
if(ADBC_BUILD_STATIC)
if(ADBC_WITH_VENDORED_NANOARROW)
message(WARNING "adbc_driver_common is not installed when ADBC_WITH_VENDORED_NANOARROW is ON. To use the static libraries, for now you must provide nanoarrow instead of using the vendored copy"

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

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

What is the problem with installing in this case?

Copy link
Copy Markdown
Member

Choose a reason for hiding this comment

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

I am guessing that it would install/require the headers and ADBC should probably not be installing headers for nanoarrow/?

Copy link
Copy Markdown
Member Author

Choose a reason for hiding this comment

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

Yeah, I tried to install Nanoarrow but CMake failed because of something about the header not being installable - decided to punt since to start with I don't think we need to support every possible case.

)
else()
install(TARGETS adbc_driver_common ${INSTALL_IS_OPTIONAL}
EXPORT adbc_driver_common_targets
RUNTIME DESTINATION ${RUNTIME_INSTALL_DIR}
LIBRARY DESTINATION ${CMAKE_INSTALL_LIBDIR}
ARCHIVE DESTINATION ${CMAKE_INSTALL_LIBDIR})
arrow_install_cmake_package(AdbcDriverCommon adbc_driver_common_targets)
endif()
endif()

if(ADBC_BUILD_TESTS)
add_test_case(driver_common_test
PREFIX
Expand Down
Loading
Loading