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/06/13 15:21:02 UTC

[arrow-adbc] branch main updated: build(c): include validation tests as object library (#775)

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 20c63814 build(c): include validation tests as object library (#775)
20c63814 is described below

commit 20c6381473c497b9a0419b7bbd593757e16f5e23
Author: David Li <li...@gmail.com>
AuthorDate: Tue Jun 13 11:20:56 2023 -0400

    build(c): include validation tests as object library (#775)
    
    Avoids rebuilding the same (expensive) C++ files over and over.
    
    Fixes #691.
---
 c/CMakeLists.txt                           |  4 +++
 c/driver/flightsql/CMakeLists.txt          |  3 +--
 c/driver/postgresql/CMakeLists.txt         |  3 +--
 c/driver/snowflake/CMakeLists.txt          |  3 +--
 c/driver/sqlite/CMakeLists.txt             |  3 +--
 c/validation/AdbcValidationConfig.cmake.in | 22 ---------------
 c/validation/CMakeLists.txt                | 43 +-----------------------------
 7 files changed, 9 insertions(+), 72 deletions(-)

diff --git a/c/CMakeLists.txt b/c/CMakeLists.txt
index 7f417b08..ac594b03 100644
--- a/c/CMakeLists.txt
+++ b/c/CMakeLists.txt
@@ -29,6 +29,10 @@ include(CTest)
 add_subdirectory(vendor/nanoarrow)
 add_subdirectory(driver/common)
 
+if(ADBC_BUILD_TESTS)
+  add_subdirectory(validation)
+endif()
+
 if(ADBC_DRIVER_FLIGHTSQL)
   add_subdirectory(driver/flightsql)
 endif()
diff --git a/c/driver/flightsql/CMakeLists.txt b/c/driver/flightsql/CMakeLists.txt
index 28d477e3..e8541667 100644
--- a/c/driver/flightsql/CMakeLists.txt
+++ b/c/driver/flightsql/CMakeLists.txt
@@ -50,9 +50,8 @@ if(ADBC_BUILD_TESTS)
                 SOURCES
                 dremio_flightsql_test.cc
                 sqlite_flightsql_test.cc
-                ../../validation/adbc_validation.cc
-                ../../validation/adbc_validation_util.cc
                 EXTRA_LINK_LIBS
+                adbc_validation
                 nanoarrow
                 ${TEST_LINK_LIBS})
   target_compile_features(adbc-driver-flightsql-test PRIVATE cxx_std_17)
diff --git a/c/driver/postgresql/CMakeLists.txt b/c/driver/postgresql/CMakeLists.txt
index 337873f3..1b71d602 100644
--- a/c/driver/postgresql/CMakeLists.txt
+++ b/c/driver/postgresql/CMakeLists.txt
@@ -75,10 +75,9 @@ if(ADBC_BUILD_TESTS)
                 postgres_type_test.cc
                 postgres_copy_reader_test.cc
                 postgresql_test.cc
-                ../../validation/adbc_validation.cc
-                ../../validation/adbc_validation_util.cc
                 EXTRA_LINK_LIBS
                 adbc_driver_common
+                adbc_validation
                 nanoarrow
                 ${TEST_LINK_LIBS})
   target_compile_features(adbc-driver-postgresql-test PRIVATE cxx_std_17)
diff --git a/c/driver/snowflake/CMakeLists.txt b/c/driver/snowflake/CMakeLists.txt
index 5b4693eb..0fa3a98c 100644
--- a/c/driver/snowflake/CMakeLists.txt
+++ b/c/driver/snowflake/CMakeLists.txt
@@ -49,9 +49,8 @@ if(ADBC_BUILD_TESTS)
                 driver-snowflake
                 SOURCES
                 snowflake_test.cc
-                ../../validation/adbc_validation.cc
-                ../../validation/adbc_validation_util.cc
                 EXTRA_LINK_LIBS
+                adbc_validation
                 nanoarrow
                 ${TEST_LINK_LIBS})
   target_compile_features(adbc-driver-snowflake-test PRIVATE cxx_std_17)
diff --git a/c/driver/sqlite/CMakeLists.txt b/c/driver/sqlite/CMakeLists.txt
index 9d1d4001..2bec53ed 100644
--- a/c/driver/sqlite/CMakeLists.txt
+++ b/c/driver/sqlite/CMakeLists.txt
@@ -70,10 +70,9 @@ if(ADBC_BUILD_TESTS)
                 driver-sqlite
                 SOURCES
                 sqlite_test.cc
-                ../../validation/adbc_validation.cc
-                ../../validation/adbc_validation_util.cc
                 EXTRA_LINK_LIBS
                 adbc_driver_common
+                adbc_validation
                 nanoarrow
                 ${TEST_LINK_LIBS})
   target_compile_features(adbc-driver-sqlite-test PRIVATE cxx_std_17)
diff --git a/c/validation/AdbcValidationConfig.cmake.in b/c/validation/AdbcValidationConfig.cmake.in
deleted file mode 100644
index dc2ca25f..00000000
--- a/c/validation/AdbcValidationConfig.cmake.in
+++ /dev/null
@@ -1,22 +0,0 @@
-# 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@
-
-include("${CMAKE_CURRENT_LIST_DIR}/AdbcValidationTargets.cmake")
-
-check_required_components(AdbcValidation)
diff --git a/c/validation/CMakeLists.txt b/c/validation/CMakeLists.txt
index d9449c2e..1c27e8ac 100644
--- a/c/validation/CMakeLists.txt
+++ b/c/validation/CMakeLists.txt
@@ -15,49 +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(AdbcVersion)
-include(GNUInstallDirs)
-include(CMakePackageConfigHelpers)
-project(adbc_validation
-        VERSION "${ADBC_BASE_VERSION}"
-        LANGUAGES CXX)
-
-find_package(GTest REQUIRED)
-get_filename_component(REPOSITORY_ROOT "../../" ABSOLUTE)
-
-add_library(adbc_validation STATIC adbc_validation.cc adbc_validation_util.cc)
+add_library(adbc_validation OBJECT adbc_validation.cc adbc_validation_util.cc)
 target_compile_features(adbc_validation PRIVATE cxx_std_17)
 target_include_directories(adbc_validation SYSTEM PRIVATE "${REPOSITORY_ROOT}"
                                                           "${REPOSITORY_ROOT}/c/vendor/")
 target_link_libraries(adbc_validation PUBLIC nanoarrow GTest::gtest GTest::gmock)
-
-set_target_properties(adbc_validation
-                      PROPERTIES PUBLIC_HEADER "adbc_validation.h;adbc_validation_util.h")
-
-install(TARGETS adbc_validation
-        EXPORT AdbcValidationTargets
-        LIBRARY DESTINATION "${CMAKE_INSTALL_LIBDIR}"
-        PUBLIC_HEADER DESTINATION "${CMAKE_INSTALL_INCLUDEDIR}/adbc_validation/")
-
-write_basic_package_version_file(
-  "${CMAKE_CURRENT_BINARY_DIR}/AdbcValidation/AdbcValidationConfigVersion.cmake"
-  COMPATIBILITY AnyNewerVersion)
-export(EXPORT AdbcValidationTargets
-       FILE "${CMAKE_CURRENT_BINARY_DIR}/AdbcValidation/AdbcValidationTargets.cmake"
-       NAMESPACE AdbcValidation::)
-configure_package_config_file("AdbcValidationConfig.cmake.in"
-                              "${CMAKE_CURRENT_BINARY_DIR}/AdbcValidation/AdbcValidationConfig.cmake"
-                              INSTALL_DESTINATION "AdbcValidation/AdbcValidationConfig.cmake"
-)
-
-install(EXPORT AdbcValidationTargets
-        FILE AdbcValidationTargets.cmake
-        NAMESPACE AdbcValidation::
-        DESTINATION "${CMAKE_INSTALL_LIBDIR}/cmake/AdbcValidation")
-install(FILES "${CMAKE_CURRENT_BINARY_DIR}/AdbcValidation/AdbcValidationConfig.cmake"
-              "${CMAKE_CURRENT_BINARY_DIR}/AdbcValidation/AdbcValidationConfigVersion.cmake"
-        DESTINATION "${CMAKE_INSTALL_LIBDIR}/cmake/AdbcValidation"
-        COMPONENT Devel)