You are viewing a plain text version of this content. The canonical link for it is here.
Posted to commits@arrow.apache.org by li...@apache.org on 2023/04/25 10:27:28 UTC
[arrow-adbc] branch main updated: refactor(c): merge CMake projects (#597)
This is an automated email from the ASF dual-hosted git repository.
lidavidm pushed a commit to branch main
in repository https://gitbox.apache.org/repos/asf/arrow-adbc.git
The following commit(s) were added to refs/heads/main by this push:
new cca156b refactor(c): merge CMake projects (#597)
cca156b is described below
commit cca156b1dff30b441869f46689714d0b8de89dbc
Author: William Ayd <wi...@icloud.com>
AuthorDate: Tue Apr 25 03:27:23 2023 -0700
refactor(c): merge CMake projects (#597)
This is a redo of #314.
Part of #92.
---
CONTRIBUTING.md | 23 +++++----
ci/build_support/run-test.sh => c/CMakeLists.txt | 36 +++++++++++---
c/cmake_modules/AdbcDefines.cmake | 19 -------
c/cmake_modules/BuildUtils.cmake | 9 +---
.../run-test.sh => c/driver/common/CMakeLists.txt | 13 ++---
c/driver/flightsql/CMakeLists.txt | 11 +---
c/driver/postgresql/CMakeLists.txt | 15 ++----
c/driver/sqlite/CMakeLists.txt | 14 ++----
c/driver_manager/CMakeLists.txt | 15 ++----
.../vendor/nanoarrow/CMakeLists.txt | 16 +++---
ci/conda/build-cpp.sh | 18 ++++---
ci/linux-packages/debian/rules | 58 +++++-----------------
ci/linux-packages/yum/apache-arrow-adbc.spec.in | 47 ++++--------------
ci/scripts/cpp_build.ps1 | 26 +++-------
ci/scripts/cpp_build.sh | 27 +++-------
ci/scripts/cpp_test.ps1 | 20 +-------
ci/scripts/cpp_test.sh | 25 ++--------
ci/scripts/python_util.sh | 48 ++++--------------
ci/scripts/python_wheel_windows_build.bat | 28 +++--------
19 files changed, 134 insertions(+), 334 deletions(-)
diff --git a/CONTRIBUTING.md b/CONTRIBUTING.md
index 0e80e1d..59b06e5 100644
--- a/CONTRIBUTING.md
+++ b/CONTRIBUTING.md
@@ -28,24 +28,27 @@ https://github.com/apache/arrow-adbc/issues
### C/C++
-The libraries here are all **individual** CMake projects.
+All libraries here contained within one CMake project. To build any
+library, pass the `-DADBC_COMPONENT=ON` flag to your cmake invocation,
+replacing `_COMPONENT` with the name of the library/libraries.
_Note:_ unlike the Arrow C++ build system, the CMake projects will
**not** automatically download and build dependencies—you should
configure CMake appropriately to find dependencies in system or
package manager locations.
-For example, the driver manager is built as follows:
+For example, the driver manager and postgres driver may be built
+together as follows:
```shell
-$ mkdir -p build/driver_manager
-$ cd build/driver_manager
-$ cmake ../../c/driver_manager
+$ mkdir build
+$ cd build
+$ cmake ../c -DADBC_DRIVER_POSTGRESQL=ON -DADBC_DRIVER_MANAGER=ON
$ make -j
```
-All libraries here can be built similarly. For information on what
-they do and their dependencies, see their individual READMEs.
+For information on what each library can do and their dependencies,
+see their individual READMEs.
To specify where dependencies are to the build, use standard CMake
options such as [`CMAKE_PREFIX_PATH`][cmake-prefix-path]. A list of
@@ -69,10 +72,10 @@ All libraries use the same build options to enable tests.
For example, to build and run tests for the SQLite3 driver:
```shell
-$ mkdir -p build/sqlite
-$ cd build/sqlite
+$ mkdir build
+$ cd build
# You may need to set -DCMAKE_PREFIX_PATH such that googletest can be found
-$ cmake ../../c/driver/sqlite -DADBC_BUILD_TESTS=ON
+$ cmake ../c -DADBC_BUILD_TESTS=ON -DADBC_DRIVER_SQLITE=ON
$ make -j
$ ctest
```
diff --git a/ci/build_support/run-test.sh b/c/CMakeLists.txt
old mode 100755
new mode 100644
similarity index 55%
copy from ci/build_support/run-test.sh
copy to c/CMakeLists.txt
index 1de7e73..b38b3cf
--- a/ci/build_support/run-test.sh
+++ b/c/CMakeLists.txt
@@ -1,4 +1,3 @@
-#!/usr/bin/env bash
# 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
@@ -16,11 +15,32 @@
# specific language governing permissions and limitations
# under the License.
-main() {
- local CMAKE_BINARY_DIR="$1"
- local TEST_OR_BENCHMARK="$2"
- local TEST_PATH="$3"
- exec "${CMAKE_BINARY_DIR}/${TEST_PATH}"
-}
+cmake_minimum_required(VERSION 3.18)
+get_filename_component(REPOSITORY_ROOT ".." ABSOLUTE)
+list(APPEND CMAKE_MODULE_PATH "${REPOSITORY_ROOT}/c/cmake_modules/")
+include(AdbcDefines)
+include(BuildUtils)
+project(adbc
+ VERSION "${ADBC_BASE_VERSION}"
+ LANGUAGES C CXX)
-main "$@"
+include(CTest)
+
+add_subdirectory(vendor/nanoarrow)
+add_subdirectory(driver/common)
+
+if(ADBC_DRIVER_FLIGHTSQL)
+ add_subdirectory(driver/flightsql)
+endif()
+
+if(ADBC_DRIVER_MANAGER)
+ add_subdirectory(driver_manager)
+endif()
+
+if(ADBC_DRIVER_POSTGRESQL)
+ add_subdirectory(driver/postgresql)
+endif()
+
+if(ADBC_DRIVER_SQLITE)
+ add_subdirectory(driver/sqlite)
+endif()
diff --git a/c/cmake_modules/AdbcDefines.cmake b/c/cmake_modules/AdbcDefines.cmake
index 9d15e99..6ff186d 100644
--- a/c/cmake_modules/AdbcDefines.cmake
+++ b/c/cmake_modules/AdbcDefines.cmake
@@ -59,25 +59,6 @@ if(CXX_LINKER_SUPPORTS_VERSION_SCRIPT)
list(APPEND ADBC_LINK_FLAGS ${ADBC_VERSION_SCRIPT_LINK_FLAG})
endif()
-# Nanoarrow definition
-add_library(nanoarrow STATIC EXCLUDE_FROM_ALL
- ${REPOSITORY_ROOT}/c/vendor/nanoarrow/nanoarrow.c)
-set_target_properties(nanoarrow
- PROPERTIES INTERFACE_INCLUDE_DIRECTORIES
- "${REPOSITORY_ROOT}/c/vendor/"
- INTERFACE_SYSTEM_INCLUDE_DIRECTORIES
- "${REPOSITORY_ROOT}/c/vendor/"
- POSITION_INDEPENDENT_CODE ON)
-
-# ADBC libraries shared across multiple drivers
-add_library(adbc_driver_common STATIC EXCLUDE_FROM_ALL
- ${REPOSITORY_ROOT}/c/driver/common/utils.c)
-set_target_properties(adbc_driver_common
- PROPERTIES INTERFACE_INCLUDE_DIRECTORIES
- "${REPOSITORY_ROOT}/c/driver/common"
- POSITION_INDEPENDENT_CODE ON)
-target_link_libraries(adbc_driver_common nanoarrow)
-
# Set common build options
macro(adbc_configure_target TARGET)
if(CMAKE_CXX_COMPILER_ID STREQUAL "GNU")
diff --git a/c/cmake_modules/BuildUtils.cmake b/c/cmake_modules/BuildUtils.cmake
index 8d80ba4..df2590a 100644
--- a/c/cmake_modules/BuildUtils.cmake
+++ b/c/cmake_modules/BuildUtils.cmake
@@ -633,15 +633,8 @@ function(ADD_TEST_CASE REL_TEST_NAME)
valgrind --suppressions=valgrind.supp --tool=memcheck --gen-suppressions=all \
--num-callers=500 --leak-check=full --leak-check-heuristics=stdstring \
--error-exitcode=1 ${TEST_PATH} ${ARG_TEST_ARGUMENTS}")
- elseif(WIN32)
- add_test(${TEST_NAME} ${TEST_PATH} ${ARG_TEST_ARGUMENTS})
else()
- add_test(${TEST_NAME}
- ${BUILD_SUPPORT_DIR}/run-test.sh
- ${CMAKE_BINARY_DIR}
- test
- ${TEST_PATH}
- ${ARG_TEST_ARGUMENTS})
+ add_test(${TEST_NAME} ${TEST_PATH} ${ARG_TEST_ARGUMENTS})
endif()
adbc_configure_target(${TEST_NAME})
diff --git a/ci/build_support/run-test.sh b/c/driver/common/CMakeLists.txt
old mode 100755
new mode 100644
similarity index 77%
copy from ci/build_support/run-test.sh
copy to c/driver/common/CMakeLists.txt
index 1de7e73..6a9cd54
--- a/ci/build_support/run-test.sh
+++ b/c/driver/common/CMakeLists.txt
@@ -1,4 +1,3 @@
-#!/usr/bin/env bash
# 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
@@ -16,11 +15,7 @@
# specific language governing permissions and limitations
# under the License.
-main() {
- local CMAKE_BINARY_DIR="$1"
- local TEST_OR_BENCHMARK="$2"
- local TEST_PATH="$3"
- exec "${CMAKE_BINARY_DIR}/${TEST_PATH}"
-}
-
-main "$@"
+add_library(adbc_driver_common STATIC utils.c)
+set_target_properties(adbc_driver_common PROPERTIES POSITION_INDEPENDENT_CODE ON)
+include_directories(SYSTEM ${REPOSITORY_ROOT})
+include_directories(SYSTEM ${REPOSITORY_ROOT}/c/vendor)
diff --git a/c/driver/flightsql/CMakeLists.txt b/c/driver/flightsql/CMakeLists.txt
index f882e3f..1b13024 100644
--- a/c/driver/flightsql/CMakeLists.txt
+++ b/c/driver/flightsql/CMakeLists.txt
@@ -15,18 +15,8 @@
# specific language governing permissions and limitations
# under the License.
-cmake_minimum_required(VERSION 3.18)
-get_filename_component(REPOSITORY_ROOT "../../../" ABSOLUTE)
-list(APPEND CMAKE_MODULE_PATH "${REPOSITORY_ROOT}/c/cmake_modules/")
-include(AdbcDefines)
-include(BuildUtils)
include(GoUtils)
-project(adbc_driver_flightsql
- VERSION "${ADBC_BASE_VERSION}"
- LANGUAGES C CXX)
-include(CTest)
-
set(LDFLAGS "$<$<CONFIG:Release>:-s> $<$<CONFIG:Release>:-w>")
add_go_lib("${REPOSITORY_ROOT}/go/adbc/pkg/flightsql/"
adbc_driver_flightsql
@@ -43,6 +33,7 @@ add_go_lib("${REPOSITORY_ROOT}/go/adbc/pkg/flightsql/"
include_directories(SYSTEM ${REPOSITORY_ROOT})
include_directories(SYSTEM ${REPOSITORY_ROOT}/c/)
+include_directories(SYSTEM ${REPOSITORY_ROOT}/c/vendor)
if(ADBC_TEST_LINKAGE STREQUAL "shared")
set(TEST_LINK_LIBS adbc_driver_flightsql_shared)
diff --git a/c/driver/postgresql/CMakeLists.txt b/c/driver/postgresql/CMakeLists.txt
index e14ea20..6165f0f 100644
--- a/c/driver/postgresql/CMakeLists.txt
+++ b/c/driver/postgresql/CMakeLists.txt
@@ -15,17 +15,6 @@
# specific language governing permissions and limitations
# under the License.
-cmake_minimum_required(VERSION 3.18)
-get_filename_component(REPOSITORY_ROOT "../../../" ABSOLUTE)
-list(APPEND CMAKE_MODULE_PATH "${REPOSITORY_ROOT}/c/cmake_modules/")
-include(AdbcDefines)
-include(BuildUtils)
-
-project(adbc_driver_postgresql
- VERSION "${ADBC_BASE_VERSION}"
- LANGUAGES CXX)
-include(CTest)
-
if(WIN32)
# XXX: for now, assume vcpkg
find_package(PostgreSQL REQUIRED)
@@ -52,8 +41,8 @@ add_arrow_lib(adbc_driver_postgresql
SHARED_LINK_FLAGS
${ADBC_LINK_FLAGS}
SHARED_LINK_LIBS
- ${LIBPQ_LINK_LIBRARIES}
nanoarrow
+ ${LIBPQ_LINK_LIBRARIES}
STATIC_LINK_LIBS
${LIBPQ_LINK_LIBRARIES}
nanoarrow
@@ -61,6 +50,8 @@ add_arrow_lib(adbc_driver_postgresql
include_directories(SYSTEM ${REPOSITORY_ROOT})
include_directories(SYSTEM ${REPOSITORY_ROOT}/c/)
include_directories(SYSTEM ${LIBPQ_INCLUDE_DIRS})
+include_directories(SYSTEM ${REPOSITORY_ROOT}/c/vendor)
+
foreach(LIB_TARGET ${ADBC_LIBRARIES})
target_compile_definitions(${LIB_TARGET} PRIVATE ADBC_EXPORTING)
endforeach()
diff --git a/c/driver/sqlite/CMakeLists.txt b/c/driver/sqlite/CMakeLists.txt
index f0b5b38..f5ee32c 100644
--- a/c/driver/sqlite/CMakeLists.txt
+++ b/c/driver/sqlite/CMakeLists.txt
@@ -15,17 +15,6 @@
# specific language governing permissions and limitations
# under the License.
-cmake_minimum_required(VERSION 3.18)
-get_filename_component(REPOSITORY_ROOT "../../../" ABSOLUTE)
-list(APPEND CMAKE_MODULE_PATH "${REPOSITORY_ROOT}/c/cmake_modules/")
-include(AdbcDefines)
-include(BuildUtils)
-
-project(adbc_driver_sqlite
- VERSION "${ADBC_BASE_VERSION}"
- LANGUAGES CXX)
-include(CTest)
-
find_package(SQLite3)
if(SQLite3_FOUND)
set(SQLite3_LINK_LIBRARIES SQLite::SQLite3)
@@ -59,7 +48,10 @@ add_arrow_lib(adbc_driver_sqlite
${LIBPQ_STATIC_LIBRARIES})
include_directories(SYSTEM ${REPOSITORY_ROOT})
include_directories(SYSTEM ${REPOSITORY_ROOT}/c/)
+include_directories(SYSTEM ${REPOSITORY_ROOT}/c/vendor)
+include_directories(SYSTEM ${REPOSITORY_ROOT}/c/driver/common)
include_directories(SYSTEM ${SQLite3_INCLUDE_DIRS})
+
foreach(LIB_TARGET ${ADBC_LIBRARIES})
target_compile_definitions(${LIB_TARGET} PRIVATE ADBC_EXPORTING)
endforeach()
diff --git a/c/driver_manager/CMakeLists.txt b/c/driver_manager/CMakeLists.txt
index 68414dd..bdeb69d 100644
--- a/c/driver_manager/CMakeLists.txt
+++ b/c/driver_manager/CMakeLists.txt
@@ -15,18 +15,6 @@
# specific language governing permissions and limitations
# under the License.
-cmake_minimum_required(VERSION 3.18)
-get_filename_component(REPOSITORY_ROOT "../.." ABSOLUTE)
-message(STATUS "${REPOSITORY_ROOT}")
-list(APPEND CMAKE_MODULE_PATH "${REPOSITORY_ROOT}/c/cmake_modules/")
-include(AdbcDefines)
-include(BuildUtils)
-
-project(adbc_driver_manager
- VERSION "${ADBC_BASE_VERSION}"
- LANGUAGES CXX)
-include(CTest)
-
add_arrow_lib(adbc_driver_manager
SOURCES
adbc_driver_manager.cc
@@ -44,6 +32,9 @@ add_arrow_lib(adbc_driver_manager
${ADBC_LINK_FLAGS})
include_directories(SYSTEM ${REPOSITORY_ROOT})
include_directories(SYSTEM ${REPOSITORY_ROOT}/c/)
+include_directories(SYSTEM ${REPOSITORY_ROOT}/c/vendor)
+include_directories(SYSTEM ${REPOSITORY_ROOT}/c/driver/common)
+
foreach(LIB_TARGET ${ADBC_LIBRARIES})
target_compile_definitions(${LIB_TARGET} PRIVATE ADBC_EXPORTING)
endforeach()
diff --git a/ci/build_support/run-test.sh b/c/vendor/nanoarrow/CMakeLists.txt
old mode 100755
new mode 100644
similarity index 82%
rename from ci/build_support/run-test.sh
rename to c/vendor/nanoarrow/CMakeLists.txt
index 1de7e73..233f999
--- a/ci/build_support/run-test.sh
+++ b/c/vendor/nanoarrow/CMakeLists.txt
@@ -1,4 +1,3 @@
-#!/usr/bin/env bash
# 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
@@ -16,11 +15,12 @@
# specific language governing permissions and limitations
# under the License.
-main() {
- local CMAKE_BINARY_DIR="$1"
- local TEST_OR_BENCHMARK="$2"
- local TEST_PATH="$3"
- exec "${CMAKE_BINARY_DIR}/${TEST_PATH}"
-}
+add_library(
+ nanoarrow
+ STATIC
+ nanoarrow.c
+)
-main "$@"
+set_target_properties(
+ nanoarrow PROPERTIES POSITION_INDEPENDENT_CODE ON
+)
diff --git a/ci/conda/build-cpp.sh b/ci/conda/build-cpp.sh
index 7828f37..42cb691 100644
--- a/ci/conda/build-cpp.sh
+++ b/ci/conda/build-cpp.sh
@@ -20,17 +20,17 @@ set -ex
case "${PKG_NAME}" in
adbc-driver-manager-cpp)
- export PKG_ROOT=c/driver_manager
+ export BUILD_MANAGER=ON
;;
adbc-driver-flightsql-go)
export CGO_ENABLED=1
- export PKG_ROOT=c/driver/flightsql
+ export BUILD_FLIGHTSQL=ON
;;
adbc-driver-postgresql-cpp)
- export PKG_ROOT=c/driver/postgresql
+ export BUILD_POSTGRESQL=ON
;;
adbc-driver-sqlite-cpp)
- export PKG_ROOT=c/driver/sqlite
+ export BUILD_SQLITE=ON
;;
*)
echo "Unknown package ${PKG_NAME}"
@@ -47,14 +47,18 @@ else
export GOARCH="amd64"
fi
-mkdir -p "build-cpp/${PKG_NAME}"
-pushd "build-cpp/${PKG_NAME}"
+mkdir -p "build-${PKG_NAME}/"
+pushd "build-${PKG_NAME}/"
-cmake "../../${PKG_ROOT}" \
+cmake "../c" \
-G Ninja \
-DADBC_BUILD_SHARED=ON \
-DADBC_BUILD_STATIC=OFF \
-DCMAKE_INSTALL_PREFIX="${PREFIX}" \
+ ${BUILD_MANAGER:+-DADBC_DRIVER_MANAGER="$BUILD_MANAGER"} \
+ ${BUILD_FLIGHTSQL:+-DADBC_DRIVER_FLIGHTSQL="$BUILD_FLIGHTSQL" } \
+ ${BUILD_POSTGRESQL:+-DADBC_DRIVER_POSTGRESQL="$BUILD_POSTGRESQL"} \
+ ${BUILD_SQLITE:+-DADBC_DRIVER_SQLITE="$BUILD_SQLITE"} \
-DCMAKE_PREFIX_PATH="${PREFIX}"
cmake --build . --target install -j
diff --git a/ci/linux-packages/debian/rules b/ci/linux-packages/debian/rules
index 029d689..5f3d137 100755
--- a/ci/linux-packages/debian/rules
+++ b/ci/linux-packages/debian/rules
@@ -32,52 +32,29 @@ CMAKE_BUILD_TYPE = RelWithDebInfo
override_dh_auto_configure:
dh_auto_configure \
- --sourcedirectory=c/driver_manager \
- --builddirectory=c/driver_manager.build \
+ --sourcedirectory=c/ \
+ --builddirectory=c.build \
--buildsystem=cmake+ninja \
-- \
- -DCMAKE_BUILD_TYPE=$(CMAKE_BUILD_TYPE)
- dh_auto_configure \
- --sourcedirectory=c/driver/postgresql \
- --builddirectory=c/driver/postgresql.build \
- --buildsystem=cmake+ninja \
- -- \
- -DCMAKE_BUILD_TYPE=$(CMAKE_BUILD_TYPE)
- dh_auto_configure \
- --sourcedirectory=c/driver/sqlite \
- --builddirectory=c/driver/sqlite.build \
- --buildsystem=cmake+ninja \
- -- \
- -DCMAKE_BUILD_TYPE=$(CMAKE_BUILD_TYPE)
- dh_auto_configure \
- --sourcedirectory=c/driver/flightsql \
- --builddirectory=c/driver/flightsql.build \
- --buildsystem=cmake+ninja \
- -- \
- -DCMAKE_BUILD_TYPE=$(CMAKE_BUILD_TYPE)
+ -DCMAKE_BUILD_TYPE=$(CMAKE_BUILD_TYPE) \
+ -DADBC_DRIVER_MANAGER=ON \
+ -DADBC_DRIVER_POSTGRESQL=ON \
+ -DADBC_DRIVER_SQLITE=ON \
+ -DADBC_DRIVER_FLIGHTSQL=ON
override_dh_auto_build:
dh_auto_build \
- --sourcedirectory=c/driver_manager \
- --builddirectory=c/driver_manager.build
- dh_auto_build \
- --sourcedirectory=c/driver/postgresql \
- --builddirectory=c/driver/postgresql.build
- dh_auto_build \
- --sourcedirectory=c/driver/sqlite \
- --builddirectory=c/driver/sqlite.build
- dh_auto_build \
- --sourcedirectory=c/driver/flightsql \
- --builddirectory=c/driver/flightsql.build
+ --sourcedirectory=c \
+ --builddirectory=c.build
dh_auto_configure \
--sourcedirectory=glib \
--builddirectory=glib.build \
--buildsystem=meson+ninja \
-- \
--buildtype=debugoptimized \
- -Dadbc_build_dir=../c/driver_manager.build
+ -Dadbc_build_dir=../c.build/driver_manager
env \
- LD_LIBRARY_PATH=$(CURDIR)/c/driver_manager.build \
+ LD_LIBRARY_PATH=$(CURDIR)/c.build/driver_manager \
dh_auto_build \
--sourcedirectory=glib \
--builddirectory=glib.build \
@@ -85,17 +62,8 @@ override_dh_auto_build:
override_dh_auto_install:
dh_auto_install \
- --sourcedirectory=c/driver_manager \
- --builddirectory=c/driver_manager.build
- dh_auto_install \
- --sourcedirectory=c/driver/postgresql \
- --builddirectory=c/driver/postgresql.build
- dh_auto_install \
- --sourcedirectory=c/driver/sqlite \
- --builddirectory=c/driver/sqlite.build
- dh_auto_install \
- --sourcedirectory=c/driver/flightsql \
- --builddirectory=c/driver/flightsql.build
+ --sourcedirectory=c \
+ --builddirectory=c.build
dh_auto_install \
--sourcedirectory=glib \
--builddirectory=glib.build \
diff --git a/ci/linux-packages/yum/apache-arrow-adbc.spec.in b/ci/linux-packages/yum/apache-arrow-adbc.spec.in
index 8691f5c..3f3379c 100644
--- a/ci/linux-packages/yum/apache-arrow-adbc.spec.in
+++ b/ci/linux-packages/yum/apache-arrow-adbc.spec.in
@@ -59,31 +59,14 @@ Apache Arrow Database Connectivity (ADBC) is an Apache Arrow based database acce
cmake_build_type=RelWithDebInfo
meson_build_type=debugoptimized
-cd c/driver_manager
+cd c
%adbc_cmake \
-DCMAKE_BUILD_TYPE=${cmake_build_type} \
- -G"Unix Makefiles"
-%adbc_cmake_build
-cd -
-
-cd c/driver/postgresql
-%adbc_cmake \
- -DCMAKE_BUILD_TYPE=${cmake_build_type} \
- -G"Unix Makefiles"
-%adbc_cmake_build
-cd -
-
-cd c/driver/sqlite
-%adbc_cmake \
- -DCMAKE_BUILD_TYPE=${cmake_build_type} \
- -G"Unix Makefiles"
-%adbc_cmake_build
-cd -
-
-cd c/driver/flightsql
-%adbc_cmake \
- -DCMAKE_BUILD_TYPE=${cmake_build_type} \
- -G"Unix Makefiles"
+ -G"Unix Makefiles" \
+ -DADBC_DRIVER_MANAGER=ON \
+ -DADBC_DRIVER_POSTGRESQL=ON \
+ -DADBC_DRIVER_SQLITE=ON \
+ -DADBC_DRIVER_FLIGHTSQL=ON
%adbc_cmake_build
cd -
@@ -94,26 +77,14 @@ meson setup build \
--default-library=both \
--libdir=%{_libdir} \
--prefix=%{_prefix} \
- -Dadbc_build_dir=$PWD/../c/driver_manager/%{adbc_cmake_builddir}
+ -Dadbc_build_dir=$PWD/../c/%{adbc_cmake_builddir}/driver_manager
-LD_LIBRARY_PATH=$PWD/../c/driver_manager/%{adbc_cmake_builddir}/ \
+LD_LIBRARY_PATH=$PWD/../c/%{adbc_cmake_builddir}/driver_manager \
meson compile -C build %{?_smp_mflags}
cd -
%install
-cd c/driver_manager
-%adbc_cmake_install
-cd -
-
-cd c/driver/postgresql
-%adbc_cmake_install
-cd -
-
-cd c/driver/sqlite
-%adbc_cmake_install
-cd -
-
-cd c/driver/flightsql
+cd c
%adbc_cmake_install
cd -
diff --git a/ci/scripts/cpp_build.ps1 b/ci/scripts/cpp_build.ps1
index c22110c..37194d0 100755
--- a/ci/scripts/cpp_build.ps1
+++ b/ci/scripts/cpp_build.ps1
@@ -28,21 +28,17 @@ $BuildDriverPostgreSQL = ($BuildAll -and (-not ($env:BUILD_DRIVER_POSTGRESQL -eq
$BuildDriverSqlite = ($BuildAll -and (-not ($env:BUILD_DRIVER_SQLITE -eq "0"))) -or ($env:BUILD_DRIVER_SQLITE -eq "1")
function Build-Subproject {
- $Subproject = $Args[0]
- $SubprojectBuild = Join-Path $BuildDir $Subproject
-
- echo "============================================================"
- echo "Building $($Subproject)"
- echo "============================================================"
-
- New-Item -ItemType Directory -Force -Path $SubprojectBuild | Out-Null
- Push-Location $SubprojectBuild
+ New-Item -ItemType Directory -Force -Path $BuildDir | Out-Null
+ Push-Location $BuildDir
cmake `
- $(Join-Path $SourceDir "c\$($Subproject)") `
+ $(Join-Path $SourceDir "c\") `
-DADBC_BUILD_SHARED=ON `
-DADBC_BUILD_STATIC=OFF `
-DADBC_BUILD_TESTS=ON `
+ -DADBC_DRIVER_MANAGER="$($BuildDriverManager)" `
+ -DADBC_DRIVER_POSTGRESQL="$($BuildDriverPostgreSQL)" `
+ -DADBC_DRIVER_SQLITE="$($BuildDriverSqlite)" `
-DCMAKE_BUILD_TYPE=Debug `
-DCMAKE_INSTALL_PREFIX="$($InstallDir)" `
-DCMAKE_VERBOSE_MAKEFILE=ON
@@ -54,12 +50,4 @@ function Build-Subproject {
Pop-Location
}
-if ($BuildDriverManager) {
- Build-Subproject driver_manager
-}
-if ($BuildDriverPostgreSQL) {
- Build-Subproject driver\postgresql
-}
-if ($BuildDriverSqlite) {
- Build-Subproject driver\sqlite
-}
+Build-Subproject
diff --git a/ci/scripts/cpp_build.sh b/ci/scripts/cpp_build.sh
index 2841c2e..cca2589 100755
--- a/ci/scripts/cpp_build.sh
+++ b/ci/scripts/cpp_build.sh
@@ -37,20 +37,23 @@ build_subproject() {
local -r source_dir="${1}"
local -r build_dir="${2}"
local -r install_dir="${3}"
- local -r subproject="${4}"
if [[ -z "${CMAKE_INSTALL_PREFIX}" ]]; then
CMAKE_INSTALL_PREFIX="${install_dir}"
fi
echo "Installing to ${CMAKE_INSTALL_PREFIX}"
- mkdir -p "${build_dir}/${subproject}"
- pushd "${build_dir}/${subproject}"
+ mkdir -p "${build_dir}"
+ pushd "${build_dir}"
set -x
- cmake "${source_dir}/c/${subproject}" \
+ cmake "${source_dir}/c" \
"${ADBC_CMAKE_ARGS}" \
-DADBC_BUILD_SHARED="${ADBC_BUILD_SHARED}" \
+ -DADBC_DRIVER_MANAGER="${BUILD_DRIVER_MANAGER}" \
+ -DADBC_DRIVER_POSTGRESQL="${BUILD_DRIVER_POSTGRESQL}" \
+ -DADBC_DRIVER_SQLITE="${BUILD_DRIVER_SQLITE}" \
+ -DADBC_DRIVER_FLIGHTSQL="${BUILD_DRIVER_FLIGHTSQL}" \
-DADBC_BUILD_STATIC="${ADBC_BUILD_STATIC}" \
-DADBC_BUILD_TESTS="${ADBC_BUILD_TESTS}" \
-DADBC_USE_ASAN="${ADBC_USE_ASAN}" \
@@ -73,21 +76,7 @@ main() {
install_dir="${build_dir}/local"
fi
- if [[ "${BUILD_DRIVER_MANAGER}" -gt 0 ]]; then
- build_subproject "${source_dir}" "${build_dir}" "${install_dir}" driver_manager
- fi
-
- if [[ "${BUILD_DRIVER_POSTGRESQL}" -gt 0 ]]; then
- build_subproject "${source_dir}" "${build_dir}" "${install_dir}" driver/postgresql
- fi
-
- if [[ "${BUILD_DRIVER_SQLITE}" -gt 0 ]]; then
- build_subproject "${source_dir}" "${build_dir}" "${install_dir}" driver/sqlite
- fi
-
- if [[ "${BUILD_DRIVER_FLIGHTSQL}" -gt 0 ]]; then
- build_subproject "${source_dir}" "${build_dir}" "${install_dir}" driver/flightsql
- fi
+ build_subproject "${source_dir}" "${build_dir}" "${install_dir}"
}
main "$@"
diff --git a/ci/scripts/cpp_test.ps1 b/ci/scripts/cpp_test.ps1
index d1f564a..f25be9b 100755
--- a/ci/scripts/cpp_test.ps1
+++ b/ci/scripts/cpp_test.ps1
@@ -38,15 +38,7 @@ echo $env:LD_LIBRARY_PATH
echo $env:PATH
function Build-Subproject {
- $Subproject = $Args[0]
- $SubprojectBuild = Join-Path $BuildDir $Subproject
-
- echo "============================================================"
- echo "Testing $($Subproject)"
- echo "============================================================"
-
- New-Item -ItemType Directory -Force -Path $SubprojectBuild | Out-Null
- Push-Location $SubprojectBuild
+ Push-Location $BuildDir
ctest --output-on-failure --no-tests=error
if (-not $?) { exit 1 }
@@ -54,12 +46,4 @@ function Build-Subproject {
Pop-Location
}
-if ($BuildDriverManager) {
- Build-Subproject driver_manager
-}
-if ($BuildDriverPostgreSQL) {
- Build-Subproject driver\postgresql
-}
-if ($BuildDriverSqlite) {
- Build-Subproject driver\sqlite
-}
+Build-Subproject
diff --git a/ci/scripts/cpp_test.sh b/ci/scripts/cpp_test.sh
index fdd9a3f..c385315 100755
--- a/ci/scripts/cpp_test.sh
+++ b/ci/scripts/cpp_test.sh
@@ -26,14 +26,10 @@ set -e
test_subproject() {
local -r build_dir="${1}"
- local -r subproject="${2}"
- echo "=== Testing ${subproject} ==="
+ pushd "${build_dir}/"
- pushd "${build_dir}/${subproject}"
-
- # macOS will not propagate DYLD_LIBRARY_PATH through a subprocess
- "./adbc-$(echo ${subproject} | sed "s|[/_]|-|g")-test"
+ ctest --output-on-failure --no-tests=error
popd
}
@@ -50,22 +46,7 @@ main() {
export DYLD_LIBRARY_PATH="${LD_LIBRARY_PATH}:${install_dir}/lib"
export LD_LIBRARY_PATH="${LD_LIBRARY_PATH}:${install_dir}/lib"
- if [[ "${BUILD_DRIVER_MANAGER}" -gt 0 ]]; then
- test_subproject "${build_dir}" driver_manager
- fi
-
- if [[ "${BUILD_DRIVER_POSTGRESQL}" -gt 0 ]]; then
- test_subproject "${build_dir}" driver/postgresql
- fi
-
- if [[ "${BUILD_DRIVER_SQLITE}" -gt 0 ]]; then
- test_subproject "${build_dir}" driver/sqlite
- fi
-
- if [[ "${BUILD_DRIVER_FLIGHTSQL}" -gt 0 ]]; then
- export GODEBUG=cgocheck=2
- test_subproject "${build_dir}" driver/flightsql
- fi
+ test_subproject "${build_dir}"
}
main "$@"
diff --git a/ci/scripts/python_util.sh b/ci/scripts/python_util.sh
index b03af24..ca909c9 100644
--- a/ci/scripts/python_util.sh
+++ b/ci/scripts/python_util.sh
@@ -55,21 +55,6 @@ function build_drivers {
fi
fi
- echo "=== Building driver/flightsql ==="
- mkdir -p ${build_dir}/driver/flightsql
- pushd ${build_dir}/driver/flightsql
- cmake \
- -DADBC_BUILD_SHARED=ON \
- -DADBC_BUILD_STATIC=OFF \
- -DCMAKE_BUILD_WITH_INSTALL_RPATH=ON \
- -DCMAKE_INSTALL_LIBDIR=lib \
- -DCMAKE_INSTALL_PREFIX=${build_dir} \
- -DCMAKE_UNITY_BUILD=${CMAKE_UNITY_BUILD} \
- ${CMAKE_ARGUMENTS} \
- ${source_dir}/c/driver/flightsql
- cmake --build . --target install --verbose -j
- popd
-
echo "=== Setup VCPKG ==="
pushd "${VCPKG_ROOT}"
@@ -85,30 +70,14 @@ function build_drivers {
--overlay-triplets "${VCPKG_OVERLAY_TRIPLETS}" \
--triplet "${VCPKG_DEFAULT_TRIPLET}"
- echo "=== Building driver/postgresql ==="
- mkdir -p ${build_dir}/driver/postgresql
- pushd ${build_dir}/driver/postgresql
- cmake \
- -G ${CMAKE_GENERATOR} \
- -DADBC_BUILD_SHARED=ON \
- -DADBC_BUILD_STATIC=OFF \
- -DCMAKE_BUILD_WITH_INSTALL_RPATH=ON \
- -DCMAKE_INSTALL_LIBDIR=lib \
- -DCMAKE_INSTALL_PREFIX=${build_dir} \
- -DCMAKE_TOOLCHAIN_FILE=${VCPKG_ROOT}/scripts/buildsystems/vcpkg.cmake \
- -DCMAKE_UNITY_BUILD=${CMAKE_UNITY_BUILD} \
- ${CMAKE_ARGUMENTS} \
- -DVCPKG_OVERLAY_TRIPLETS="${VCPKG_OVERLAY_TRIPLETS}" \
- -DVCPKG_TARGET_TRIPLET="${VCPKG_DEFAULT_TRIPLET}" \
- ${source_dir}/c/driver/postgresql
- cmake --build . --target install --verbose -j
- popd
+ "${VCPKG_ROOT}/vcpkg" install libpq \
+ --overlay-triplets "${VCPKG_OVERLAY_TRIPLETS}" \
+ --triplet "${VCPKG_DEFAULT_TRIPLET}"
- echo "=== Building driver/sqlite ==="
- mkdir -p ${build_dir}/driver/sqlite
- pushd ${build_dir}/driver/sqlite
+ echo "=== Building drivers ==="
+ mkdir -p ${build_dir}
+ pushd ${build_dir}
cmake \
- -G ${CMAKE_GENERATOR} \
-DADBC_BUILD_SHARED=ON \
-DADBC_BUILD_STATIC=OFF \
-DCMAKE_BUILD_WITH_INSTALL_RPATH=ON \
@@ -119,7 +88,10 @@ function build_drivers {
${CMAKE_ARGUMENTS} \
-DVCPKG_OVERLAY_TRIPLETS="${VCPKG_OVERLAY_TRIPLETS}" \
-DVCPKG_TARGET_TRIPLET="${VCPKG_DEFAULT_TRIPLET}" \
- ${source_dir}/c/driver/sqlite
+ -DADBC_DRIVER_FLIGHTSQL=ON \
+ -DADBC_DRIVER_POSTGRESQL=ON \
+ -DADBC_DRIVER_SQLITE=ON \
+ ${source_dir}/c
cmake --build . --target install --verbose -j
popd
}
diff --git a/ci/scripts/python_wheel_windows_build.bat b/ci/scripts/python_wheel_windows_build.bat
index 2d2fd02..40c093f 100644
--- a/ci/scripts/python_wheel_windows_build.bat
+++ b/ci/scripts/python_wheel_windows_build.bat
@@ -34,13 +34,12 @@ IF NOT DEFINED VCPKG_ROOT (echo "Must set VCPKG_ROOT" && exit /B 1)
set ADBC_FLIGHTSQL_LIBRARY=%build_dir%\flightsql\adbc_driver_flightsql.dll
-mkdir %build_dir%\flightsql
+mkdir %build_dir%
pushd %source_dir%\go\adbc\pkg
go build -tags driverlib -o %ADBC_FLIGHTSQL_LIBRARY% -buildmode=c-shared ./flightsql
popd
-mkdir %build_dir%\postgresql
-pushd %build_dir%\postgresql
+pushd %build_dir%
cmake ^
-G "%CMAKE_GENERATOR%" ^
@@ -51,29 +50,16 @@ cmake ^
-DCMAKE_TOOLCHAIN_FILE=%VCPKG_ROOT%/scripts/buildsystems/vcpkg.cmake ^
-DCMAKE_UNITY_BUILD=%CMAKE_UNITY_BUILD% ^
-DVCPKG_TARGET_TRIPLET=%VCPKG_TARGET_TRIPLET% ^
- %source_dir%\c\driver\postgresql || exit /B 1
+ -DADBC_DRIVER_POSTGRESQL=ON ^
+ -DADBC_DRIVER_SQLITE=ON ^
+ -DADBC_DRIVER_FLIGHTSQL=ON ^
+ -DADBC_DRIVER_MANAGER=ON ^
+ %source_dir%\c || exit /B 1
cmake --build . --config %CMAKE_BUILD_TYPE% --target install --verbose -j || exit /B 1
@REM XXX: CMake installs it to bin instead of lib for some reason
set ADBC_POSTGRESQL_LIBRARY=%build_dir%\bin\adbc_driver_postgresql.dll
-popd
-
-mkdir %build_dir%\sqlite
-pushd %build_dir%\sqlite
-
-cmake ^
- -G "%CMAKE_GENERATOR%" ^
- -DADBC_BUILD_SHARED=ON ^
- -DADBC_BUILD_STATIC=OFF ^
- -DCMAKE_BUILD_TYPE=%CMAKE_BUILD_TYPE% ^
- -DCMAKE_INSTALL_PREFIX=%build_dir% ^
- -DCMAKE_TOOLCHAIN_FILE=%VCPKG_ROOT%/scripts/buildsystems/vcpkg.cmake ^
- -DCMAKE_UNITY_BUILD=%CMAKE_UNITY_BUILD% ^
- -DVCPKG_TARGET_TRIPLET=%VCPKG_TARGET_TRIPLET% ^
- %source_dir%\c\driver\sqlite || exit /B 1
-cmake --build . --config %CMAKE_BUILD_TYPE% --target install --verbose -j || exit /B 1
-
@REM XXX: CMake installs it to bin instead of lib for some reason
set ADBC_SQLITE_LIBRARY=%build_dir%\bin\adbc_driver_sqlite.dll