From 3679c51f08599b1248f4887b1ffa58bea21729cd Mon Sep 17 00:00:00 2001 From: "Alina (Xi) Li" Date: Thu, 23 Nov 2023 16:34:09 -0800 Subject: [PATCH] Fix CMAKE code formats --- .../performance/CMakeLists.txt | 14 +- .../PTODBCExecution/CMakeLists.txt | 6 +- .../performance/PTODBCResults/CMakeLists.txt | 9 +- .../PerformanceHelper/CMakeLists.txt | 7 +- .../gtest/googletest-download.cmake | 24 +- .../performance/gtest/googletest.cmake | 39 +- .../src/CMakeLists.txt | 160 ++-- .../src/cmake/FindIgnite.cmake | 42 +- .../src/cmake/FindODBC.cmake | 189 ++--- .../src/linux_32bit_toolchain.cmake | 5 +- .../src/modules/code-coverage.cmake | 517 ++++++------ .../src/odbc/CMakeLists.txt | 748 ++++++++++-------- .../src/tests/data-writer/CMakeLists.txt | 55 +- .../src/tests/integration-test/CMakeLists.txt | 154 ++-- .../src/tests/unit-test/CMakeLists.txt | 134 ++-- 15 files changed, 1090 insertions(+), 1013 deletions(-) diff --git a/cpp/src/arrow/flight/sql/amazon-timestream-odbc-driver/performance/CMakeLists.txt b/cpp/src/arrow/flight/sql/amazon-timestream-odbc-driver/performance/CMakeLists.txt index 6f4d0b269c46c..55321eba5920a 100644 --- a/cpp/src/arrow/flight/sql/amazon-timestream-odbc-driver/performance/CMakeLists.txt +++ b/cpp/src/arrow/flight/sql/amazon-timestream-odbc-driver/performance/CMakeLists.txt @@ -25,19 +25,15 @@ add_subdirectory(${PERFORMANCE_HELPER}) add_subdirectory(${RESULTS_PTESTS}) add_subdirectory(${EXECUTION_PTESTS}) -if (NOT "$ENV{BOOST_ROOT}" STREQUAL "") - set(BOOST_ROOT "$ENV{BOOST_ROOT}") +if(NOT "$ENV{BOOST_ROOT}" STREQUAL "") + set(BOOST_ROOT "$ENV{BOOST_ROOT}") endif() # gtest include(gtest/googletest.cmake) if(APPLE) - set(CMAKE_CXX_FLAGS "${CMAKE_CXX_FLAGS_INIT} -fPIC") + set(CMAKE_CXX_FLAGS "${CMAKE_CXX_FLAGS_INIT} -fPIC") else() - set(CMAKE_CXX_FLAGS "${CMAKE_CXX_FLAGS_INIT} -fPIC -Wno-error=maybe-uninitialized") + set(CMAKE_CXX_FLAGS "${CMAKE_CXX_FLAGS_INIT} -fPIC -Wno-error=maybe-uninitialized") endif() -fetch_googletest( - ${PROJECT_SOURCE_DIR}/gtest - ${PROJECT_BINARY_DIR}/googletest -) - +fetch_googletest(${PROJECT_SOURCE_DIR}/gtest ${PROJECT_BINARY_DIR}/googletest) diff --git a/cpp/src/arrow/flight/sql/amazon-timestream-odbc-driver/performance/PTODBCExecution/CMakeLists.txt b/cpp/src/arrow/flight/sql/amazon-timestream-odbc-driver/performance/PTODBCExecution/CMakeLists.txt index 0921d36ea6c6b..d03e731d0b1b9 100644 --- a/cpp/src/arrow/flight/sql/amazon-timestream-odbc-driver/performance/PTODBCExecution/CMakeLists.txt +++ b/cpp/src/arrow/flight/sql/amazon-timestream-odbc-driver/performance/PTODBCExecution/CMakeLists.txt @@ -1,11 +1,11 @@ # Copyright <2022> Amazon.com, Inc. or its affiliates. All Rights Reserved. -# +# # Licensed under the Apache License, Version 2.0 (the "License"). # You may not use this file except in compliance with the License. # A copy of the License is located at -# +# # http://www.apache.org/licenses/LICENSE-2.0 -# +# # or in the "license" file accompanying this file. This file 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 diff --git a/cpp/src/arrow/flight/sql/amazon-timestream-odbc-driver/performance/PTODBCResults/CMakeLists.txt b/cpp/src/arrow/flight/sql/amazon-timestream-odbc-driver/performance/PTODBCResults/CMakeLists.txt index ed1dd39d42927..c9df6b613f461 100644 --- a/cpp/src/arrow/flight/sql/amazon-timestream-odbc-driver/performance/PTODBCResults/CMakeLists.txt +++ b/cpp/src/arrow/flight/sql/amazon-timestream-odbc-driver/performance/PTODBCResults/CMakeLists.txt @@ -17,11 +17,16 @@ find_package(Boost 1.71 REQUIRED COMPONENTS thread) find_package(ODBC REQUIRED) # Source, headers, and include dirs set(SOURCE_FILES performance_odbc_results.cpp) -include_directories(${PERFORMANCE_HELPER} SYSTEM ${ODBC_INCLUDE_DIRS} ${Boost_INCLUDE_DIRS}) +include_directories(${PERFORMANCE_HELPER} SYSTEM ${ODBC_INCLUDE_DIRS} + ${Boost_INCLUDE_DIRS}) # Generate executable add_executable(performance_results ${SOURCE_FILES}) # Library dependencies -target_link_libraries(performance_results performance_helper gtest_main ${ODBC_LIBRARIES} ${Boost_LIBRARIES}) +target_link_libraries(performance_results + performance_helper + gtest_main + ${ODBC_LIBRARIES} + ${Boost_LIBRARIES}) target_compile_definitions(performance_results PUBLIC _UNICODE UNICODE) diff --git a/cpp/src/arrow/flight/sql/amazon-timestream-odbc-driver/performance/PerformanceHelper/CMakeLists.txt b/cpp/src/arrow/flight/sql/amazon-timestream-odbc-driver/performance/PerformanceHelper/CMakeLists.txt index 64425d6a27a54..0b0a030ca6154 100644 --- a/cpp/src/arrow/flight/sql/amazon-timestream-odbc-driver/performance/PerformanceHelper/CMakeLists.txt +++ b/cpp/src/arrow/flight/sql/amazon-timestream-odbc-driver/performance/PerformanceHelper/CMakeLists.txt @@ -17,14 +17,13 @@ find_package(ODBC REQUIRED) # Source, headers, and include dirs set(SOURCE_FILES performance_helper.cpp) -set(HEADER_FILES performance_helper.h) +set(HEADER_FILES performance_helper.h) # Generate dll (SHARED) -add_library(performance_helper ${SOURCE_FILES} ${HEADER_FILES}) +add_library(performance_helper ${SOURCE_FILES} ${HEADER_FILES}) include_directories(${ODBC_INCLUDE_DIRS}) # Library dependencies set(CMAKE_CXX_FLAGS "${CMAKE_CXX_FLAGS_INIT} -fPIC") target_link_libraries(performance_helper gtest_main ${ODBC_LIBRARIES}) -target_compile_definitions(performance_helper PUBLIC _UNICODE UNICODE) - +target_compile_definitions(performance_helper PUBLIC _UNICODE UNICODE) diff --git a/cpp/src/arrow/flight/sql/amazon-timestream-odbc-driver/performance/gtest/googletest-download.cmake b/cpp/src/arrow/flight/sql/amazon-timestream-odbc-driver/performance/gtest/googletest-download.cmake index 6ed16b4a7256c..27f948f0ae43f 100644 --- a/cpp/src/arrow/flight/sql/amazon-timestream-odbc-driver/performance/gtest/googletest-download.cmake +++ b/cpp/src/arrow/flight/sql/amazon-timestream-odbc-driver/performance/gtest/googletest-download.cmake @@ -20,7 +20,7 @@ # OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE # SOFTWARE. -# Modifications Copyright Amazon.com, Inc. or its affiliates. +# Modifications Copyright Amazon.com, Inc. or its affiliates. # SPDX-License-Identifier: MIT. cmake_minimum_required(VERSION 3.5 FATAL_ERROR) @@ -29,16 +29,12 @@ project(googletest-download NONE) include(ExternalProject) -ExternalProject_Add( - googletest - SOURCE_DIR "@GOOGLETEST_DOWNLOAD_ROOT@/googletest-src" - BINARY_DIR "@GOOGLETEST_DOWNLOAD_ROOT@/googletest-build" - GIT_REPOSITORY - https://github.com/google/googletest.git - GIT_TAG - release-1.10.0 - CONFIGURE_COMMAND "" - BUILD_COMMAND "" - INSTALL_COMMAND "" - TEST_COMMAND "" - ) +externalproject_add(googletest + SOURCE_DIR "@GOOGLETEST_DOWNLOAD_ROOT@/googletest-src" + BINARY_DIR "@GOOGLETEST_DOWNLOAD_ROOT@/googletest-build" + GIT_REPOSITORY https://github.com/google/googletest.git + GIT_TAG release-1.10.0 + CONFIGURE_COMMAND "" + BUILD_COMMAND "" + INSTALL_COMMAND "" + TEST_COMMAND "") diff --git a/cpp/src/arrow/flight/sql/amazon-timestream-odbc-driver/performance/gtest/googletest.cmake b/cpp/src/arrow/flight/sql/amazon-timestream-odbc-driver/performance/gtest/googletest.cmake index 1665d9f0b62a6..4f03803006e2f 100644 --- a/cpp/src/arrow/flight/sql/amazon-timestream-odbc-driver/performance/gtest/googletest.cmake +++ b/cpp/src/arrow/flight/sql/amazon-timestream-odbc-driver/performance/gtest/googletest.cmake @@ -20,34 +20,21 @@ # OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE # SOFTWARE. -# Modifications Copyright Amazon.com, Inc. or its affiliates. +# Modifications Copyright Amazon.com, Inc. or its affiliates. # SPDX-License-Identifier: MIT. macro(fetch_googletest _download_module_path _download_root) - set(GOOGLETEST_DOWNLOAD_ROOT ${_download_root}) - configure_file( - ${_download_module_path}/googletest-download.cmake - ${_download_root}/CMakeLists.txt - @ONLY - ) - unset(GOOGLETEST_DOWNLOAD_ROOT) + set(GOOGLETEST_DOWNLOAD_ROOT ${_download_root}) + configure_file(${_download_module_path}/googletest-download.cmake + ${_download_root}/CMakeLists.txt @ONLY) + unset(GOOGLETEST_DOWNLOAD_ROOT) - execute_process( - COMMAND - "${CMAKE_COMMAND}" -G "${CMAKE_GENERATOR}" . - WORKING_DIRECTORY - ${_download_root} - ) - execute_process( - COMMAND - "${CMAKE_COMMAND}" --build . - WORKING_DIRECTORY - ${_download_root} - ) + execute_process(COMMAND "${CMAKE_COMMAND}" -G "${CMAKE_GENERATOR}" . + WORKING_DIRECTORY ${_download_root}) + execute_process(COMMAND "${CMAKE_COMMAND}" --build . + WORKING_DIRECTORY ${_download_root}) - # adds the targers: gtest, gtest_main, gmock, gmock_main - add_subdirectory( - ${_download_root}/googletest-src EXCLUDE_FROM_ALL - ${_download_root}/googletest-build EXCLUDE_FROM_ALL - ) -endmacro() \ No newline at end of file + # adds the targers: gtest, gtest_main, gmock, gmock_main + add_subdirectory(${_download_root}/googletest-src EXCLUDE_FROM_ALL + ${_download_root}/googletest-build EXCLUDE_FROM_ALL) +endmacro() diff --git a/cpp/src/arrow/flight/sql/amazon-timestream-odbc-driver/src/CMakeLists.txt b/cpp/src/arrow/flight/sql/amazon-timestream-odbc-driver/src/CMakeLists.txt index 2fe4764723479..7671860abc02b 100644 --- a/cpp/src/arrow/flight/sql/amazon-timestream-odbc-driver/src/CMakeLists.txt +++ b/cpp/src/arrow/flight/sql/amazon-timestream-odbc-driver/src/CMakeLists.txt @@ -1,11 +1,11 @@ # Copyright <2022> Amazon.com, Inc. or its affiliates. All Rights Reserved. -# +# # Licensed under the Apache License, Version 2.0 (the "License"). # You may not use this file except in compliance with the License. # A copy of the License is located at -# +# # http://www.apache.org/licenses/LICENSE-2.0 -# +# # or in the "license" file accompanying this file. This file 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 @@ -19,52 +19,64 @@ string(STRIP ${ODBC_DRIVER_VERSION} ODBC_DRIVER_VERSION) project(Timestream-ODBC VERSION ${ODBC_DRIVER_VERSION}) # Mac -if (UNIX AND APPLE) - set(AWS_CMAKE_DIR ${CMAKE_SOURCE_DIR}/aws-sdk-cpp/install/lib) +if(UNIX AND APPLE) + set(AWS_CMAKE_DIR ${CMAKE_SOURCE_DIR}/aws-sdk-cpp/install/lib) endif() -# Linux -if (UNIX AND NOT APPLE) - if (${INSTALLER_TYPE} STREQUAL "RPM" AND ${BITNESS} EQUAL 64) - set(AWS_CMAKE_DIR ${CMAKE_SOURCE_DIR}/aws-sdk-cpp/install/lib64) - else() - set(AWS_CMAKE_DIR ${CMAKE_SOURCE_DIR}/aws-sdk-cpp/install/lib) - endif() +# Linux +if(UNIX AND NOT APPLE) + if(${INSTALLER_TYPE} STREQUAL "RPM" AND ${BITNESS} EQUAL 64) + set(AWS_CMAKE_DIR ${CMAKE_SOURCE_DIR}/aws-sdk-cpp/install/lib64) + else() + set(AWS_CMAKE_DIR ${CMAKE_SOURCE_DIR}/aws-sdk-cpp/install/lib) + endif() endif() # Windows -if (WIN32) - set(AWS_CMAKE_DIR ${CMAKE_SOURCE_DIR}/../build/aws-sdk/install/lib) - - set(CMAKE_BUILD_DIR ${CMAKE_BINARY_DIR}/${CMAKE_BUILD_TYPE}) - set(AWS_DLL_DIR ${CMAKE_SOURCE_DIR}/../build/aws-sdk/install/bin) - set(AWS_LIB_DIR ${CMAKE_SOURCE_DIR}/../build/aws-sdk/install/lib) - - # copy AWS DLL to ${CMAKE_BUILD_DIR} as they are needed for Windows building and test running - configure_file(${AWS_DLL_DIR}/aws-cpp-sdk-core.dll ${CMAKE_BUILD_DIR}/aws-cpp-sdk-core.dll COPYONLY) - configure_file(${AWS_DLL_DIR}/aws-cpp-sdk-timestream-query.dll ${CMAKE_BUILD_DIR}/aws-cpp-sdk-timestream-query.dll COPYONLY) - # Timestream-write dll is needed for data writer tool - configure_file(${AWS_DLL_DIR}/aws-cpp-sdk-timestream-write.dll ${CMAKE_BUILD_DIR}/aws-cpp-sdk-timestream-write.dll COPYONLY) - configure_file(${AWS_DLL_DIR}/aws-cpp-sdk-sts.dll ${CMAKE_BUILD_DIR}/aws-cpp-sdk-sts.dll COPYONLY) - configure_file(${AWS_DLL_DIR}/aws-c-auth.dll ${CMAKE_BUILD_DIR}/aws-c-auth.dll COPYONLY) - configure_file(${AWS_DLL_DIR}/aws-c-cal.dll ${CMAKE_BUILD_DIR}/aws-c-cal.dll COPYONLY) - configure_file(${AWS_DLL_DIR}/aws-c-common.dll ${CMAKE_BUILD_DIR}/aws-c-common.dll COPYONLY) - configure_file(${AWS_DLL_DIR}/aws-c-compression.dll ${CMAKE_BUILD_DIR}/aws-c-compression.dll COPYONLY) - configure_file(${AWS_DLL_DIR}/aws-c-event-stream.dll ${CMAKE_BUILD_DIR}/aws-c-event-stream.dll COPYONLY) - configure_file(${AWS_DLL_DIR}/aws-checksums.dll ${CMAKE_BUILD_DIR}/aws-checksums.dll COPYONLY) - configure_file(${AWS_DLL_DIR}/aws-c-http.dll ${CMAKE_BUILD_DIR}/aws-c-http.dll COPYONLY) - configure_file(${AWS_DLL_DIR}/aws-c-io.dll ${CMAKE_BUILD_DIR}/aws-c-io.dll COPYONLY) - configure_file(${AWS_DLL_DIR}/aws-c-mqtt.dll ${CMAKE_BUILD_DIR}/aws-c-mqtt.dll COPYONLY) - configure_file(${AWS_DLL_DIR}/aws-crt-cpp.dll ${CMAKE_BUILD_DIR}/aws-crt-cpp.dll COPYONLY) - configure_file(${AWS_DLL_DIR}/aws-c-s3.dll ${CMAKE_BUILD_DIR}/aws-c-s3.dll COPYONLY) - configure_file(${AWS_DLL_DIR}/aws-c-sdkutils.dll ${CMAKE_BUILD_DIR}/aws-c-sdkutils.dll COPYONLY) +if(WIN32) + set(AWS_CMAKE_DIR ${CMAKE_SOURCE_DIR}/../build/aws-sdk/install/lib) + + set(CMAKE_BUILD_DIR ${CMAKE_BINARY_DIR}/${CMAKE_BUILD_TYPE}) + set(AWS_DLL_DIR ${CMAKE_SOURCE_DIR}/../build/aws-sdk/install/bin) + set(AWS_LIB_DIR ${CMAKE_SOURCE_DIR}/../build/aws-sdk/install/lib) + + # copy AWS DLL to ${CMAKE_BUILD_DIR} as they are needed for Windows building and test running + configure_file(${AWS_DLL_DIR}/aws-cpp-sdk-core.dll + ${CMAKE_BUILD_DIR}/aws-cpp-sdk-core.dll COPYONLY) + configure_file(${AWS_DLL_DIR}/aws-cpp-sdk-timestream-query.dll + ${CMAKE_BUILD_DIR}/aws-cpp-sdk-timestream-query.dll COPYONLY) + # Timestream-write dll is needed for data writer tool + configure_file(${AWS_DLL_DIR}/aws-cpp-sdk-timestream-write.dll + ${CMAKE_BUILD_DIR}/aws-cpp-sdk-timestream-write.dll COPYONLY) + configure_file(${AWS_DLL_DIR}/aws-cpp-sdk-sts.dll + ${CMAKE_BUILD_DIR}/aws-cpp-sdk-sts.dll COPYONLY) + configure_file(${AWS_DLL_DIR}/aws-c-auth.dll ${CMAKE_BUILD_DIR}/aws-c-auth.dll COPYONLY) + configure_file(${AWS_DLL_DIR}/aws-c-cal.dll ${CMAKE_BUILD_DIR}/aws-c-cal.dll COPYONLY) + configure_file(${AWS_DLL_DIR}/aws-c-common.dll ${CMAKE_BUILD_DIR}/aws-c-common.dll + COPYONLY) + configure_file(${AWS_DLL_DIR}/aws-c-compression.dll + ${CMAKE_BUILD_DIR}/aws-c-compression.dll COPYONLY) + configure_file(${AWS_DLL_DIR}/aws-c-event-stream.dll + ${CMAKE_BUILD_DIR}/aws-c-event-stream.dll COPYONLY) + configure_file(${AWS_DLL_DIR}/aws-checksums.dll ${CMAKE_BUILD_DIR}/aws-checksums.dll + COPYONLY) + configure_file(${AWS_DLL_DIR}/aws-c-http.dll ${CMAKE_BUILD_DIR}/aws-c-http.dll COPYONLY) + configure_file(${AWS_DLL_DIR}/aws-c-io.dll ${CMAKE_BUILD_DIR}/aws-c-io.dll COPYONLY) + configure_file(${AWS_DLL_DIR}/aws-c-mqtt.dll ${CMAKE_BUILD_DIR}/aws-c-mqtt.dll COPYONLY) + configure_file(${AWS_DLL_DIR}/aws-crt-cpp.dll ${CMAKE_BUILD_DIR}/aws-crt-cpp.dll + COPYONLY) + configure_file(${AWS_DLL_DIR}/aws-c-s3.dll ${CMAKE_BUILD_DIR}/aws-c-s3.dll COPYONLY) + configure_file(${AWS_DLL_DIR}/aws-c-sdkutils.dll ${CMAKE_BUILD_DIR}/aws-c-sdkutils.dll + COPYONLY) endif() # ensure AWS SDK libraries built by us could be found by find_package set(s2n_DIR "${AWS_CMAKE_DIR}/s2n/cmake") -set(aws-cpp-sdk-timestream-query_DIR "${AWS_CMAKE_DIR}/cmake/aws-cpp-sdk-timestream-query") +set(aws-cpp-sdk-timestream-query_DIR + "${AWS_CMAKE_DIR}/cmake/aws-cpp-sdk-timestream-query") # Timestream-write directory value is needed for data writer tool -set(aws-cpp-sdk-timestream-write_DIR "${AWS_CMAKE_DIR}/cmake/aws-cpp-sdk-timestream-write") +set(aws-cpp-sdk-timestream-write_DIR + "${AWS_CMAKE_DIR}/cmake/aws-cpp-sdk-timestream-write") set(aws-cpp-sdk-sts_DIR "${AWS_CMAKE_DIR}/cmake/aws-cpp-sdk-sts") set(aws-cpp-sdk-core_DIR "${AWS_CMAKE_DIR}/cmake/aws-cpp-sdk-core") set(aws-crt-cpp_DIR "${AWS_CMAKE_DIR}/aws-crt-cpp/cmake") @@ -82,14 +94,16 @@ set(aws-c-sdkutils_DIR "${AWS_CMAKE_DIR}/aws-c-sdkutils/cmake") set(AWSSDK_DIR "${AWS_CMAKE_DIR}/cmake/AWSSDK") include("${CMAKE_CURRENT_SOURCE_DIR}/modules/code-coverage.cmake") -if (NOT "$ENV{BOOST_ROOT}" STREQUAL "") - set(BOOST_ROOT "$ENV{BOOST_ROOT}") +if(NOT "$ENV{BOOST_ROOT}" STREQUAL "") + set(BOOST_ROOT "$ENV{BOOST_ROOT}") endif() set(CMAKE_CXX_STANDARD 11) set(CMAKE_PROJECT_VERSION ${PROJECT_VERSION}) set(CMAKE_MODULE_PATH ${CMAKE_MODULE_PATH} "${CMAKE_SOURCE_DIR}/cmake") -set(CMAKE_CXX_FLAGS "${CMAKE_CXX_FLAGS} -DIGNITE_IMPL -DIGNITE_FRIEND -D__STDC_LIMIT_MACROS -D__STDC_CONSTANT_MACROS") +set(CMAKE_CXX_FLAGS + "${CMAKE_CXX_FLAGS} -DIGNITE_IMPL -DIGNITE_FRIEND -D__STDC_LIMIT_MACROS -D__STDC_CONSTANT_MACROS" +) set(CMAKE_SKIP_BUILD_RPATH FALSE) set(CMAKE_BUILD_WITH_INSTALL_RPATH FALSE) @@ -97,53 +111,53 @@ set(CMAKE_INSTALL_RPATH "${CMAKE_INSTALL_PREFIX}/lib") set(CMAKE_INSTALL_RPATH_USE_LINK_PATH TRUE) set(PROJECT_ROOT "${CMAKE_CURRENT_SOURCE_DIR}/..") -list(FIND CMAKE_PLATFORM_IMPLICIT_LINK_DIRECTORIES "${CMAKE_INSTALL_PREFIX}/lib" isSystemDir) +list(FIND CMAKE_PLATFORM_IMPLICIT_LINK_DIRECTORIES "${CMAKE_INSTALL_PREFIX}/lib" + isSystemDir) if("${isSystemDir}" STREQUAL "-1") - set(CMAKE_INSTALL_RPATH "${CMAKE_INSTALL_PREFIX}/lib") + set(CMAKE_INSTALL_RPATH "${CMAKE_INSTALL_PREFIX}/lib") endif("${isSystemDir}" STREQUAL "-1") add_definitions(-DUNICODE=1) -if (WIN32) +if(WIN32) - set (CMAKE_LIBRARY_OUTPUT_DIRECTORY ${CMAKE_BINARY_DIR}) + set(CMAKE_LIBRARY_OUTPUT_DIRECTORY ${CMAKE_BINARY_DIR}) - set (CMAKE_RUNTIME_OUTPUT_DIRECTORY ${CMAKE_BINARY_DIR}) + set(CMAKE_RUNTIME_OUTPUT_DIRECTORY ${CMAKE_BINARY_DIR}) else() - set(CMAKE_ARCHIVE_OUTPUT_DIRECTORY "${CMAKE_CURRENT_SOURCE_DIR}/../build/odbc/lib") - set(CMAKE_LIBRARY_OUTPUT_DIRECTORY "${CMAKE_CURRENT_SOURCE_DIR}/../build/odbc/lib") - set(CMAKE_RUNTIME_OUTPUT_DIRECTORY "${CMAKE_CURRENT_SOURCE_DIR}/../build/odbc/bin") + set(CMAKE_ARCHIVE_OUTPUT_DIRECTORY "${CMAKE_CURRENT_SOURCE_DIR}/../build/odbc/lib") + set(CMAKE_LIBRARY_OUTPUT_DIRECTORY "${CMAKE_CURRENT_SOURCE_DIR}/../build/odbc/lib") + set(CMAKE_RUNTIME_OUTPUT_DIRECTORY "${CMAKE_CURRENT_SOURCE_DIR}/../build/odbc/bin") endif() -if (MSVC) - add_compile_options(/source-charset:utf-8 /execution-charset:utf-8) +if(MSVC) + add_compile_options(/source-charset:utf-8 /execution-charset:utf-8) - add_definitions(-D_CRT_SECURE_NO_WARNINGS -D_SCL_SECURE_NO_WARNINGS) + add_definitions(-D_CRT_SECURE_NO_WARNINGS -D_SCL_SECURE_NO_WARNINGS) endif() -option (WITH_ODBC OFF) -option (WITH_ODBC_MSI OFF) -option (WITH_THIN_CLIENT OFF) -option (WITH_TESTS OFF) -option (WARNINGS_AS_ERRORS OFF) - -if (${WARNINGS_AS_ERRORS}) - if (MSVC) - add_compile_options(/WX) - else() - add_compile_options(-Wall -Wextra -Werror -Wno-variadic-macros) - endif() +option(WITH_ODBC OFF) +option(WITH_ODBC_MSI OFF) +option(WITH_THIN_CLIENT OFF) +option(WITH_TESTS OFF) +option(WARNINGS_AS_ERRORS OFF) + +if(${WARNINGS_AS_ERRORS}) + if(MSVC) + add_compile_options(/WX) + else() + add_compile_options(-Wall -Wextra -Werror -Wno-variadic-macros) + endif() endif() -if (${WITH_ODBC}) - add_subdirectory(odbc) +if(${WITH_ODBC}) + add_subdirectory(odbc) endif() -if (${WITH_TESTS}) - enable_testing() +if(${WITH_TESTS}) + enable_testing() - if (EXISTS ${CMAKE_SOURCE_DIR}/tests) - add_subdirectory(tests) - endif() + if(EXISTS ${CMAKE_SOURCE_DIR}/tests) + add_subdirectory(tests) + endif() endif() - diff --git a/cpp/src/arrow/flight/sql/amazon-timestream-odbc-driver/src/cmake/FindIgnite.cmake b/cpp/src/arrow/flight/sql/amazon-timestream-odbc-driver/src/cmake/FindIgnite.cmake index 6fc7acb8e0447..76dc2faa8fb0f 100644 --- a/cpp/src/arrow/flight/sql/amazon-timestream-odbc-driver/src/cmake/FindIgnite.cmake +++ b/cpp/src/arrow/flight/sql/amazon-timestream-odbc-driver/src/cmake/FindIgnite.cmake @@ -16,37 +16,39 @@ # find_path(IGNITE_INCLUDE_DIR ignite/ignite.h - HINTS ${IGNITE_CPP_DIR}/include - PATH_SUFFIXES ignite) + HINTS ${IGNITE_CPP_DIR}/include + PATH_SUFFIXES ignite) -if (WIN32) - find_library(IGNITE_LIB ignite.core HINTS ${IGNITE_CPP_DIR}/lib) +if(WIN32) + find_library(IGNITE_LIB ignite.core HINTS ${IGNITE_CPP_DIR}/lib) - find_library(IGNITE_COMMON_LIB ignite.common HINTS ${IGNITE_CPP_DIR}/lib) + find_library(IGNITE_COMMON_LIB ignite.common HINTS ${IGNITE_CPP_DIR}/lib) - find_library(IGNITE_NETWORK_LIB ignite.network HINTS ${IGNITE_CPP_DIR}/lib) + find_library(IGNITE_NETWORK_LIB ignite.network HINTS ${IGNITE_CPP_DIR}/lib) - find_library(IGNITE_THIN_CLIENT_LIB ignite.thin-client HINTS ${IGNITE_CPP_DIR}/lib) + find_library(IGNITE_THIN_CLIENT_LIB ignite.thin-client HINTS ${IGNITE_CPP_DIR}/lib) - find_library(IGNITE_BINARY_LIB ignite.binary HINTS ${IGNITE_CPP_DIR}/lib) + find_library(IGNITE_BINARY_LIB ignite.binary HINTS ${IGNITE_CPP_DIR}/lib) else() - find_library(IGNITE_LIB ignite HINTS ${IGNITE_CPP_DIR}/lib) + find_library(IGNITE_LIB ignite HINTS ${IGNITE_CPP_DIR}/lib) - find_library(IGNITE_COMMON_LIB ignite-common HINTS ${IGNITE_CPP_DIR}/lib) + find_library(IGNITE_COMMON_LIB ignite-common HINTS ${IGNITE_CPP_DIR}/lib) - find_library(IGNITE_NETWORK_LIB ignite-network HINTS ${IGNITE_CPP_DIR}/lib) + find_library(IGNITE_NETWORK_LIB ignite-network HINTS ${IGNITE_CPP_DIR}/lib) - find_library(IGNITE_THIN_CLIENT_LIB ignite-thin-client HINTS ${IGNITE_CPP_DIR}/lib) + find_library(IGNITE_THIN_CLIENT_LIB ignite-thin-client HINTS ${IGNITE_CPP_DIR}/lib) - find_library(IGNITE_BINARY_LIB ignite-binary HINTS ${IGNITE_CPP_DIR}/lib) + find_library(IGNITE_BINARY_LIB ignite-binary HINTS ${IGNITE_CPP_DIR}/lib) endif() include(FindPackageHandleStandardArgs) -find_package_handle_standard_args(Ignite DEFAULT_MSG - IGNITE_LIB - IGNITE_THIN_CLIENT_LIB - IGNITE_BINARY_LIB - IGNITE_NETWORK_LIB - IGNITE_COMMON_LIB - IGNITE_INCLUDE_DIR) +find_package_handle_standard_args( + Ignite + DEFAULT_MSG + IGNITE_LIB + IGNITE_THIN_CLIENT_LIB + IGNITE_BINARY_LIB + IGNITE_NETWORK_LIB + IGNITE_COMMON_LIB + IGNITE_INCLUDE_DIR) diff --git a/cpp/src/arrow/flight/sql/amazon-timestream-odbc-driver/src/cmake/FindODBC.cmake b/cpp/src/arrow/flight/sql/amazon-timestream-odbc-driver/src/cmake/FindODBC.cmake index b730f25ffcdf0..29e3f9ff2d0ba 100644 --- a/cpp/src/arrow/flight/sql/amazon-timestream-odbc-driver/src/cmake/FindODBC.cmake +++ b/cpp/src/arrow/flight/sql/amazon-timestream-odbc-driver/src/cmake/FindODBC.cmake @@ -9,101 +9,103 @@ set(_odbc_required_libs_names) ### Try Windows Kits ########################################################## if(WIN32) - # List names of ODBC libraries on Windows - if(NOT MINGW) - set(ODBC_LIBRARY odbc32.lib) - else() - set(ODBC_LIBRARY libodbc32.a) - endif() - - set(_odbc_lib_names odbc32;) - - # List additional libraries required to use ODBC library - if(MSVC OR CMAKE_CXX_COMPILER_ID MATCHES "Intel") - set(_odbc_required_libs_names odbccp32;ws2_32) - elseif(MINGW) - set(_odbc_required_libs_names odbccp32) - endif() + # List names of ODBC libraries on Windows + if(NOT MINGW) + set(ODBC_LIBRARY odbc32.lib) + else() + set(ODBC_LIBRARY libodbc32.a) + endif() + + set(_odbc_lib_names odbc32;) + + # List additional libraries required to use ODBC library + if(MSVC OR CMAKE_CXX_COMPILER_ID MATCHES "Intel") + set(_odbc_required_libs_names odbccp32;ws2_32) + elseif(MINGW) + set(_odbc_required_libs_names odbccp32) + endif() endif() ### Try unixODBC or iODBC config program ###################################### -if (UNIX) - find_program(ODBC_CONFIG - NAMES odbc_config iodbc-config - DOC "Path to unixODBC config program") - mark_as_advanced(ODBC_CONFIG) +if(UNIX) + find_program(ODBC_CONFIG + NAMES odbc_config iodbc-config + DOC "Path to unixODBC config program") + mark_as_advanced(ODBC_CONFIG) endif() -if (UNIX AND ODBC_CONFIG) - # unixODBC and iODBC accept unified command line options - execute_process(COMMAND ${ODBC_CONFIG} --cflags - OUTPUT_VARIABLE _cflags OUTPUT_STRIP_TRAILING_WHITESPACE) - execute_process(COMMAND ${ODBC_CONFIG} --libs - OUTPUT_VARIABLE _libs OUTPUT_STRIP_TRAILING_WHITESPACE) - - # Collect paths of include directories from CFLAGS - separate_arguments(_cflags UNIX_COMMAND "${_cflags}") - foreach(arg IN LISTS _cflags) - if("${arg}" MATCHES "^-I(.*)$") - list(APPEND _odbc_include_paths "${CMAKE_MATCH_1}") - endif() - endforeach() - unset(_cflags) - - # Collect paths of library names and directories from LIBS - separate_arguments(_libs UNIX_COMMAND "${_libs}") - foreach(arg IN LISTS _libs) - if("${arg}" MATCHES "^-L(.*)$") - list(APPEND _odbc_lib_paths "${CMAKE_MATCH_1}") - elseif("${arg}" MATCHES "^-l(.*)$") - set(_lib_name ${CMAKE_MATCH_1}) - string(REGEX MATCH "odbc" _is_odbc ${_lib_name}) - if(_is_odbc) - list(APPEND _odbc_lib_names ${_lib_name}) - if (${_lib_name} STREQUAL odbc) - list(APPEND _odbc_required_libs_names odbcinst) - endif() - else() - list(APPEND _odbc_required_libs_names ${_lib_name}) - endif() - unset(_lib_name) +if(UNIX AND ODBC_CONFIG) + # unixODBC and iODBC accept unified command line options + execute_process(COMMAND ${ODBC_CONFIG} --cflags + OUTPUT_VARIABLE _cflags + OUTPUT_STRIP_TRAILING_WHITESPACE) + execute_process(COMMAND ${ODBC_CONFIG} --libs + OUTPUT_VARIABLE _libs + OUTPUT_STRIP_TRAILING_WHITESPACE) + + # Collect paths of include directories from CFLAGS + separate_arguments(_cflags UNIX_COMMAND "${_cflags}") + foreach(arg IN LISTS _cflags) + if("${arg}" MATCHES "^-I(.*)$") + list(APPEND _odbc_include_paths "${CMAKE_MATCH_1}") + endif() + endforeach() + unset(_cflags) + + # Collect paths of library names and directories from LIBS + separate_arguments(_libs UNIX_COMMAND "${_libs}") + foreach(arg IN LISTS _libs) + if("${arg}" MATCHES "^-L(.*)$") + list(APPEND _odbc_lib_paths "${CMAKE_MATCH_1}") + elseif("${arg}" MATCHES "^-l(.*)$") + set(_lib_name ${CMAKE_MATCH_1}) + string(REGEX MATCH "odbc" _is_odbc ${_lib_name}) + if(_is_odbc) + list(APPEND _odbc_lib_names ${_lib_name}) + if(${_lib_name} STREQUAL odbc) + list(APPEND _odbc_required_libs_names odbcinst) endif() - endforeach() - unset(_libs) + else() + list(APPEND _odbc_required_libs_names ${_lib_name}) + endif() + unset(_lib_name) + endif() + endforeach() + unset(_libs) endif() ### Try unixODBC or iODBC in include/lib filesystems ########################## -if (UNIX AND NOT ODBC_CONFIG) - # List names of both ODBC libraries and unixODBC - set(_odbc_lib_names odbc;odbcinst;iodbc;unixodbc;) +if(UNIX AND NOT ODBC_CONFIG) + # List names of both ODBC libraries and unixODBC + set(_odbc_lib_names odbc;odbcinst;iodbc;unixodbc;) endif() ### Find include directories ################################################## find_path(ODBC_INCLUDE_DIR - NAMES sql.h - PATHS ${_odbc_include_paths}) + NAMES sql.h + PATHS ${_odbc_include_paths}) if(NOT ODBC_INCLUDE_DIR AND WIN32) - set(ODBC_INCLUDE_DIR "") + set(ODBC_INCLUDE_DIR "") endif() ### Find libraries ############################################################ if(NOT ODBC_LIBRARY) - find_library(ODBC_LIBRARY - NAMES ${_odbc_lib_names} - PATHS ${_odbc_lib_paths} - PATH_SUFFIXES odbc) - - foreach(_lib IN LISTS _odbc_required_libs_names) - find_library(_lib_path - NAMES ${_lib} - PATHS ${_odbc_lib_paths} # system paths or collected from ODBC_CONFIG - PATH_SUFFIXES odbc) - if(_lib_path) - list(APPEND _odbc_required_libs_paths ${_lib_path}) - endif() - unset(_lib_path CACHE) - endforeach() + find_library(ODBC_LIBRARY + NAMES ${_odbc_lib_names} + PATHS ${_odbc_lib_paths} + PATH_SUFFIXES odbc) + + foreach(_lib IN LISTS _odbc_required_libs_names) + find_library(_lib_path + NAMES ${_lib} + PATHS ${_odbc_lib_paths} # system paths or collected from ODBC_CONFIG + PATH_SUFFIXES odbc) + if(_lib_path) + list(APPEND _odbc_required_libs_paths ${_lib_path}) + endif() + unset(_lib_path CACHE) + endforeach() endif() # Unset internal lists as no longer used @@ -115,7 +117,7 @@ unset(_odbc_required_libs_names) ### Set result variables ###################################################### set(_odbc_required_vars ODBC_LIBRARY) if(NOT WIN32) - list(APPEND _odbc_required_vars ODBC_INCLUDE_DIR) + list(APPEND _odbc_required_vars ODBC_INCLUDE_DIR) endif() include(FindPackageHandleStandardArgs) @@ -131,25 +133,24 @@ list(APPEND ODBC_LIBRARIES ${_odbc_required_libs_paths}) ### Import targets ############################################################ if(ODBC_FOUND) - if(NOT TARGET ODBC::ODBC) - if(IS_ABSOLUTE "${ODBC_LIBRARY}") - add_library(ODBC::ODBC UNKNOWN IMPORTED) - set_target_properties(ODBC::ODBC PROPERTIES - IMPORTED_LINK_INTERFACE_LANGUAGES "C" - IMPORTED_LOCATION "${ODBC_LIBRARY}") - else() - add_library(ODBC::ODBC INTERFACE IMPORTED) - set_target_properties(ODBC::ODBC PROPERTIES - IMPORTED_LIBNAME "${ODBC_LIBRARY}") - endif() - set_target_properties(ODBC::ODBC PROPERTIES - INTERFACE_INCLUDE_DIRECTORIES "${ODBC_INCLUDE_DIR}") + if(NOT TARGET ODBC::ODBC) + if(IS_ABSOLUTE "${ODBC_LIBRARY}") + add_library(ODBC::ODBC UNKNOWN IMPORTED) + set_target_properties(ODBC::ODBC PROPERTIES IMPORTED_LINK_INTERFACE_LANGUAGES "C" + IMPORTED_LOCATION "${ODBC_LIBRARY}") + else() + add_library(ODBC::ODBC INTERFACE IMPORTED) + set_target_properties(ODBC::ODBC PROPERTIES IMPORTED_LIBNAME "${ODBC_LIBRARY}") + endif() + set_target_properties(ODBC::ODBC PROPERTIES INTERFACE_INCLUDE_DIRECTORIES + "${ODBC_INCLUDE_DIR}") - if(_odbc_required_libs_paths) - set_property(TARGET ODBC::ODBC APPEND PROPERTY - INTERFACE_LINK_LIBRARIES "${_odbc_required_libs_paths}") - endif() + if(_odbc_required_libs_paths) + set_property(TARGET ODBC::ODBC + APPEND + PROPERTY INTERFACE_LINK_LIBRARIES "${_odbc_required_libs_paths}") endif() + endif() endif() unset(_odbc_required_libs_paths) diff --git a/cpp/src/arrow/flight/sql/amazon-timestream-odbc-driver/src/linux_32bit_toolchain.cmake b/cpp/src/arrow/flight/sql/amazon-timestream-odbc-driver/src/linux_32bit_toolchain.cmake index 434ade2736d37..7086ac7e03a46 100644 --- a/cpp/src/arrow/flight/sql/amazon-timestream-odbc-driver/src/linux_32bit_toolchain.cmake +++ b/cpp/src/arrow/flight/sql/amazon-timestream-odbc-driver/src/linux_32bit_toolchain.cmake @@ -21,8 +21,7 @@ set(CMAKE_CXX_COMPILER g++) set(CMAKE_CXX_FLAGS "-m32 -Wno-error=deprecated-declarations") set(CMAKE_SHARED_LINKER_FLAGS -m32) -# here is the target environment location -set(CMAKE_FIND_ROOT_PATH /usr/i386-linux-gnu) +# here is the target environment location +set(CMAKE_FIND_ROOT_PATH /usr/i386-linux-gnu) set(CMAKE_LIBRARY_PATH "/usr/lib/i386-linux-gnu") include_directories(BEFORE /usr/include/i386-linux-gnu) - diff --git a/cpp/src/arrow/flight/sql/amazon-timestream-odbc-driver/src/modules/code-coverage.cmake b/cpp/src/arrow/flight/sql/amazon-timestream-odbc-driver/src/modules/code-coverage.cmake index 0aa0b41375758..cdf7deec95f8c 100644 --- a/cpp/src/arrow/flight/sql/amazon-timestream-odbc-driver/src/modules/code-coverage.cmake +++ b/cpp/src/arrow/flight/sql/amazon-timestream-odbc-driver/src/modules/code-coverage.cmake @@ -74,10 +74,8 @@ # ~~~ # Options -option( - CODE_COVERAGE - "Builds targets with code coverage instrumentation. (Requires GCC or Clang)" - OFF) +option(CODE_COVERAGE + "Builds targets with code coverage instrumentation. (Requires GCC or Clang)" OFF) # Programs find_program(LLVM_COV_PATH llvm-cov) @@ -85,7 +83,11 @@ find_program(LLVM_PROFDATA_PATH llvm-profdata) find_program(LCOV_PATH lcov) find_program(GENHTML_PATH genhtml) # Hide behind the 'advanced' mode flag for GUI/ccmake -mark_as_advanced(FORCE LLVM_COV_PATH LLVM_PROFDATA_PATH LCOV_PATH GENHTML_PATH) +mark_as_advanced(FORCE + LLVM_COV_PATH + LLVM_PROFDATA_PATH + LCOV_PATH + GENHTML_PATH) # Variables set(CMAKE_COVERAGE_OUTPUT_DIRECTORY ${CMAKE_BINARY_DIR}/ccov) @@ -96,14 +98,13 @@ if(CODE_COVERAGE AND NOT CODE_COVERAGE_ADDED) set(CODE_COVERAGE_ADDED ON) # Common Targets - add_custom_target( - ccov-preprocessing - COMMAND ${CMAKE_COMMAND} -E make_directory - ${CMAKE_COVERAGE_OUTPUT_DIRECTORY} - DEPENDS ccov-clean) - - if(CMAKE_C_COMPILER_ID MATCHES "(Apple)?[Cc]lang" - OR CMAKE_CXX_COMPILER_ID MATCHES "(Apple)?[Cc]lang") + add_custom_target(ccov-preprocessing + COMMAND ${CMAKE_COMMAND} -E make_directory + ${CMAKE_COVERAGE_OUTPUT_DIRECTORY} + DEPENDS ccov-clean) + + if(CMAKE_C_COMPILER_ID MATCHES "(Apple)?[Cc]lang" OR CMAKE_CXX_COMPILER_ID MATCHES + "(Apple)?[Cc]lang") # Messages message(STATUS "Building with llvm Code Coverage Tools") @@ -117,54 +118,44 @@ if(CODE_COVERAGE AND NOT CODE_COVERAGE_ADDED) ${LLVM_COV_VERSION_CALL_OUTPUT}) if(LLVM_COV_VERSION VERSION_LESS "7.0.0") - message( - WARNING - "target_code_coverage()/add_code_coverage_all_targets() 'EXCLUDE' option only available on llvm-cov >= 7.0.0" + message(WARNING "target_code_coverage()/add_code_coverage_all_targets() 'EXCLUDE' option only available on llvm-cov >= 7.0.0" ) endif() endif() # Targets if(${CMAKE_VERSION} VERSION_LESS "3.17.0") - add_custom_target( - ccov-clean - COMMAND ${CMAKE_COMMAND} -E remove -f - ${CMAKE_COVERAGE_OUTPUT_DIRECTORY}/binaries.list - COMMAND ${CMAKE_COMMAND} -E remove -f - ${CMAKE_COVERAGE_OUTPUT_DIRECTORY}/profraw.list) + add_custom_target(ccov-clean + COMMAND ${CMAKE_COMMAND} -E remove -f + ${CMAKE_COVERAGE_OUTPUT_DIRECTORY}/binaries.list + COMMAND ${CMAKE_COMMAND} -E remove -f + ${CMAKE_COVERAGE_OUTPUT_DIRECTORY}/profraw.list) else() - add_custom_target( - ccov-clean - COMMAND ${CMAKE_COMMAND} -E rm -f - ${CMAKE_COVERAGE_OUTPUT_DIRECTORY}/binaries.list - COMMAND ${CMAKE_COMMAND} -E rm -f - ${CMAKE_COVERAGE_OUTPUT_DIRECTORY}/profraw.list) + add_custom_target(ccov-clean + COMMAND ${CMAKE_COMMAND} -E rm -f + ${CMAKE_COVERAGE_OUTPUT_DIRECTORY}/binaries.list + COMMAND ${CMAKE_COMMAND} -E rm -f + ${CMAKE_COVERAGE_OUTPUT_DIRECTORY}/profraw.list) endif() # Used to get the shared object file list before doing the main all- # processing - add_custom_target( - ccov-libs - COMMAND ; - COMMENT "libs ready for coverage report.") + add_custom_target(ccov-libs + COMMAND ; + COMMENT "libs ready for coverage report.") - elseif(CMAKE_C_COMPILER_ID MATCHES "GNU" OR CMAKE_CXX_COMPILER_ID MATCHES - "GNU") + elseif(CMAKE_C_COMPILER_ID MATCHES "GNU" OR CMAKE_CXX_COMPILER_ID MATCHES "GNU") # Messages message(STATUS "Building with lcov Code Coverage Tools") if(CMAKE_BUILD_TYPE) string(TOUPPER ${CMAKE_BUILD_TYPE} upper_build_type) if(NOT ${upper_build_type} STREQUAL "DEBUG") - message( - WARNING - "Code coverage results with an optimized (non-Debug) build may be misleading" + message(WARNING "Code coverage results with an optimized (non-Debug) build may be misleading" ) endif() else() - message( - WARNING - "Code coverage results with an optimized (non-Debug) build may be misleading" + message(WARNING "Code coverage results with an optimized (non-Debug) build may be misleading" ) endif() if(NOT LCOV_PATH) @@ -175,8 +166,8 @@ if(CODE_COVERAGE AND NOT CODE_COVERAGE_ADDED) endif() # Targets - add_custom_target(ccov-clean COMMAND ${LCOV_PATH} --directory - ${CMAKE_BINARY_DIR} --zerocounters) + add_custom_target(ccov-clean COMMAND ${LCOV_PATH} --directory ${CMAKE_BINARY_DIR} + --zerocounters) else() message(FATAL_ERROR "Code coverage requires Clang or GCC. Aborting.") @@ -219,12 +210,20 @@ endif() # ~~~ function(target_code_coverage TARGET_NAME) # Argument parsing - set(options AUTO ALL EXTERNAL PUBLIC INTERFACE PLAIN) + set(options + AUTO + ALL + EXTERNAL + PUBLIC + INTERFACE + PLAIN) set(single_value_keywords COVERAGE_TARGET_NAME) set(multi_value_keywords EXCLUDE OBJECTS ARGS) - cmake_parse_arguments( - target_code_coverage "${options}" "${single_value_keywords}" - "${multi_value_keywords}" ${ARGN}) + cmake_parse_arguments(target_code_coverage + "${options}" + "${single_value_keywords}" + "${multi_value_keywords}" + ${ARGN}) # Set the visibility of target functions to PUBLIC, INTERFACE or default to # PRIVATE. @@ -250,14 +249,11 @@ function(target_code_coverage TARGET_NAME) if(CODE_COVERAGE) # Add code coverage instrumentation to the target's linker command - if(CMAKE_C_COMPILER_ID MATCHES "(Apple)?[Cc]lang" - OR CMAKE_CXX_COMPILER_ID MATCHES "(Apple)?[Cc]lang") - target_compile_options(${TARGET_NAME} ${TARGET_VISIBILITY} - --coverage) - target_link_options(${TARGET_NAME} ${TARGET_VISIBILITY} - --coverage) - elseif(CMAKE_C_COMPILER_ID MATCHES "GNU" OR CMAKE_CXX_COMPILER_ID MATCHES - "GNU") + if(CMAKE_C_COMPILER_ID MATCHES "(Apple)?[Cc]lang" OR CMAKE_CXX_COMPILER_ID MATCHES + "(Apple)?[Cc]lang") + target_compile_options(${TARGET_NAME} ${TARGET_VISIBILITY} --coverage) + target_link_options(${TARGET_NAME} ${TARGET_VISIBILITY} --coverage) + elseif(CMAKE_C_COMPILER_ID MATCHES "GNU" OR CMAKE_CXX_COMPILER_ID MATCHES "GNU") target_compile_options(${TARGET_NAME} ${TARGET_VISIBILITY} -fprofile-arcs -ftest-coverage) target_link_libraries(${TARGET_NAME} gcov) @@ -268,31 +264,27 @@ function(target_code_coverage TARGET_NAME) # Add shared library to processing for 'all' targets if(target_type STREQUAL "SHARED_LIBRARY" AND target_code_coverage_ALL) - if(CMAKE_C_COMPILER_ID MATCHES "(Apple)?[Cc]lang" - OR CMAKE_CXX_COMPILER_ID MATCHES "(Apple)?[Cc]lang") - add_custom_target( - ccov-run-${target_code_coverage_COVERAGE_TARGET_NAME} - COMMAND - ${CMAKE_COMMAND} -E echo "-object=$" >> - ${CMAKE_COVERAGE_OUTPUT_DIRECTORY}/binaries.list - DEPENDS ccov-preprocessing ${TARGET_NAME}) + if(CMAKE_C_COMPILER_ID MATCHES "(Apple)?[Cc]lang" OR CMAKE_CXX_COMPILER_ID MATCHES + "(Apple)?[Cc]lang") + add_custom_target(ccov-run-${target_code_coverage_COVERAGE_TARGET_NAME} + COMMAND ${CMAKE_COMMAND} -E echo + "-object=$" >> + ${CMAKE_COVERAGE_OUTPUT_DIRECTORY}/binaries.list + DEPENDS ccov-preprocessing ${TARGET_NAME}) if(NOT TARGET ccov-libs) - message( - FATAL_ERROR - "Calling target_code_coverage with 'ALL' must be after a call to 'add_code_coverage_all_targets'." + message(FATAL_ERROR "Calling target_code_coverage with 'ALL' must be after a call to 'add_code_coverage_all_targets'." ) endif() - add_dependencies(ccov-libs - ccov-run-${target_code_coverage_COVERAGE_TARGET_NAME}) + add_dependencies(ccov-libs ccov-run-${target_code_coverage_COVERAGE_TARGET_NAME}) endif() endif() # For executables add targets to run and produce output if(target_type STREQUAL "EXECUTABLE") - if(CMAKE_C_COMPILER_ID MATCHES "(Apple)?[Cc]lang" - OR CMAKE_CXX_COMPILER_ID MATCHES "(Apple)?[Cc]lang") + if(CMAKE_C_COMPILER_ID MATCHES "(Apple)?[Cc]lang" OR CMAKE_CXX_COMPILER_ID MATCHES + "(Apple)?[Cc]lang") # If there are shared objects to also work with, generate the string to # add them here @@ -309,95 +301,88 @@ function(target_code_coverage TARGET_NAME) # Run the executable, generating raw profile data Make the run data # available for further processing. Separated to allow Windows to run # this target serially. - add_custom_target( - ccov-run-${target_code_coverage_COVERAGE_TARGET_NAME} - COMMAND - ${CMAKE_COMMAND} -E env - LLVM_PROFILE_FILE=${target_code_coverage_COVERAGE_TARGET_NAME}.profraw - $ ${target_code_coverage_ARGS} - COMMAND - ${CMAKE_COMMAND} -E echo "-object=$" - ${SO_OBJECTS} >> ${CMAKE_COVERAGE_OUTPUT_DIRECTORY}/binaries.list - COMMAND - ${CMAKE_COMMAND} -E echo - "${CMAKE_CURRENT_BINARY_DIR}/${target_code_coverage_COVERAGE_TARGET_NAME}.profraw" - >> ${CMAKE_COVERAGE_OUTPUT_DIRECTORY}/profraw.list - JOB_POOL ccov_serial_pool - DEPENDS ccov-preprocessing ccov-libs ${TARGET_NAME}) + add_custom_target(ccov-run-${target_code_coverage_COVERAGE_TARGET_NAME} + COMMAND ${CMAKE_COMMAND} -E env + LLVM_PROFILE_FILE=${target_code_coverage_COVERAGE_TARGET_NAME}.profraw + $ + ${target_code_coverage_ARGS} + COMMAND ${CMAKE_COMMAND} -E echo + "-object=$" ${SO_OBJECTS} >> + ${CMAKE_COVERAGE_OUTPUT_DIRECTORY}/binaries.list + COMMAND ${CMAKE_COMMAND} -E echo + "${CMAKE_CURRENT_BINARY_DIR}/${target_code_coverage_COVERAGE_TARGET_NAME}.profraw" + >> ${CMAKE_COVERAGE_OUTPUT_DIRECTORY}/profraw.list + JOB_POOL ccov_serial_pool + DEPENDS ccov-preprocessing ccov-libs ${TARGET_NAME}) # Merge the generated profile data so llvm-cov can process it - add_custom_target( - ccov-processing-${target_code_coverage_COVERAGE_TARGET_NAME} - COMMAND - ${LLVM_PROFDATA_PATH} merge -sparse - ${target_code_coverage_COVERAGE_TARGET_NAME}.profraw -o - ${target_code_coverage_COVERAGE_TARGET_NAME}.profdata - DEPENDS ccov-run-${target_code_coverage_COVERAGE_TARGET_NAME}) + add_custom_target(ccov-processing-${target_code_coverage_COVERAGE_TARGET_NAME} + COMMAND ${LLVM_PROFDATA_PATH} merge -sparse + ${target_code_coverage_COVERAGE_TARGET_NAME}.profraw -o + ${target_code_coverage_COVERAGE_TARGET_NAME}.profdata + DEPENDS ccov-run-${target_code_coverage_COVERAGE_TARGET_NAME}) # Ignore regex only works on LLVM >= 7 if(LLVM_COV_VERSION VERSION_GREATER_EQUAL "7.0.0") foreach(EXCLUDE_ITEM ${target_code_coverage_EXCLUDE}) - set(EXCLUDE_REGEX ${EXCLUDE_REGEX} - -ignore-filename-regex='${EXCLUDE_ITEM}') + set(EXCLUDE_REGEX ${EXCLUDE_REGEX} -ignore-filename-regex='${EXCLUDE_ITEM}') endforeach() endif() # Print out details of the coverage information to the command line - add_custom_target( - ccov-show-${target_code_coverage_COVERAGE_TARGET_NAME} - COMMAND - ${LLVM_COV_PATH} show $ ${SO_OBJECTS} - -instr-profile=${target_code_coverage_COVERAGE_TARGET_NAME}.profdata - -show-line-counts-or-regions ${EXCLUDE_REGEX} - DEPENDS ccov-processing-${target_code_coverage_COVERAGE_TARGET_NAME}) + add_custom_target(ccov-show-${target_code_coverage_COVERAGE_TARGET_NAME} + COMMAND ${LLVM_COV_PATH} show $ + ${SO_OBJECTS} + -instr-profile=${target_code_coverage_COVERAGE_TARGET_NAME}.profdata + -show-line-counts-or-regions ${EXCLUDE_REGEX} + DEPENDS ccov-processing-${target_code_coverage_COVERAGE_TARGET_NAME} + ) # Print out a summary of the coverage information to the command line - add_custom_target( - ccov-report-${target_code_coverage_COVERAGE_TARGET_NAME} - COMMAND - ${LLVM_COV_PATH} report $ ${SO_OBJECTS} - -instr-profile=${target_code_coverage_COVERAGE_TARGET_NAME}.profdata - ${EXCLUDE_REGEX} - DEPENDS ccov-processing-${target_code_coverage_COVERAGE_TARGET_NAME}) + add_custom_target(ccov-report-${target_code_coverage_COVERAGE_TARGET_NAME} + COMMAND ${LLVM_COV_PATH} report $ + ${SO_OBJECTS} + -instr-profile=${target_code_coverage_COVERAGE_TARGET_NAME}.profdata + ${EXCLUDE_REGEX} + DEPENDS ccov-processing-${target_code_coverage_COVERAGE_TARGET_NAME} + ) # Export coverage information so continuous integration tools (e.g. # Jenkins) can consume it - add_custom_target( - ccov-export-${target_code_coverage_COVERAGE_TARGET_NAME} - COMMAND - ${LLVM_COV_PATH} export $ ${SO_OBJECTS} - -instr-profile=${target_code_coverage_COVERAGE_TARGET_NAME}.profdata - -format="text" ${EXCLUDE_REGEX} > - ${CMAKE_COVERAGE_OUTPUT_DIRECTORY}/${target_code_coverage_COVERAGE_TARGET_NAME}.json - DEPENDS ccov-processing-${target_code_coverage_COVERAGE_TARGET_NAME}) + add_custom_target(ccov-export-${target_code_coverage_COVERAGE_TARGET_NAME} + COMMAND ${LLVM_COV_PATH} export $ + ${SO_OBJECTS} + -instr-profile=${target_code_coverage_COVERAGE_TARGET_NAME}.profdata + -format="text" ${EXCLUDE_REGEX} > + ${CMAKE_COVERAGE_OUTPUT_DIRECTORY}/${target_code_coverage_COVERAGE_TARGET_NAME}.json + DEPENDS ccov-processing-${target_code_coverage_COVERAGE_TARGET_NAME} + ) # Generates HTML output of the coverage information for perusal - add_custom_target( - ccov-${target_code_coverage_COVERAGE_TARGET_NAME} - COMMAND - ${LLVM_COV_PATH} show $ ${SO_OBJECTS} - -instr-profile=${target_code_coverage_COVERAGE_TARGET_NAME}.profdata - -show-line-counts-or-regions - -output-dir=${CMAKE_COVERAGE_OUTPUT_DIRECTORY}/${target_code_coverage_COVERAGE_TARGET_NAME} - -format="html" ${EXCLUDE_REGEX} - DEPENDS ccov-processing-${target_code_coverage_COVERAGE_TARGET_NAME}) - - elseif(CMAKE_C_COMPILER_ID MATCHES "GNU" OR CMAKE_CXX_COMPILER_ID MATCHES - "GNU") + add_custom_target(ccov-${target_code_coverage_COVERAGE_TARGET_NAME} + COMMAND ${LLVM_COV_PATH} show $ + ${SO_OBJECTS} + -instr-profile=${target_code_coverage_COVERAGE_TARGET_NAME}.profdata + -show-line-counts-or-regions + -output-dir=${CMAKE_COVERAGE_OUTPUT_DIRECTORY}/${target_code_coverage_COVERAGE_TARGET_NAME} + -format="html" ${EXCLUDE_REGEX} + DEPENDS ccov-processing-${target_code_coverage_COVERAGE_TARGET_NAME} + ) + + elseif(CMAKE_C_COMPILER_ID MATCHES "GNU" OR CMAKE_CXX_COMPILER_ID MATCHES "GNU") set(COVERAGE_INFO "${CMAKE_COVERAGE_OUTPUT_DIRECTORY}/${target_code_coverage_COVERAGE_TARGET_NAME}.info" ) # Run the executable, generating coverage information - add_custom_target( - ccov-run-${target_code_coverage_COVERAGE_TARGET_NAME} - COMMAND $ ${target_code_coverage_ARGS} - DEPENDS ccov-preprocessing ${TARGET_NAME}) + add_custom_target(ccov-run-${target_code_coverage_COVERAGE_TARGET_NAME} + COMMAND $ + ${target_code_coverage_ARGS} + DEPENDS ccov-preprocessing ${TARGET_NAME}) # Generate exclusion string for use foreach(EXCLUDE_ITEM ${target_code_coverage_EXCLUDE}) - set(EXCLUDE_REGEX ${EXCLUDE_REGEX} --remove ${COVERAGE_INFO} - '${EXCLUDE_ITEM}') + set(EXCLUDE_REGEX ${EXCLUDE_REGEX} --remove ${COVERAGE_INFO} '${EXCLUDE_ITEM}') endforeach() if(EXCLUDE_REGEX) @@ -413,47 +398,44 @@ function(target_code_coverage TARGET_NAME) # Capture coverage data if(${CMAKE_VERSION} VERSION_LESS "3.17.0") - add_custom_target( - ccov-capture-${target_code_coverage_COVERAGE_TARGET_NAME} - COMMAND ${CMAKE_COMMAND} -E remove -f ${COVERAGE_INFO} - COMMAND ${LCOV_PATH} --directory ${CMAKE_BINARY_DIR} --zerocounters - COMMAND $ ${target_code_coverage_ARGS} - COMMAND - ${LCOV_PATH} --directory ${CMAKE_BINARY_DIR} --base-directory - ${CMAKE_SOURCE_DIR} --capture ${EXTERNAL_OPTION} --output-file - ${COVERAGE_INFO} - COMMAND ${EXCLUDE_COMMAND} - DEPENDS ccov-preprocessing ${TARGET_NAME}) + add_custom_target(ccov-capture-${target_code_coverage_COVERAGE_TARGET_NAME} + COMMAND ${CMAKE_COMMAND} -E remove -f ${COVERAGE_INFO} + COMMAND ${LCOV_PATH} --directory ${CMAKE_BINARY_DIR} + --zerocounters + COMMAND $ + ${target_code_coverage_ARGS} + COMMAND ${LCOV_PATH} --directory ${CMAKE_BINARY_DIR} + --base-directory ${CMAKE_SOURCE_DIR} --capture + ${EXTERNAL_OPTION} --output-file ${COVERAGE_INFO} + COMMAND ${EXCLUDE_COMMAND} + DEPENDS ccov-preprocessing ${TARGET_NAME}) else() - add_custom_target( - ccov-capture-${target_code_coverage_COVERAGE_TARGET_NAME} - COMMAND ${CMAKE_COMMAND} -E rm -f ${COVERAGE_INFO} - COMMAND ${LCOV_PATH} --directory ${CMAKE_BINARY_DIR} --zerocounters - COMMAND $ ${target_code_coverage_ARGS} - COMMAND - ${LCOV_PATH} --directory ${CMAKE_BINARY_DIR} --base-directory - ${CMAKE_SOURCE_DIR} --capture ${EXTERNAL_OPTION} --output-file - ${COVERAGE_INFO} - COMMAND ${EXCLUDE_COMMAND} - DEPENDS ccov-preprocessing ${TARGET_NAME}) + add_custom_target(ccov-capture-${target_code_coverage_COVERAGE_TARGET_NAME} + COMMAND ${CMAKE_COMMAND} -E rm -f ${COVERAGE_INFO} + COMMAND ${LCOV_PATH} --directory ${CMAKE_BINARY_DIR} + --zerocounters + COMMAND $ + ${target_code_coverage_ARGS} + COMMAND ${LCOV_PATH} --directory ${CMAKE_BINARY_DIR} + --base-directory ${CMAKE_SOURCE_DIR} --capture + ${EXTERNAL_OPTION} --output-file ${COVERAGE_INFO} + COMMAND ${EXCLUDE_COMMAND} + DEPENDS ccov-preprocessing ${TARGET_NAME}) endif() # Generates HTML output of the coverage information for perusal - add_custom_target( - ccov-${target_code_coverage_COVERAGE_TARGET_NAME} - COMMAND - ${GENHTML_PATH} -o - ${CMAKE_COVERAGE_OUTPUT_DIRECTORY}/${target_code_coverage_COVERAGE_TARGET_NAME} - ${COVERAGE_INFO} - DEPENDS ccov-capture-${target_code_coverage_COVERAGE_TARGET_NAME}) + add_custom_target(ccov-${target_code_coverage_COVERAGE_TARGET_NAME} + COMMAND ${GENHTML_PATH} -o + ${CMAKE_COVERAGE_OUTPUT_DIRECTORY}/${target_code_coverage_COVERAGE_TARGET_NAME} + ${COVERAGE_INFO} + DEPENDS ccov-capture-${target_code_coverage_COVERAGE_TARGET_NAME} + ) endif() - add_custom_command( - TARGET ccov-${target_code_coverage_COVERAGE_TARGET_NAME} - POST_BUILD - COMMAND ; - COMMENT - "Open ${CMAKE_COVERAGE_OUTPUT_DIRECTORY}/${target_code_coverage_COVERAGE_TARGET_NAME}/index.html in your browser to view the coverage report." + add_custom_command(TARGET ccov-${target_code_coverage_COVERAGE_TARGET_NAME} + POST_BUILD + COMMAND ; + COMMENT "Open ${CMAKE_COVERAGE_OUTPUT_DIRECTORY}/${target_code_coverage_COVERAGE_TARGET_NAME}/index.html in your browser to view the coverage report." ) # AUTO @@ -463,23 +445,20 @@ function(target_code_coverage TARGET_NAME) endif() add_dependencies(ccov ccov-${target_code_coverage_COVERAGE_TARGET_NAME}) - if(NOT CMAKE_C_COMPILER_ID MATCHES "GNU" AND NOT CMAKE_CXX_COMPILER_ID - MATCHES "GNU") + if(NOT CMAKE_C_COMPILER_ID MATCHES "GNU" AND NOT CMAKE_CXX_COMPILER_ID MATCHES + "GNU") if(NOT TARGET ccov-report) add_custom_target(ccov-report) endif() - add_dependencies( - ccov-report - ccov-report-${target_code_coverage_COVERAGE_TARGET_NAME}) + add_dependencies(ccov-report + ccov-report-${target_code_coverage_COVERAGE_TARGET_NAME}) endif() endif() # ALL if(target_code_coverage_ALL) if(NOT TARGET ccov-all-processing) - message( - FATAL_ERROR - "Calling target_code_coverage with 'ALL' must be after a call to 'add_code_coverage_all_targets'." + message(FATAL_ERROR "Calling target_code_coverage with 'ALL' must be after a call to 'add_code_coverage_all_targets'." ) endif() @@ -495,12 +474,11 @@ endfunction() # use `target_code_coverage`. function(add_code_coverage) if(CODE_COVERAGE) - if(CMAKE_C_COMPILER_ID MATCHES "(Apple)?[Cc]lang" - OR CMAKE_CXX_COMPILER_ID MATCHES "(Apple)?[Cc]lang") + if(CMAKE_C_COMPILER_ID MATCHES "(Apple)?[Cc]lang" OR CMAKE_CXX_COMPILER_ID MATCHES + "(Apple)?[Cc]lang") add_compile_options(--coverage) add_link_options(--coverage) - elseif(CMAKE_C_COMPILER_ID MATCHES "GNU" OR CMAKE_CXX_COMPILER_ID MATCHES - "GNU") + elseif(CMAKE_C_COMPILER_ID MATCHES "GNU" OR CMAKE_CXX_COMPILER_ID MATCHES "GNU") add_compile_options(-fprofile-arcs -ftest-coverage) link_libraries(gcov) endif() @@ -519,101 +497,90 @@ endfunction() function(add_code_coverage_all_targets) # Argument parsing set(multi_value_keywords EXCLUDE) - cmake_parse_arguments(add_code_coverage_all_targets "" "" - "${multi_value_keywords}" ${ARGN}) + cmake_parse_arguments(add_code_coverage_all_targets + "" + "" + "${multi_value_keywords}" + ${ARGN}) if(CODE_COVERAGE) - if(CMAKE_C_COMPILER_ID MATCHES "(Apple)?[Cc]lang" - OR CMAKE_CXX_COMPILER_ID MATCHES "(Apple)?[Cc]lang") + if(CMAKE_C_COMPILER_ID MATCHES "(Apple)?[Cc]lang" OR CMAKE_CXX_COMPILER_ID MATCHES + "(Apple)?[Cc]lang") # Merge the profile data for all of the run executables if(WIN32) - add_custom_target( - ccov-all-processing - COMMAND - powershell -Command $$FILELIST = Get-Content - ${CMAKE_COVERAGE_OUTPUT_DIRECTORY}/profraw.list\; llvm-profdata.exe - merge -o ${CMAKE_COVERAGE_OUTPUT_DIRECTORY}/all-merged.profdata - -sparse $$FILELIST) + add_custom_target(ccov-all-processing + COMMAND powershell -Command $$FILELIST = Get-Content + ${CMAKE_COVERAGE_OUTPUT_DIRECTORY}/profraw.list\; + llvm-profdata.exe merge -o + ${CMAKE_COVERAGE_OUTPUT_DIRECTORY}/all-merged.profdata + -sparse $$FILELIST) else() - add_custom_target( - ccov-all-processing - COMMAND - ${LLVM_PROFDATA_PATH} merge -o - ${CMAKE_COVERAGE_OUTPUT_DIRECTORY}/all-merged.profdata -sparse `cat - ${CMAKE_COVERAGE_OUTPUT_DIRECTORY}/profraw.list`) + add_custom_target(ccov-all-processing + COMMAND ${LLVM_PROFDATA_PATH} merge -o + ${CMAKE_COVERAGE_OUTPUT_DIRECTORY}/all-merged.profdata + -sparse `cat + ${CMAKE_COVERAGE_OUTPUT_DIRECTORY}/profraw.list`) endif() # Regex exclude only available for LLVM >= 7 if(LLVM_COV_VERSION VERSION_GREATER_EQUAL "7.0.0") foreach(EXCLUDE_ITEM ${add_code_coverage_all_targets_EXCLUDE}) - set(EXCLUDE_REGEX ${EXCLUDE_REGEX} - -ignore-filename-regex='${EXCLUDE_ITEM}') + set(EXCLUDE_REGEX ${EXCLUDE_REGEX} -ignore-filename-regex='${EXCLUDE_ITEM}') endforeach() endif() # Print summary of the code coverage information to the command line if(WIN32) - add_custom_target( - ccov-all-report - COMMAND - powershell -Command $$FILELIST = Get-Content - ${CMAKE_COVERAGE_OUTPUT_DIRECTORY}/binaries.list\; llvm-cov.exe - report $$FILELIST - -instr-profile=${CMAKE_COVERAGE_OUTPUT_DIRECTORY}/all-merged.profdata - ${EXCLUDE_REGEX} - DEPENDS ccov-all-processing) + add_custom_target(ccov-all-report + COMMAND powershell -Command $$FILELIST = Get-Content + ${CMAKE_COVERAGE_OUTPUT_DIRECTORY}/binaries.list\; + llvm-cov.exe report $$FILELIST + -instr-profile=${CMAKE_COVERAGE_OUTPUT_DIRECTORY}/all-merged.profdata + ${EXCLUDE_REGEX} + DEPENDS ccov-all-processing) else() - add_custom_target( - ccov-all-report - COMMAND - ${LLVM_COV_PATH} report `cat - ${CMAKE_COVERAGE_OUTPUT_DIRECTORY}/binaries.list` - -instr-profile=${CMAKE_COVERAGE_OUTPUT_DIRECTORY}/all-merged.profdata - ${EXCLUDE_REGEX} - DEPENDS ccov-all-processing) + add_custom_target(ccov-all-report + COMMAND ${LLVM_COV_PATH} report `cat + ${CMAKE_COVERAGE_OUTPUT_DIRECTORY}/binaries.list` + -instr-profile=${CMAKE_COVERAGE_OUTPUT_DIRECTORY}/all-merged.profdata + ${EXCLUDE_REGEX} + DEPENDS ccov-all-processing) endif() # Export coverage information so continuous integration tools (e.g. # Jenkins) can consume it - add_custom_target( - ccov-all-export - COMMAND - ${LLVM_COV_PATH} export `cat - ${CMAKE_COVERAGE_OUTPUT_DIRECTORY}/binaries.list` - -instr-profile=${CMAKE_COVERAGE_OUTPUT_DIRECTORY}/all-merged.profdata - -format="text" ${EXCLUDE_REGEX} > - ${CMAKE_COVERAGE_OUTPUT_DIRECTORY}/coverage.json - DEPENDS ccov-all-processing) + add_custom_target(ccov-all-export + COMMAND ${LLVM_COV_PATH} export `cat + ${CMAKE_COVERAGE_OUTPUT_DIRECTORY}/binaries.list` + -instr-profile=${CMAKE_COVERAGE_OUTPUT_DIRECTORY}/all-merged.profdata + -format="text" ${EXCLUDE_REGEX} > + ${CMAKE_COVERAGE_OUTPUT_DIRECTORY}/coverage.json + DEPENDS ccov-all-processing) # Generate HTML output of all added targets for perusal if(WIN32) - add_custom_target( - ccov-all - COMMAND - powershell -Command $$FILELIST = Get-Content - ${CMAKE_COVERAGE_OUTPUT_DIRECTORY}/binaries.list\; llvm-cov.exe show - $$FILELIST - -instr-profile=${CMAKE_COVERAGE_OUTPUT_DIRECTORY}/all-merged.profdata - -show-line-counts-or-regions - -output-dir=${CMAKE_COVERAGE_OUTPUT_DIRECTORY}/all-merged - -format="html" ${EXCLUDE_REGEX} - DEPENDS ccov-all-processing) + add_custom_target(ccov-all + COMMAND powershell -Command $$FILELIST = Get-Content + ${CMAKE_COVERAGE_OUTPUT_DIRECTORY}/binaries.list\; + llvm-cov.exe show $$FILELIST + -instr-profile=${CMAKE_COVERAGE_OUTPUT_DIRECTORY}/all-merged.profdata + -show-line-counts-or-regions + -output-dir=${CMAKE_COVERAGE_OUTPUT_DIRECTORY}/all-merged + -format="html" ${EXCLUDE_REGEX} + DEPENDS ccov-all-processing) else() - add_custom_target( - ccov-all - COMMAND - ${LLVM_COV_PATH} show `cat - ${CMAKE_COVERAGE_OUTPUT_DIRECTORY}/binaries.list` - -instr-profile=${CMAKE_COVERAGE_OUTPUT_DIRECTORY}/all-merged.profdata - -show-line-counts-or-regions - -output-dir=${CMAKE_COVERAGE_OUTPUT_DIRECTORY}/all-merged - -format="html" ${EXCLUDE_REGEX} - DEPENDS ccov-all-processing) + add_custom_target(ccov-all + COMMAND ${LLVM_COV_PATH} show `cat + ${CMAKE_COVERAGE_OUTPUT_DIRECTORY}/binaries.list` + -instr-profile=${CMAKE_COVERAGE_OUTPUT_DIRECTORY}/all-merged.profdata + -show-line-counts-or-regions + -output-dir=${CMAKE_COVERAGE_OUTPUT_DIRECTORY}/all-merged + -format="html" ${EXCLUDE_REGEX} + DEPENDS ccov-all-processing) endif() - elseif(CMAKE_C_COMPILER_ID MATCHES "GNU" OR CMAKE_CXX_COMPILER_ID MATCHES - "GNU") + elseif(CMAKE_C_COMPILER_ID MATCHES "GNU" OR CMAKE_CXX_COMPILER_ID MATCHES "GNU") set(COVERAGE_INFO "${CMAKE_COVERAGE_OUTPUT_DIRECTORY}/all-merged.info") # Nothing required for gcov @@ -622,51 +589,45 @@ function(add_code_coverage_all_targets) # Exclusion regex string creation set(EXCLUDE_REGEX) foreach(EXCLUDE_ITEM ${add_code_coverage_all_targets_EXCLUDE}) - set(EXCLUDE_REGEX ${EXCLUDE_REGEX} --remove ${COVERAGE_INFO} - '${EXCLUDE_ITEM}') + set(EXCLUDE_REGEX ${EXCLUDE_REGEX} --remove ${COVERAGE_INFO} '${EXCLUDE_ITEM}') endforeach() if(EXCLUDE_REGEX) - set(EXCLUDE_COMMAND ${LCOV_PATH} ${EXCLUDE_REGEX} --output-file - ${COVERAGE_INFO}) + set(EXCLUDE_COMMAND ${LCOV_PATH} ${EXCLUDE_REGEX} --output-file ${COVERAGE_INFO}) else() set(EXCLUDE_COMMAND ;) endif() # Capture coverage data if(${CMAKE_VERSION} VERSION_LESS "3.17.0") - add_custom_target( - ccov-all-capture - COMMAND ${CMAKE_COMMAND} -E remove -f ${COVERAGE_INFO} - COMMAND ${LCOV_PATH} --directory ${CMAKE_BINARY_DIR} --capture - --output-file ${COVERAGE_INFO} - COMMAND ${EXCLUDE_COMMAND} - DEPENDS ccov-preprocessing ccov-all-processing) + add_custom_target(ccov-all-capture + COMMAND ${CMAKE_COMMAND} -E remove -f ${COVERAGE_INFO} + COMMAND ${LCOV_PATH} --directory ${CMAKE_BINARY_DIR} --capture + --output-file ${COVERAGE_INFO} + COMMAND ${EXCLUDE_COMMAND} + DEPENDS ccov-preprocessing ccov-all-processing) else() - add_custom_target( - ccov-all-capture - COMMAND ${CMAKE_COMMAND} -E rm -f ${COVERAGE_INFO} - COMMAND ${LCOV_PATH} --directory ${CMAKE_BINARY_DIR} --capture - --output-file ${COVERAGE_INFO} - COMMAND ${EXCLUDE_COMMAND} - DEPENDS ccov-preprocessing ccov-all-processing) + add_custom_target(ccov-all-capture + COMMAND ${CMAKE_COMMAND} -E rm -f ${COVERAGE_INFO} + COMMAND ${LCOV_PATH} --directory ${CMAKE_BINARY_DIR} --capture + --output-file ${COVERAGE_INFO} + COMMAND ${EXCLUDE_COMMAND} + DEPENDS ccov-preprocessing ccov-all-processing) endif() # Generates HTML output of all targets for perusal - add_custom_target( - ccov-all - COMMAND ${GENHTML_PATH} -o ${CMAKE_COVERAGE_OUTPUT_DIRECTORY}/all-merged - ${COVERAGE_INFO} -p ${CMAKE_SOURCE_DIR} - DEPENDS ccov-all-capture) + add_custom_target(ccov-all + COMMAND ${GENHTML_PATH} -o + ${CMAKE_COVERAGE_OUTPUT_DIRECTORY}/all-merged + ${COVERAGE_INFO} -p ${CMAKE_SOURCE_DIR} + DEPENDS ccov-all-capture) endif() - add_custom_command( - TARGET ccov-all - POST_BUILD - COMMAND ; - COMMENT - "Open ${CMAKE_COVERAGE_OUTPUT_DIRECTORY}/all-merged/index.html in your browser to view the coverage report." + add_custom_command(TARGET ccov-all + POST_BUILD + COMMAND ; + COMMENT "Open ${CMAKE_COVERAGE_OUTPUT_DIRECTORY}/all-merged/index.html in your browser to view the coverage report." ) endif() -endfunction() \ No newline at end of file +endfunction() diff --git a/cpp/src/arrow/flight/sql/amazon-timestream-odbc-driver/src/odbc/CMakeLists.txt b/cpp/src/arrow/flight/sql/amazon-timestream-odbc-driver/src/odbc/CMakeLists.txt index 4e14b9539d4c6..a4adb11ce6feb 100644 --- a/cpp/src/arrow/flight/sql/amazon-timestream-odbc-driver/src/odbc/CMakeLists.txt +++ b/cpp/src/arrow/flight/sql/amazon-timestream-odbc-driver/src/odbc/CMakeLists.txt @@ -31,108 +31,121 @@ message(STATUS "CMAKE_PREFIX_PATH: ${CMAKE_PREFIX_PATH}") find_package(ODBC REQUIRED) find_package(AWSSDK REQUIRED COMPONENTS core sts timestream-query) find_package(Boost REQUIRED) -if (UNIX) - find_package(ZLIB REQUIRED) +if(UNIX) + find_package(ZLIB REQUIRED) endif() -if (${CODE_COVERAGE}) - add_code_coverage() +if(${CODE_COVERAGE}) + add_code_coverage() endif() -include_directories(SYSTEM ${ODBC_INCLUDE_DIRS} ${Boost_INCLUDE_DIRS} ${AWSSDK_INCLUDE_DIRS}) +include_directories(SYSTEM ${ODBC_INCLUDE_DIRS} ${Boost_INCLUDE_DIRS} + ${AWSSDK_INCLUDE_DIRS}) include_directories(include) -set(SOURCES src/app/application_data_buffer.cpp - src/authentication/aad.cpp - src/authentication/auth_type.cpp - src/authentication/okta.cpp - src/authentication/saml.cpp - src/common_types.cpp - src/config/configuration.cpp - src/config/connection_info.cpp - src/config/connection_string_parser.cpp - src/connection.cpp - src/descriptor.cpp - src/diagnostic/diagnosable_adapter.cpp - src/diagnostic/diagnostic_record.cpp - src/diagnostic/diagnostic_record_storage.cpp - src/dsn_config.cpp - src/entry_points.cpp - src/environment.cpp - src/ignite/common/src/common/big_integer.cpp - src/ignite/common/src/common/bits.cpp - src/ignite/common/src/common/concurrent.cpp - src/ignite/common/src/common/decimal.cpp - src/ignite/common/src/date.cpp - src/ignite_error.cpp - src/interval_day_second.cpp - src/interval_year_month.cpp - src/log.cpp - src/log_level.cpp - src/meta/column_meta.cpp - src/meta/table_meta.cpp - src/odbc.cpp - src/query/column_metadata_query.cpp - src/query/column_privileges_query.cpp - src/query/data_query.cpp - src/query/foreign_keys_query.cpp - src/query/primary_keys_query.cpp - src/query/procedure_columns_query.cpp - src/query/procedures_query.cpp - src/query/special_columns_query.cpp - src/query/statistics_query.cpp - src/query/table_metadata_query.cpp - src/query/table_privileges_query.cpp - src/query/type_info_query.cpp - src/statement.cpp - src/time.cpp - src/timestamp.cpp - src/timestream_column.cpp - src/timestream_cursor.cpp - src/type_traits.cpp - src/utility.cpp - src/utils.cpp) - -if (WIN32) - set(OS_INCLUDE os/ignite/common/os/win/include os/timestream/win/include) - - list(APPEND SOURCES - os/timestream/win/src/system_dsn.cpp - os/timestream/win/src/system/ui/custom_window.cpp - os/timestream/win/src/system/ui/dsn_configuration_window.cpp - os/timestream/win/src/system/ui/window.cpp - module.def - os/ignite/common/os/win/src/common/concurrent_os.cpp - os/ignite/common/os/win/src/common/platform_utils.cpp - os/ignite/common/os/win/src/common/dynamic_load_os.cpp - ) +set(SOURCES + src/app/application_data_buffer.cpp + src/authentication/aad.cpp + src/authentication/auth_type.cpp + src/authentication/okta.cpp + src/authentication/saml.cpp + src/common_types.cpp + src/config/configuration.cpp + src/config/connection_info.cpp + src/config/connection_string_parser.cpp + src/connection.cpp + src/descriptor.cpp + src/diagnostic/diagnosable_adapter.cpp + src/diagnostic/diagnostic_record.cpp + src/diagnostic/diagnostic_record_storage.cpp + src/dsn_config.cpp + src/entry_points.cpp + src/environment.cpp + src/ignite/common/src/common/big_integer.cpp + src/ignite/common/src/common/bits.cpp + src/ignite/common/src/common/concurrent.cpp + src/ignite/common/src/common/decimal.cpp + src/ignite/common/src/date.cpp + src/ignite_error.cpp + src/interval_day_second.cpp + src/interval_year_month.cpp + src/log.cpp + src/log_level.cpp + src/meta/column_meta.cpp + src/meta/table_meta.cpp + src/odbc.cpp + src/query/column_metadata_query.cpp + src/query/column_privileges_query.cpp + src/query/data_query.cpp + src/query/foreign_keys_query.cpp + src/query/primary_keys_query.cpp + src/query/procedure_columns_query.cpp + src/query/procedures_query.cpp + src/query/special_columns_query.cpp + src/query/statistics_query.cpp + src/query/table_metadata_query.cpp + src/query/table_privileges_query.cpp + src/query/type_info_query.cpp + src/statement.cpp + src/time.cpp + src/timestamp.cpp + src/timestream_column.cpp + src/timestream_cursor.cpp + src/type_traits.cpp + src/utility.cpp + src/utils.cpp) + +if(WIN32) + set(OS_INCLUDE os/ignite/common/os/win/include os/timestream/win/include) + + list(APPEND + SOURCES + os/timestream/win/src/system_dsn.cpp + os/timestream/win/src/system/ui/custom_window.cpp + os/timestream/win/src/system/ui/dsn_configuration_window.cpp + os/timestream/win/src/system/ui/window.cpp + module.def + os/ignite/common/os/win/src/common/concurrent_os.cpp + os/ignite/common/os/win/src/common/platform_utils.cpp + os/ignite/common/os/win/src/common/dynamic_load_os.cpp) else() - set(OS_INCLUDE os/ignite/common/os/linux/include) + set(OS_INCLUDE os/ignite/common/os/linux/include) - list(APPEND SOURCES - os/ignite/common/os/linux/src/common/concurrent_os.cpp - os/ignite/common/os/linux/src/common/platform_utils.cpp - os/ignite/common/os/linux/src/common/dynamic_load_os.cpp - ) -endif () + list(APPEND + SOURCES + os/ignite/common/os/linux/src/common/concurrent_os.cpp + os/ignite/common/os/linux/src/common/platform_utils.cpp + os/ignite/common/os/linux/src/common/dynamic_load_os.cpp) +endif() include_directories(${OS_INCLUDE}) set(CMAKE_WINDOWS_EXPORT_ALL_SYMBOLS ON) add_library(${TARGET} SHARED ${SOURCES} version.rc) -if (WIN32) - # static library created for Windows only for tests linking - add_library(${TARGET}-static STATIC ${SOURCES} version.rc) - - # ensure our self-build aws sdk library could be found - set_target_properties(aws-cpp-sdk-core aws-cpp-sdk-sts aws-cpp-sdk-timestream-query PROPERTIES - IMPORTED_IMPLIB ${CMAKE_SOURCE_DIR}/../build/aws-sdk/install/bin - ) - set_target_properties(AWS::aws-crt-cpp AWS::aws-c-cal AWS::aws-c-auth AWS::aws-c-common AWS::aws-c-io AWS::aws-checksums AWS::aws-c-event-stream AWS::aws-c-s3 AWS::aws-c-http AWS::aws-c-mqtt AWS::aws-c-compression AWS::aws-c-sdkutils PROPERTIES - IMPORTED_IMPLIB ${CMAKE_SOURCE_DIR}/../build/aws-sdk/install/lib - ) -endif () +if(WIN32) + # static library created for Windows only for tests linking + add_library(${TARGET}-static STATIC ${SOURCES} version.rc) + + # ensure our self-build aws sdk library could be found + set_target_properties(aws-cpp-sdk-core aws-cpp-sdk-sts aws-cpp-sdk-timestream-query + PROPERTIES IMPORTED_IMPLIB + ${CMAKE_SOURCE_DIR}/../build/aws-sdk/install/bin) + set_target_properties(AWS::aws-crt-cpp + AWS::aws-c-cal + AWS::aws-c-auth + AWS::aws-c-common + AWS::aws-c-io + AWS::aws-checksums + AWS::aws-c-event-stream + AWS::aws-c-s3 + AWS::aws-c-http + AWS::aws-c-mqtt + AWS::aws-c-compression + AWS::aws-c-sdkutils + PROPERTIES IMPORTED_IMPLIB + ${CMAKE_SOURCE_DIR}/../build/aws-sdk/install/lib) +endif() set_target_properties(${TARGET} PROPERTIES VERSION ${CMAKE_PROJECT_VERSION}) @@ -145,295 +158,340 @@ add_definitions(-DPROJECT_VERSION_MAJOR=${CMAKE_PROJECT_VERSION_MAJOR}) add_definitions(-DPROJECT_VERSION_MINOR=${CMAKE_PROJECT_VERSION_MINOR}) add_definitions(-DPROJECT_VERSION_PATCH=${CMAKE_PROJECT_VERSION_PATCH}) -if (WIN32) - target_link_libraries(${TARGET} odbccp32 shlwapi) +if(WIN32) + target_link_libraries(${TARGET} odbccp32 shlwapi) - add_definitions(-DTARGET_MODULE_FULL_NAME="$") + add_definitions(-DTARGET_MODULE_FULL_NAME="$") - if (MSVC_VERSION GREATER_EQUAL 1900) - target_link_libraries(${TARGET} legacy_stdio_definitions) - endif() - - set_target_properties(${TARGET} PROPERTIES OUTPUT_NAME "timestream.odbc") + if(MSVC_VERSION GREATER_EQUAL 1900) + target_link_libraries(${TARGET} legacy_stdio_definitions) + endif() + + set_target_properties(${TARGET} PROPERTIES OUTPUT_NAME "timestream.odbc") else() - target_link_libraries(${TARGET}) + target_link_libraries(${TARGET}) endif() -if (WIN32 AND ${WITH_ODBC_MSI}) - find_program(WIX_CANDLE candle) - if(NOT WIX_CANDLE) - message(FATAL_ERROR "WIX candle.exe not found! Have you installed WIX Toolset or forgotten to add it to Path?") - endif() - - find_program(WIX_LIGHT light) - if(NOT WIX_LIGHT) - message(FATAL_ERROR "WIX light.exe not found! Have you installed WIX Toolset or forgotten to add it to Path?") - endif() - - set(WIX_ODBC_LIBRARY_PATH ".\\timestream.odbc.dll") - set(WIX_ODBC_SDK_CORE_PATH ".\\aws-cpp-sdk-core.dll") - set(WIX_ODBC_SDK_TS_QUERY_PATH ".\\aws-cpp-sdk-timestream-query.dll") - set(WIX_ODBC_SDK_STS_PATH ".\\aws-cpp-sdk-sts.dll") - set(WIX_ODBC_AWS_C_AUTH ".\\aws-c-auth.dll") - set(WIX_ODBC_AWS_C_CAL ".\\aws-c-cal.dll") - set(WIX_ODBC_AWS_C_COMMON ".\\aws-c-common.dll") - set(WIX_ODBC_AWS_C_COMPRESSION ".\\aws-c-compression.dll") - set(WIX_ODBC_AWS_C_EVENT_STREAM ".\\aws-c-event-stream.dll") - set(WIX_ODBC_AWS_CHECKSUMS ".\\aws-checksums.dll") - set(WIX_ODBC_AWS_C_HTTP ".\\aws-c-http.dll") - set(WIX_ODBC_AWS_C_IO ".\\aws-c-io.dll") - set(WIX_ODBC_AWS_C_MQTT ".\\aws-c-mqtt.dll") - set(WIX_ODBC_AWS_CRT_CPP ".\\aws-crt-cpp.dll") - set(WIX_ODBC_AWS_C_S3 ".\\aws-c-s3.dll") - set(WIX_ODBC_AWS_C_SDKUTILS ".\\aws-c-sdkutils.dll") - - set(WIX_PROJECT_NAME "Amazon Timestream") - set(WIX_MANUFACTURER "Amazon Web Services") - set(WIX_COPYRIGHT_COMMENT "Apache, Apache Ignite, the Apache feather and the Apache Ignite logo are trademarks of The Apache Software Foundation.") - - if(CMAKE_SIZEOF_VOID_P EQUAL 8) - set(WIX_BIT_SUFFIX "64-bit") - set(WIX_PROGRAM_FILES_FOLDER_ID "Program Files (x86)") - set(WIX_COMPONENT_IS_WIN64 "yes") - set(WIX_INSTALLER_BUNDLE_SRC "${CMAKE_CURRENT_LIST_DIR}/install/timestream-odbc-bundle.wxs.in.x64") - - if(${CMAKE_SYSTEM_PROCESSOR} MATCHES "arm") - set(WIX_PRODUCT_ID "942F102A-BCF5-46BE-A568-8A0A544F6456") - set(WIX_UPGRADE_CODE "F17BF88F-9571-47FE-A642-5B0ECA26DFBD") - set(WIX_COMPONENT_ID_ODBC_LIBRARY "AA8B007D-C9B9-4F1D-9C9F-E9384401E214") - set(WIX_COMPONENT_ID_SDK_CORE "9AAED0BC-281E-454A-8DDB-76787A46573D") - set(WIX_COMPONENT_ID_SDK_TS_QUERY "268BB95C-696C-46BC-89F9-7129380A3825") - set(WIX_COMPONENT_ID_SDK_STS "ECEEF57F-ECEC-4B80-A040-A5394C7B56FC") - - set(WIX_COMPONENT_ID_AWS_C_AUTH "ADCC5700-9051-449B-9C7E-9C765458BE3E") - set(WIX_COMPONENT_ID_AWS_C_CAL "577B1441-D084-4100-9A39-317701DA8908") - set(WIX_COMPONENT_ID_AWS_C_COMMON "8413E31F-8FA1-4E58-AF19-128EF8F71E8A") - set(WIX_COMPONENT_ID_AWS_C_COMPRESSION "7E16BE95-F650-498D-918E-0A53186D6D44") - set(WIX_COMPONENT_ID_AWS_C_EVENT_STREAM "2955CF86-507C-41E7-A681-A9FBC8CE0AE0") - set(WIX_COMPONENT_ID_AWS_CHECKSUMS "2D9C91D3-1D14-40E0-91A7-E9F1F6BCCB0D") - set(WIX_COMPONENT_ID_AWS_C_HTTP "0E0EB1A2-3150-4978-86DD-210CE49BBF73") - set(WIX_COMPONENT_ID_AWS_C_IO "BD661102-356F-426E-B5C2-47A9A2C23E13") - set(WIX_COMPONENT_ID_AWS_C_MQTT "21D27FB0-7C0A-4E80-881D-DEA2DBD085FC") - set(WIX_COMPONENT_ID_AWS_CRT_CPP "475234A5-AF23-4E7C-80AA-066B30522C58") - set(WIX_COMPONENT_ID_AWS_C_S3 "E35D33AB-3C50-469E-8A60-4E4B266D03A9") - set(WIX_COMPONENT_ID_AWS_C_SDKUTILS "A9E68859-0566-4D3B-836A-89AA61472D54") - set(WIX_BUNDLE_UPGRADE_CODE "C77C052F-CBEF-4EC1-8030-C4A6F6F7094A") - - set(WIX_PACKAGE_PLATFORM "arm64") - else() - set(WIX_PRODUCT_ID "CA6C75A4-8BC9-49CE-A71A-4CEE813119E1") - set(WIX_UPGRADE_CODE "6954CE47-89EB-4F4F-A925-225A7A94531E") - set(WIX_COMPONENT_ID_ODBC_LIBRARY "6B9E12BF-7914-43A7-99C6-2821950EE249") - set(WIX_COMPONENT_ID_SDK_CORE "82EE01C2-5D7E-4FE4-838B-34E10D6F1F71") - set(WIX_COMPONENT_ID_SDK_TS_QUERY "42B2CA3E-5314-4D1D-9491-F945B6B33B5A") - set(WIX_COMPONENT_ID_SDK_STS "B55B759D-88B3-47C0-9ABA-60F1504C0DA8") - - set(WIX_COMPONENT_ID_AWS_C_AUTH "D584F5F1-CCB1-47D8-9EB5-1854399B2715") - set(WIX_COMPONENT_ID_AWS_C_CAL "13A2A675-4C39-4C02-874A-AC0BE18054B3") - set(WIX_COMPONENT_ID_AWS_C_COMMON "B9CD76F0-F26C-4033-9CB8-FEC33C4E5CBC") - set(WIX_COMPONENT_ID_AWS_C_COMPRESSION "EEB47CFB-3A73-48AE-BC2B-B548145CA919") - set(WIX_COMPONENT_ID_AWS_C_EVENT_STREAM "522AA652-D426-43D9-A9E1-B4F7ACAC5981") - set(WIX_COMPONENT_ID_AWS_CHECKSUMS "0E6D8BEA-C4C8-4CC5-A264-17D7B24DB55E") - set(WIX_COMPONENT_ID_AWS_C_HTTP "5AF8104B-2E21-44DB-A4A3-D551C818B118") - set(WIX_COMPONENT_ID_AWS_C_IO "20DBED24-121E-4533-B6AE-A49019F78705") - set(WIX_COMPONENT_ID_AWS_C_MQTT "C420CFFC-2289-4F3C-9FA7-0A1D9271DF90") - set(WIX_COMPONENT_ID_AWS_CRT_CPP "811269B1-D54D-486D-BED3-F0A2A74D4E12") - set(WIX_COMPONENT_ID_AWS_C_S3 "05FB1CFF-6993-4924-A872-322B1250C608") - set(WIX_COMPONENT_ID_AWS_C_SDKUTILS "BD17E26C-ED17-4064-B7F2-8B1BDF965AC7") - set(WIX_BUNDLE_UPGRADE_CODE "BA03135B-F78E-41E5-8D70-C7FD62A4757A") - - set(WIX_PACKAGE_PLATFORM "x64") - endif() - - elseif(CMAKE_SIZEOF_VOID_P EQUAL 4) - set(WIX_BIT_SUFFIX "32-bit") - set(WIX_PROGRAM_FILES_FOLDER_ID "Program Files") - set(WIX_COMPONENT_IS_WIN64 "no") - set(WIX_INSTALLER_BUNDLE_SRC "${CMAKE_CURRENT_LIST_DIR}/install/timestream-odbc-bundle.wxs.in.x86") - - - set(WIX_PRODUCT_ID "9FAACB44-B1D9-4E9B-B22E-44FB20C083E2") - set(WIX_UPGRADE_CODE "7BDC7F9E-BB0D-4288-B404-96A78AB0B69D") - set(WIX_COMPONENT_ID_ODBC_LIBRARY "F0B4778F-43BD-447C-B882-E70D9B16AEB6") - set(WIX_COMPONENT_ID_SDK_CORE "1CD3936E-F8CF-42B9-90F9-7F33BC3E1CC1") - set(WIX_COMPONENT_ID_SDK_TS_QUERY "4E88F45B-7623-4A80-9985-0AC2F81F371E") - set(WIX_COMPONENT_ID_SDK_STS "E3E41090-D480-40DE-A7E2-62C038D936BD") - - set(WIX_COMPONENT_ID_AWS_C_AUTH "5376FD5A-D940-4FAC-B666-F9F37BBCA80E") - set(WIX_COMPONENT_ID_AWS_C_CAL "875C5826-F555-4929-BFA5-819096E96437") - set(WIX_COMPONENT_ID_AWS_C_COMMON "0DDAC317-5752-4391-9D5C-0B855F964DF9") - set(WIX_COMPONENT_ID_AWS_C_COMPRESSION "34DE86DB-D1D5-4FE1-B13B-3C0BAD06C784") - set(WIX_COMPONENT_ID_AWS_C_EVENT_STREAM "325A20AC-E459-4ABC-BFC5-E1680951EEE4") - set(WIX_COMPONENT_ID_AWS_CHECKSUMS "7A70A03F-7128-4AAC-9556-0FDB536FEFED") - set(WIX_COMPONENT_ID_AWS_C_HTTP "53D36BAF-F663-4799-8B75-BD8C643BB451") - set(WIX_COMPONENT_ID_AWS_C_IO "922C1B88-9A36-4CE5-A770-EB10F7EF1FD9") - set(WIX_COMPONENT_ID_AWS_C_MQTT "8F43AF91-BB7B-489D-9707-292497BBB21E") - set(WIX_COMPONENT_ID_AWS_CRT_CPP "DB6DCE34-B717-43C1-A53C-EC36227B1B01") - set(WIX_COMPONENT_ID_AWS_C_S3 "E382CA06-AEE1-48D3-95D4-D712A832AC4D") - set(WIX_COMPONENT_ID_AWS_C_SDKUTILS "327859D5-75D3-4E2B-AC08-5E33F4372E4B") - set(WIX_BUNDLE_UPGRADE_CODE "D788EB72-42FC-49EB-A47A-D65087A83C1A") - - set(WIX_PACKAGE_PLATFORM "x86") - endif() - - set(WIX_PRODUCT_NAME "${WIX_PROJECT_NAME} ODBC ${WIX_BIT_SUFFIX} Driver") - set(WIX_VC_RUNTIME_NAME "VC_redist.${WIX_PACKAGE_PLATFORM}.exe") - set(WIX_INSTALLER_PREFIX ${CMAKE_BUILD_DIR}/timestream-odbc-${WIX_PACKAGE_PLATFORM}) - set(WIX_INSTALLER_BUNDLE_PREFIX ${CMAKE_BUILD_DIR}/timestream-odbc-bundle-${WIX_PACKAGE_PLATFORM}) - set(WIX_INSTALLER_EXE_PREFIX ${CMAKE_BUILD_DIR}/timestream-odbc-installer-${WIX_PACKAGE_PLATFORM}-${ODBC_DRIVER_VERSION}) - - configure_file( - "${CMAKE_CURRENT_LIST_DIR}/install/timestream-odbc.wxs.in" - "${WIX_INSTALLER_PREFIX}.wxs" - @ONLY +if(WIN32 AND ${WITH_ODBC_MSI}) + find_program(WIX_CANDLE candle) + if(NOT WIX_CANDLE) + message(FATAL_ERROR "WIX candle.exe not found! Have you installed WIX Toolset or forgotten to add it to Path?" ) + endif() - configure_file( - "${WIX_INSTALLER_BUNDLE_SRC}" - "${WIX_INSTALLER_BUNDLE_PREFIX}.wxs" - @ONLY + find_program(WIX_LIGHT light) + if(NOT WIX_LIGHT) + message(FATAL_ERROR "WIX light.exe not found! Have you installed WIX Toolset or forgotten to add it to Path?" ) + endif() + + set(WIX_ODBC_LIBRARY_PATH ".\\timestream.odbc.dll") + set(WIX_ODBC_SDK_CORE_PATH ".\\aws-cpp-sdk-core.dll") + set(WIX_ODBC_SDK_TS_QUERY_PATH ".\\aws-cpp-sdk-timestream-query.dll") + set(WIX_ODBC_SDK_STS_PATH ".\\aws-cpp-sdk-sts.dll") + set(WIX_ODBC_AWS_C_AUTH ".\\aws-c-auth.dll") + set(WIX_ODBC_AWS_C_CAL ".\\aws-c-cal.dll") + set(WIX_ODBC_AWS_C_COMMON ".\\aws-c-common.dll") + set(WIX_ODBC_AWS_C_COMPRESSION ".\\aws-c-compression.dll") + set(WIX_ODBC_AWS_C_EVENT_STREAM ".\\aws-c-event-stream.dll") + set(WIX_ODBC_AWS_CHECKSUMS ".\\aws-checksums.dll") + set(WIX_ODBC_AWS_C_HTTP ".\\aws-c-http.dll") + set(WIX_ODBC_AWS_C_IO ".\\aws-c-io.dll") + set(WIX_ODBC_AWS_C_MQTT ".\\aws-c-mqtt.dll") + set(WIX_ODBC_AWS_CRT_CPP ".\\aws-crt-cpp.dll") + set(WIX_ODBC_AWS_C_S3 ".\\aws-c-s3.dll") + set(WIX_ODBC_AWS_C_SDKUTILS ".\\aws-c-sdkutils.dll") + + set(WIX_PROJECT_NAME "Amazon Timestream") + set(WIX_MANUFACTURER "Amazon Web Services") + set(WIX_COPYRIGHT_COMMENT + "Apache, Apache Ignite, the Apache feather and the Apache Ignite logo are trademarks of The Apache Software Foundation." + ) + + if(CMAKE_SIZEOF_VOID_P EQUAL 8) + set(WIX_BIT_SUFFIX "64-bit") + set(WIX_PROGRAM_FILES_FOLDER_ID "Program Files (x86)") + set(WIX_COMPONENT_IS_WIN64 "yes") + set(WIX_INSTALLER_BUNDLE_SRC + "${CMAKE_CURRENT_LIST_DIR}/install/timestream-odbc-bundle.wxs.in.x64") + + if(${CMAKE_SYSTEM_PROCESSOR} MATCHES "arm") + set(WIX_PRODUCT_ID "942F102A-BCF5-46BE-A568-8A0A544F6456") + set(WIX_UPGRADE_CODE "F17BF88F-9571-47FE-A642-5B0ECA26DFBD") + set(WIX_COMPONENT_ID_ODBC_LIBRARY "AA8B007D-C9B9-4F1D-9C9F-E9384401E214") + set(WIX_COMPONENT_ID_SDK_CORE "9AAED0BC-281E-454A-8DDB-76787A46573D") + set(WIX_COMPONENT_ID_SDK_TS_QUERY "268BB95C-696C-46BC-89F9-7129380A3825") + set(WIX_COMPONENT_ID_SDK_STS "ECEEF57F-ECEC-4B80-A040-A5394C7B56FC") + + set(WIX_COMPONENT_ID_AWS_C_AUTH "ADCC5700-9051-449B-9C7E-9C765458BE3E") + set(WIX_COMPONENT_ID_AWS_C_CAL "577B1441-D084-4100-9A39-317701DA8908") + set(WIX_COMPONENT_ID_AWS_C_COMMON "8413E31F-8FA1-4E58-AF19-128EF8F71E8A") + set(WIX_COMPONENT_ID_AWS_C_COMPRESSION "7E16BE95-F650-498D-918E-0A53186D6D44") + set(WIX_COMPONENT_ID_AWS_C_EVENT_STREAM "2955CF86-507C-41E7-A681-A9FBC8CE0AE0") + set(WIX_COMPONENT_ID_AWS_CHECKSUMS "2D9C91D3-1D14-40E0-91A7-E9F1F6BCCB0D") + set(WIX_COMPONENT_ID_AWS_C_HTTP "0E0EB1A2-3150-4978-86DD-210CE49BBF73") + set(WIX_COMPONENT_ID_AWS_C_IO "BD661102-356F-426E-B5C2-47A9A2C23E13") + set(WIX_COMPONENT_ID_AWS_C_MQTT "21D27FB0-7C0A-4E80-881D-DEA2DBD085FC") + set(WIX_COMPONENT_ID_AWS_CRT_CPP "475234A5-AF23-4E7C-80AA-066B30522C58") + set(WIX_COMPONENT_ID_AWS_C_S3 "E35D33AB-3C50-469E-8A60-4E4B266D03A9") + set(WIX_COMPONENT_ID_AWS_C_SDKUTILS "A9E68859-0566-4D3B-836A-89AA61472D54") + set(WIX_BUNDLE_UPGRADE_CODE "C77C052F-CBEF-4EC1-8030-C4A6F6F7094A") + + set(WIX_PACKAGE_PLATFORM "arm64") + else() + set(WIX_PRODUCT_ID "CA6C75A4-8BC9-49CE-A71A-4CEE813119E1") + set(WIX_UPGRADE_CODE "6954CE47-89EB-4F4F-A925-225A7A94531E") + set(WIX_COMPONENT_ID_ODBC_LIBRARY "6B9E12BF-7914-43A7-99C6-2821950EE249") + set(WIX_COMPONENT_ID_SDK_CORE "82EE01C2-5D7E-4FE4-838B-34E10D6F1F71") + set(WIX_COMPONENT_ID_SDK_TS_QUERY "42B2CA3E-5314-4D1D-9491-F945B6B33B5A") + set(WIX_COMPONENT_ID_SDK_STS "B55B759D-88B3-47C0-9ABA-60F1504C0DA8") + + set(WIX_COMPONENT_ID_AWS_C_AUTH "D584F5F1-CCB1-47D8-9EB5-1854399B2715") + set(WIX_COMPONENT_ID_AWS_C_CAL "13A2A675-4C39-4C02-874A-AC0BE18054B3") + set(WIX_COMPONENT_ID_AWS_C_COMMON "B9CD76F0-F26C-4033-9CB8-FEC33C4E5CBC") + set(WIX_COMPONENT_ID_AWS_C_COMPRESSION "EEB47CFB-3A73-48AE-BC2B-B548145CA919") + set(WIX_COMPONENT_ID_AWS_C_EVENT_STREAM "522AA652-D426-43D9-A9E1-B4F7ACAC5981") + set(WIX_COMPONENT_ID_AWS_CHECKSUMS "0E6D8BEA-C4C8-4CC5-A264-17D7B24DB55E") + set(WIX_COMPONENT_ID_AWS_C_HTTP "5AF8104B-2E21-44DB-A4A3-D551C818B118") + set(WIX_COMPONENT_ID_AWS_C_IO "20DBED24-121E-4533-B6AE-A49019F78705") + set(WIX_COMPONENT_ID_AWS_C_MQTT "C420CFFC-2289-4F3C-9FA7-0A1D9271DF90") + set(WIX_COMPONENT_ID_AWS_CRT_CPP "811269B1-D54D-486D-BED3-F0A2A74D4E12") + set(WIX_COMPONENT_ID_AWS_C_S3 "05FB1CFF-6993-4924-A872-322B1250C608") + set(WIX_COMPONENT_ID_AWS_C_SDKUTILS "BD17E26C-ED17-4064-B7F2-8B1BDF965AC7") + set(WIX_BUNDLE_UPGRADE_CODE "BA03135B-F78E-41E5-8D70-C7FD62A4757A") + + set(WIX_PACKAGE_PLATFORM "x64") + endif() - file(DOWNLOAD - "https://aka.ms/vs/17/release/${WIX_VC_RUNTIME_NAME}" - "${CMAKE_BUILD_DIR}/${WIX_VC_RUNTIME_NAME}" - ) + elseif(CMAKE_SIZEOF_VOID_P EQUAL 4) + set(WIX_BIT_SUFFIX "32-bit") + set(WIX_PROGRAM_FILES_FOLDER_ID "Program Files") + set(WIX_COMPONENT_IS_WIN64 "no") + set(WIX_INSTALLER_BUNDLE_SRC + "${CMAKE_CURRENT_LIST_DIR}/install/timestream-odbc-bundle.wxs.in.x86") + + set(WIX_PRODUCT_ID "9FAACB44-B1D9-4E9B-B22E-44FB20C083E2") + set(WIX_UPGRADE_CODE "7BDC7F9E-BB0D-4288-B404-96A78AB0B69D") + set(WIX_COMPONENT_ID_ODBC_LIBRARY "F0B4778F-43BD-447C-B882-E70D9B16AEB6") + set(WIX_COMPONENT_ID_SDK_CORE "1CD3936E-F8CF-42B9-90F9-7F33BC3E1CC1") + set(WIX_COMPONENT_ID_SDK_TS_QUERY "4E88F45B-7623-4A80-9985-0AC2F81F371E") + set(WIX_COMPONENT_ID_SDK_STS "E3E41090-D480-40DE-A7E2-62C038D936BD") + + set(WIX_COMPONENT_ID_AWS_C_AUTH "5376FD5A-D940-4FAC-B666-F9F37BBCA80E") + set(WIX_COMPONENT_ID_AWS_C_CAL "875C5826-F555-4929-BFA5-819096E96437") + set(WIX_COMPONENT_ID_AWS_C_COMMON "0DDAC317-5752-4391-9D5C-0B855F964DF9") + set(WIX_COMPONENT_ID_AWS_C_COMPRESSION "34DE86DB-D1D5-4FE1-B13B-3C0BAD06C784") + set(WIX_COMPONENT_ID_AWS_C_EVENT_STREAM "325A20AC-E459-4ABC-BFC5-E1680951EEE4") + set(WIX_COMPONENT_ID_AWS_CHECKSUMS "7A70A03F-7128-4AAC-9556-0FDB536FEFED") + set(WIX_COMPONENT_ID_AWS_C_HTTP "53D36BAF-F663-4799-8B75-BD8C643BB451") + set(WIX_COMPONENT_ID_AWS_C_IO "922C1B88-9A36-4CE5-A770-EB10F7EF1FD9") + set(WIX_COMPONENT_ID_AWS_C_MQTT "8F43AF91-BB7B-489D-9707-292497BBB21E") + set(WIX_COMPONENT_ID_AWS_CRT_CPP "DB6DCE34-B717-43C1-A53C-EC36227B1B01") + set(WIX_COMPONENT_ID_AWS_C_S3 "E382CA06-AEE1-48D3-95D4-D712A832AC4D") + set(WIX_COMPONENT_ID_AWS_C_SDKUTILS "327859D5-75D3-4E2B-AC08-5E33F4372E4B") + set(WIX_BUNDLE_UPGRADE_CODE "D788EB72-42FC-49EB-A47A-D65087A83C1A") + + set(WIX_PACKAGE_PLATFORM "x86") + endif() + + set(WIX_PRODUCT_NAME "${WIX_PROJECT_NAME} ODBC ${WIX_BIT_SUFFIX} Driver") + set(WIX_VC_RUNTIME_NAME "VC_redist.${WIX_PACKAGE_PLATFORM}.exe") + set(WIX_INSTALLER_PREFIX ${CMAKE_BUILD_DIR}/timestream-odbc-${WIX_PACKAGE_PLATFORM}) + set(WIX_INSTALLER_BUNDLE_PREFIX + ${CMAKE_BUILD_DIR}/timestream-odbc-bundle-${WIX_PACKAGE_PLATFORM}) + set(WIX_INSTALLER_EXE_PREFIX + ${CMAKE_BUILD_DIR}/timestream-odbc-installer-${WIX_PACKAGE_PLATFORM}-${ODBC_DRIVER_VERSION} + ) + + configure_file("${CMAKE_CURRENT_LIST_DIR}/install/timestream-odbc.wxs.in" + "${WIX_INSTALLER_PREFIX}.wxs" @ONLY) + + configure_file("${WIX_INSTALLER_BUNDLE_SRC}" "${WIX_INSTALLER_BUNDLE_PREFIX}.wxs" @ONLY) + + file(DOWNLOAD "https://aka.ms/vs/17/release/${WIX_VC_RUNTIME_NAME}" + "${CMAKE_BUILD_DIR}/${WIX_VC_RUNTIME_NAME}") + + configure_file("${CMAKE_CURRENT_LIST_DIR}/install/images/awslogo.png" + "${CMAKE_BUILD_DIR}/awslogo.png" COPYONLY) + + add_custom_command(TARGET ${TARGET} + POST_BUILD + COMMAND ${WIX_CANDLE} ${WIX_INSTALLER_PREFIX}.wxs -out + ${WIX_INSTALLER_PREFIX}.wxobj + COMMAND ${WIX_LIGHT} ${WIX_INSTALLER_PREFIX}.wxobj -out + ${WIX_INSTALLER_PREFIX}.msi + COMMAND ${WIX_CANDLE} ${WIX_INSTALLER_BUNDLE_PREFIX}.wxs -ext + WixBalExtension -ext WixUtilExtension -out + ${WIX_INSTALLER_BUNDLE_PREFIX}.wixobj + COMMAND ${WIX_LIGHT} ${WIX_INSTALLER_BUNDLE_PREFIX}.wixobj -ext + WixBalExtension -ext WixUtilExtension -out + ${WIX_INSTALLER_EXE_PREFIX}.exe) +elseif(APPLE) + set(CPACK_PACKAGE_FILE_NAME "AmazonTimestreamODBC-${ODBC_DRIVER_VERSION}") + set(CPACK_PACKAGE_NAME "Amazon Timestream ODBC Driver ${ODBC_DRIVER_VERSION}") + set(CPACK_PACKAGE_INSTALL_DIRECTORY "${CPACK_PACKAGE_NAME}") + set(CPACK_GENERATOR "productbuild") + + # This script will be run once the Driver component has finished installing. + set(CPACK_POSTFLIGHT_DRIVER_SCRIPT + "${CMAKE_CURRENT_SOURCE_DIR}/install/mac/postinstall") - configure_file( - "${CMAKE_CURRENT_LIST_DIR}/install/images/awslogo.png" - "${CMAKE_BUILD_DIR}/awslogo.png" - COPYONLY + set(CPACK_RESOURCE_FILE_README "${CMAKE_CURRENT_SOURCE_DIR}/install/mac/README.txt") + set(CPACK_RESOURCE_FILE_WELCOME "${CMAKE_CURRENT_SOURCE_DIR}/install/mac/Welcome.txt") +elseif(UNIX) + if(${INSTALLER_TYPE} STREQUAL "DEB") + if(${BITNESS} EQUAL 32) + set(CPACK_DEBIAN_PACKAGE_ARCHITECTURE i386) + else() + set(CPACK_DEBIAN_PACKAGE_ARCHITECTURE amd64) + endif() + set(CPACK_GENERATOR "DEB") + set(CPACK_DEBIAN_FILE_NAME + "AmazonTimestreamODBC_${ODBC_DRIVER_VERSION}_${CMAKE_BUILD_TYPE}_${CPACK_DEBIAN_PACKAGE_ARCHITECTURE}.deb" ) - add_custom_command( - TARGET ${TARGET} POST_BUILD - COMMAND ${WIX_CANDLE} ${WIX_INSTALLER_PREFIX}.wxs -out ${WIX_INSTALLER_PREFIX}.wxobj - COMMAND ${WIX_LIGHT} ${WIX_INSTALLER_PREFIX}.wxobj -out ${WIX_INSTALLER_PREFIX}.msi - COMMAND ${WIX_CANDLE} ${WIX_INSTALLER_BUNDLE_PREFIX}.wxs -ext WixBalExtension -ext WixUtilExtension -out ${WIX_INSTALLER_BUNDLE_PREFIX}.wixobj - COMMAND ${WIX_LIGHT} ${WIX_INSTALLER_BUNDLE_PREFIX}.wixobj -ext WixBalExtension -ext WixUtilExtension -out ${WIX_INSTALLER_EXE_PREFIX}.exe + # Deb installers fail if there's a space in the directory or package name + set(CPACK_PACKAGE_INSTALL_DIRECTORY "AmazonTimestreamODBCDriver${BITNESS}-bit") + set(CPACK_PACKAGE_NAME + "AmazonTimestreamODBC_${ODBC_DRIVER_VERSION}_${CMAKE_BUILD_TYPE}_${CPACK_DEBIAN_PACKAGE_ARCHITECTURE}" ) -elseif(APPLE) - set(CPACK_PACKAGE_FILE_NAME "AmazonTimestreamODBC-${ODBC_DRIVER_VERSION}") - set(CPACK_PACKAGE_NAME "Amazon Timestream ODBC Driver ${ODBC_DRIVER_VERSION}") - set(CPACK_PACKAGE_INSTALL_DIRECTORY "${CPACK_PACKAGE_NAME}") - set(CPACK_GENERATOR "productbuild") - # This script will be run once the Driver component has finished installing. - set(CPACK_POSTFLIGHT_DRIVER_SCRIPT "${CMAKE_CURRENT_SOURCE_DIR}/install/mac/postinstall") + # TODO: Need to update both of these. + set(CPACK_PACKAGE_CONTACT "user@sample.com") + set(CPACK_DEBIAN_PACKAGE_MAINTAINER "User Name") + set(CPACK_PACKAGE_DESCRIPTION + "AmazonTimestreamODBCDriver-${CMAKE_BUILD_TYPE}-${BITNESS}-bit") - set(CPACK_RESOURCE_FILE_README "${CMAKE_CURRENT_SOURCE_DIR}/install/mac/README.txt") - set(CPACK_RESOURCE_FILE_WELCOME "${CMAKE_CURRENT_SOURCE_DIR}/install/mac/Welcome.txt") -elseif(UNIX) - if (${INSTALLER_TYPE} STREQUAL "DEB") - if (${BITNESS} EQUAL 32) - set(CPACK_DEBIAN_PACKAGE_ARCHITECTURE i386) - else() - set(CPACK_DEBIAN_PACKAGE_ARCHITECTURE amd64) - endif() - set(CPACK_GENERATOR "DEB") - set(CPACK_DEBIAN_FILE_NAME "AmazonTimestreamODBC_${ODBC_DRIVER_VERSION}_${CMAKE_BUILD_TYPE}_${CPACK_DEBIAN_PACKAGE_ARCHITECTURE}.deb") - - # Deb installers fail if there's a space in the directory or package name - set(CPACK_PACKAGE_INSTALL_DIRECTORY "AmazonTimestreamODBCDriver${BITNESS}-bit") - set(CPACK_PACKAGE_NAME "AmazonTimestreamODBC_${ODBC_DRIVER_VERSION}_${CMAKE_BUILD_TYPE}_${CPACK_DEBIAN_PACKAGE_ARCHITECTURE}") - - # TODO: Need to update both of these. - set(CPACK_PACKAGE_CONTACT "user@sample.com") - set(CPACK_DEBIAN_PACKAGE_MAINTAINER "User Name") - set(CPACK_PACKAGE_DESCRIPTION "AmazonTimestreamODBCDriver-${CMAKE_BUILD_TYPE}-${BITNESS}-bit") - - set(CPACK_DEBIAN_PACKAGE_SHLIBDEPS ON) - elseif(${INSTALLER_TYPE} STREQUAL "RPM") - if (${BITNESS} EQUAL 32) - set(CPACK_RPM_PACKAGE_ARCHITECTURE i386) - else() - set(CPACK_RPM_PACKAGE_ARCHITECTURE x86_64) - endif() - set(CPACK_GENERATOR RPM) - - set(CPACK_PACKAGE_INSTALL_DIRECTORY "Amazon Timestream ODBC Driver ${BITNESS}-bit") - set(CPACK_PACKAGE_NAME "AmazonTimestreamODBC_${ODBC_DRIVER_VERSION}_${CMAKE_BUILD_TYPE}_${CPACK_RPM_PACKAGE_ARCHITECTURE}") - set(CPACK_RPM_FILE_NAME "${CPACK_PACKAGE_NAME}.rpm") - - set(CPACK_COMPONENTS_ALL_IN_ONE_PACKAGE 1) - set(CPACK_RPM_COMPONENT_INSTALL ON) + set(CPACK_DEBIAN_PACKAGE_SHLIBDEPS ON) + elseif(${INSTALLER_TYPE} STREQUAL "RPM") + if(${BITNESS} EQUAL 32) + set(CPACK_RPM_PACKAGE_ARCHITECTURE i386) else() - message(FATAL_ERROR "INSTALLER_TYPE '${INSTALLER_TYPE}' must be DEB or RPM for Linux installer." ) + set(CPACK_RPM_PACKAGE_ARCHITECTURE x86_64) endif() -endif() + set(CPACK_GENERATOR RPM) -if(UNIX) - set(CPACK_PACKAGE_DESCRIPTION_SUMMARY "${CPACK_PACKAGE_NAME}") - set(CPACK_PACKAGE_VENDOR "Amazon") - set(CPACK_SYSTEM_NAME "${CMAKE_SYSTEM_NAME}") - - # CPack doesn't allow extensionless licenses, need to make a copy with an extension, .txt is appropriate - set(CPACK_RESOURCE_FILE_LICENSE "${PROJECT_ROOT}/LICENSE.txt") - # Prepend LICENSE file with NOTICE - configure_file("${PROJECT_ROOT}/NOTICE" "${PROJECT_ROOT}/LICENSE.txt" COPYONLY) - file(APPEND "${PROJECT_ROOT}/LICENSE.txt" "\n=====================================================\n") - file(READ "${PROJECT_ROOT}/LICENSE" ODBC_LICENSE) - file(APPEND "${PROJECT_ROOT}/LICENSE.txt" ${ODBC_LICENSE}) - - # Set up components for installer - cpack_add_component(Docs - DISPLAY_NAME "Documentation" - DESCRIPTION "Documentation about Amazon Timestream ODBC Driver" + set(CPACK_PACKAGE_INSTALL_DIRECTORY "Amazon Timestream ODBC Driver ${BITNESS}-bit") + set(CPACK_PACKAGE_NAME + "AmazonTimestreamODBC_${ODBC_DRIVER_VERSION}_${CMAKE_BUILD_TYPE}_${CPACK_RPM_PACKAGE_ARCHITECTURE}" ) - cpack_add_component(Driver - DISPLAY_NAME "Driver" - DESCRIPTION "Library files for running the Amazon Timestream ODBC Driver" - REQUIRED + set(CPACK_RPM_FILE_NAME "${CPACK_PACKAGE_NAME}.rpm") + + set(CPACK_COMPONENTS_ALL_IN_ONE_PACKAGE 1) + set(CPACK_RPM_COMPONENT_INSTALL ON) + else() + message(FATAL_ERROR "INSTALLER_TYPE '${INSTALLER_TYPE}' must be DEB or RPM for Linux installer." ) + endif() +endif() - if(APPLE) - install(TARGETS ${TARGET} DESTINATION "timestream-odbc/lib" COMPONENT "Driver") - - # Install documentation files - install(FILES "${PROJECT_ROOT}/LICENSE.txt" DESTINATION "timestream-odbc/doc" COMPONENT "Docs") - install(FILES "${PROJECT_ROOT}/docs/markdown/setup/connection-string.md" DESTINATION "timestream-odbc/doc" COMPONENT "Docs") - install(FILES "${PROJECT_ROOT}/docs/markdown/setup/macOS-dsn-configuration.md" DESTINATION "timestream-odbc/doc" COMPONENT "Docs") - install(FILES "${PROJECT_ROOT}/docs/markdown/setup/microsoft-excel.md" DESTINATION "timestream-odbc/doc" COMPONENT "Docs") +if(UNIX) + set(CPACK_PACKAGE_DESCRIPTION_SUMMARY "${CPACK_PACKAGE_NAME}") + set(CPACK_PACKAGE_VENDOR "Amazon") + set(CPACK_SYSTEM_NAME "${CMAKE_SYSTEM_NAME}") + + # CPack doesn't allow extensionless licenses, need to make a copy with an extension, .txt is appropriate + set(CPACK_RESOURCE_FILE_LICENSE "${PROJECT_ROOT}/LICENSE.txt") + # Prepend LICENSE file with NOTICE + configure_file("${PROJECT_ROOT}/NOTICE" "${PROJECT_ROOT}/LICENSE.txt" COPYONLY) + file(APPEND "${PROJECT_ROOT}/LICENSE.txt" + "\n=====================================================\n") + file(READ "${PROJECT_ROOT}/LICENSE" ODBC_LICENSE) + file(APPEND "${PROJECT_ROOT}/LICENSE.txt" ${ODBC_LICENSE}) + + # Set up components for installer + cpack_add_component(Docs + DISPLAY_NAME "Documentation" + DESCRIPTION "Documentation about Amazon Timestream ODBC Driver") + cpack_add_component(Driver + DISPLAY_NAME "Driver" + DESCRIPTION "Library files for running the Amazon Timestream ODBC Driver" + REQUIRED) + + if(APPLE) + install(TARGETS ${TARGET} + DESTINATION "timestream-odbc/lib" + COMPONENT "Driver") + + # Install documentation files + install(FILES "${PROJECT_ROOT}/LICENSE.txt" + DESTINATION "timestream-odbc/doc" + COMPONENT "Docs") + install(FILES "${PROJECT_ROOT}/docs/markdown/setup/connection-string.md" + DESTINATION "timestream-odbc/doc" + COMPONENT "Docs") + install(FILES "${PROJECT_ROOT}/docs/markdown/setup/macOS-dsn-configuration.md" + DESTINATION "timestream-odbc/doc" + COMPONENT "Docs") + install(FILES "${PROJECT_ROOT}/docs/markdown/setup/microsoft-excel.md" + DESTINATION "timestream-odbc/doc" + COMPONENT "Docs") + else() + if(${BITNESS} EQUAL 32) + set(LIBROOT lib) + add_custom_target(run ALL + COMMAND sed -e + "s@\#ODBC_LIB_PATH@ODBC_LIB_PATH=\/usr\/lib\/timestream-odbc32@" + ${PROJECT_ROOT}/scripts/postinst_unix.sh > + ${PROJECT_ROOT}/scripts/postinst_unix${BITNESS}.sh) else() - if (${BITNESS} EQUAL 32) - set(LIBROOT lib) - add_custom_target(run ALL COMMAND sed -e "s@\#ODBC_LIB_PATH@ODBC_LIB_PATH=\/usr\/lib\/timestream-odbc32@" ${PROJECT_ROOT}/scripts/postinst_unix.sh > ${PROJECT_ROOT}/scripts/postinst_unix${BITNESS}.sh) - else() - set(LIBROOT lib64) - add_custom_target(run ALL COMMAND sed -e "s@\#ODBC_LIB_PATH@ODBC_LIB_PATH=\/usr\/lib64\/timestream-odbc64@" ${PROJECT_ROOT}/scripts/postinst_unix.sh > ${PROJECT_ROOT}/scripts/postinst_unix${BITNESS}.sh) - endif() - - # Install library and shell script - - install(TARGETS ${TARGET} DESTINATION ${LIBROOT}/timestream-odbc${BITNESS} COMPONENT "Driver") - install(FILES "${PROJECT_ROOT}/scripts/postinst_unix${BITNESS}.sh" DESTINATION ${LIBROOT}/timestream-odbc${BITNESS} PERMISSIONS OWNER_EXECUTE OWNER_WRITE OWNER_READ GROUP_EXECUTE GROUP_READ WORLD_READ WORLD_EXECUTE COMPONENT "Driver") - - # Install documentation files - install(FILES "${PROJECT_ROOT}/LICENSE.txt" DESTINATION "${LIBROOT}/timestream-odbc${BITNESS}" COMPONENT "Docs") - install(FILES "${PROJECT_ROOT}/docs/markdown/setup/linux-dsn-configuration.md" DESTINATION "${LIBROOT}/timestream-odbc${BITNESS}" COMPONENT "Docs") + set(LIBROOT lib64) + add_custom_target(run ALL + COMMAND sed -e + "s@\#ODBC_LIB_PATH@ODBC_LIB_PATH=\/usr\/lib64\/timestream-odbc64@" + ${PROJECT_ROOT}/scripts/postinst_unix.sh > + ${PROJECT_ROOT}/scripts/postinst_unix${BITNESS}.sh) endif() + + # Install library and shell script + + install(TARGETS ${TARGET} + DESTINATION ${LIBROOT}/timestream-odbc${BITNESS} + COMPONENT "Driver") + install(FILES "${PROJECT_ROOT}/scripts/postinst_unix${BITNESS}.sh" + DESTINATION ${LIBROOT}/timestream-odbc${BITNESS} + PERMISSIONS OWNER_EXECUTE + OWNER_WRITE + OWNER_READ + GROUP_EXECUTE + GROUP_READ + WORLD_READ + WORLD_EXECUTE + COMPONENT "Driver") + + # Install documentation files + install(FILES "${PROJECT_ROOT}/LICENSE.txt" + DESTINATION "${LIBROOT}/timestream-odbc${BITNESS}" + COMPONENT "Docs") + install(FILES "${PROJECT_ROOT}/docs/markdown/setup/linux-dsn-configuration.md" + DESTINATION "${LIBROOT}/timestream-odbc${BITNESS}" + COMPONENT "Docs") + endif() endif() target_include_directories(${TARGET} INTERFACE include) -install(TARGETS ${TARGET} - RUNTIME DESTINATION bin - ARCHIVE DESTINATION lib - LIBRARY DESTINATION lib -) +install(TARGETS ${TARGET} + RUNTIME DESTINATION bin + ARCHIVE DESTINATION lib + LIBRARY DESTINATION lib) -if (WIN32) - if (MSVC_VERSION GREATER_EQUAL 1900) - target_link_libraries(${TARGET} legacy_stdio_definitions odbccp32 shlwapi) - endif() +if(WIN32) + if(MSVC_VERSION GREATER_EQUAL 1900) + target_link_libraries(${TARGET} legacy_stdio_definitions odbccp32 shlwapi) + endif() elseif(APPLE) - target_link_libraries(${TARGET} iodbcinst) + target_link_libraries(${TARGET} iodbcinst) else() - target_link_libraries(${TARGET} odbcinst) + target_link_libraries(${TARGET} odbcinst) endif() -set(VERSIONINFO ${CMAKE_PROJECT_VERSION_MAJOR},${CMAKE_PROJECT_VERSION_MINOR},${CMAKE_PROJECT_VERSION_PATCH}) -set(VERSIONINFO_STR ${CMAKE_PROJECT_VERSION_MAJOR}.${CMAKE_PROJECT_VERSION_MINOR}.${CMAKE_PROJECT_VERSION_PATCH}) +set(VERSIONINFO + ${CMAKE_PROJECT_VERSION_MAJOR},${CMAKE_PROJECT_VERSION_MINOR},${CMAKE_PROJECT_VERSION_PATCH} +) +set(VERSIONINFO_STR + ${CMAKE_PROJECT_VERSION_MAJOR}.${CMAKE_PROJECT_VERSION_MINOR}.${CMAKE_PROJECT_VERSION_PATCH} +) configure_file("version.rc.in" "version.rc" @ONLY) include(CPack) diff --git a/cpp/src/arrow/flight/sql/amazon-timestream-odbc-driver/src/tests/data-writer/CMakeLists.txt b/cpp/src/arrow/flight/sql/amazon-timestream-odbc-driver/src/tests/data-writer/CMakeLists.txt index 5d160413fad5a..875bbc09ee945 100644 --- a/cpp/src/arrow/flight/sql/amazon-timestream-odbc-driver/src/tests/data-writer/CMakeLists.txt +++ b/cpp/src/arrow/flight/sql/amazon-timestream-odbc-driver/src/tests/data-writer/CMakeLists.txt @@ -1,11 +1,11 @@ # Copyright <2022> Amazon.com, Inc. or its affiliates. All Rights Reserved. -# +# # Licensed under the Apache License, Version 2.0 (the "License"). # You may not use this file except in compliance with the License. # A copy of the License is located at -# +# # http://www.apache.org/licenses/LICENSE-2.0 -# +# # or in the "license" file accompanying this file. This file 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 @@ -16,31 +16,42 @@ project(timestream-populate-data) set(TARGET ${PROJECT_NAME}) find_package(AWSSDK REQUIRED COMPONENTS core sts timestream-query timestream-write) -if (UNIX) - find_package(ZLIB REQUIRED) +if(UNIX) + find_package(ZLIB REQUIRED) endif() find_package(Threads REQUIRED) -include_directories(include ../../odbc/include ../integration-test/include ${AWSSDK_INCLUDE_DIRS}) -if (WIN32) - include_directories(../../odbc/os/win/include) - - # ensure our self-build aws sdk library could be found - set_target_properties(aws-cpp-sdk-core aws-cpp-sdk-sts aws-cpp-sdk-timestream-query aws-cpp-sdk-timestream-write PROPERTIES - IMPORTED_IMPLIB ${CMAKE_SOURCE_DIR}/../build/aws-sdk/install/bin - ) - set_target_properties(AWS::aws-crt-cpp AWS::aws-c-cal AWS::aws-c-auth AWS::aws-c-common AWS::aws-c-io AWS::aws-checksums AWS::aws-c-event-stream AWS::aws-c-s3 AWS::aws-c-http AWS::aws-c-mqtt AWS::aws-c-compression AWS::aws-c-sdkutils PROPERTIES - IMPORTED_IMPLIB ${CMAKE_SOURCE_DIR}/../build/aws-sdk/install/lib - ) - -else () - include_directories(../../odbc/os/linux/include) +include_directories(include ../../odbc/include ../integration-test/include + ${AWSSDK_INCLUDE_DIRS}) +if(WIN32) + include_directories(../../odbc/os/win/include) + + # ensure our self-build aws sdk library could be found + set_target_properties(aws-cpp-sdk-core aws-cpp-sdk-sts aws-cpp-sdk-timestream-query + aws-cpp-sdk-timestream-write + PROPERTIES IMPORTED_IMPLIB + ${CMAKE_SOURCE_DIR}/../build/aws-sdk/install/bin) + set_target_properties(AWS::aws-crt-cpp + AWS::aws-c-cal + AWS::aws-c-auth + AWS::aws-c-common + AWS::aws-c-io + AWS::aws-checksums + AWS::aws-c-event-stream + AWS::aws-c-s3 + AWS::aws-c-http + AWS::aws-c-mqtt + AWS::aws-c-compression + AWS::aws-c-sdkutils + PROPERTIES IMPORTED_IMPLIB + ${CMAKE_SOURCE_DIR}/../build/aws-sdk/install/lib) + +else() + include_directories(../../odbc/os/linux/include) endif() -set(SOURCES - timestream_data_generator.cpp - timestream_writer.cpp) +set(SOURCES timestream_data_generator.cpp timestream_writer.cpp) add_executable(${TARGET} ${SOURCES}) diff --git a/cpp/src/arrow/flight/sql/amazon-timestream-odbc-driver/src/tests/integration-test/CMakeLists.txt b/cpp/src/arrow/flight/sql/amazon-timestream-odbc-driver/src/tests/integration-test/CMakeLists.txt index e52bdc29afcaf..4afb80f93188e 100644 --- a/cpp/src/arrow/flight/sql/amazon-timestream-odbc-driver/src/tests/integration-test/CMakeLists.txt +++ b/cpp/src/arrow/flight/sql/amazon-timestream-odbc-driver/src/tests/integration-test/CMakeLists.txt @@ -22,59 +22,66 @@ project(timestream-odbc-integration-tests) set(TARGET ${PROJECT_NAME}) -if (WIN32) - set(Boost_USE_STATIC_LIBS ON) +if(WIN32) + set(Boost_USE_STATIC_LIBS ON) endif() -find_package(Boost 1.53 REQUIRED COMPONENTS unit_test_framework chrono thread system regex) +find_package(Boost 1.53 REQUIRED + COMPONENTS unit_test_framework + chrono + thread + system + regex) find_package(ODBC REQUIRED) find_package(AWSSDK REQUIRED COMPONENTS core sts timestream-query) -if (UNIX) - find_package(ZLIB REQUIRED) +if(UNIX) + find_package(ZLIB REQUIRED) endif() find_package(Threads REQUIRED) -include_directories(SYSTEM ${ODBC_INCLUDE_DIRS} ${Boost_INCLUDE_DIRS} ${AWSSDK_INCLUDE_DIRS}) +include_directories(SYSTEM ${ODBC_INCLUDE_DIRS} ${Boost_INCLUDE_DIRS} + ${AWSSDK_INCLUDE_DIRS}) include_directories(include ../../odbc/include) -if (WIN32) - include_directories(../../odbc/os/ignite/common/os/win/include ../../odbc/os/timestream/win/include) -else () - include_directories(../../odbc/os/ignite/common/os/linux/include ../../odbc/os/timestream/linux/include) +if(WIN32) + include_directories(../../odbc/os/ignite/common/os/win/include + ../../odbc/os/timestream/win/include) +else() + include_directories(../../odbc/os/ignite/common/os/linux/include + ../../odbc/os/timestream/linux/include) endif() -set(SOURCES - src/api_robustness_test.cpp - src/application_data_buffer_test.cpp - src/attributes_test.cpp - src/connection_info_test.cpp - src/connection_test.cpp - src/descriptors_test.cpp - src/meta_queries_test.cpp - src/odbc_test_suite.cpp - src/odbc_execution_test.cpp - src/queries_test.cpp - src/sql_get_info_test.cpp - src/test_utils.cpp - ) - -if (WIN32) - list(APPEND SOURCES - ../../odbc/os/ignite/common/os/win/src/common/concurrent_os.cpp - ../../odbc/os/ignite/common/os/win/src/common/platform_utils.cpp - ../../odbc/os/ignite/common/os/win/src/common/dynamic_load_os.cpp - ../../odbc/os/timestream/win/src/system_dsn.cpp - ../../odbc/os/timestream/win/src/system/ui/custom_window.cpp - ../../odbc/os/timestream/win/src/system/ui/dsn_configuration_window.cpp - ../../odbc/os/timestream/win/src/system/ui/window.cpp - ) +set(SOURCES + src/api_robustness_test.cpp + src/application_data_buffer_test.cpp + src/attributes_test.cpp + src/connection_info_test.cpp + src/connection_test.cpp + src/descriptors_test.cpp + src/meta_queries_test.cpp + src/odbc_test_suite.cpp + src/odbc_execution_test.cpp + src/queries_test.cpp + src/sql_get_info_test.cpp + src/test_utils.cpp) + +if(WIN32) + list(APPEND + SOURCES + ../../odbc/os/ignite/common/os/win/src/common/concurrent_os.cpp + ../../odbc/os/ignite/common/os/win/src/common/platform_utils.cpp + ../../odbc/os/ignite/common/os/win/src/common/dynamic_load_os.cpp + ../../odbc/os/timestream/win/src/system_dsn.cpp + ../../odbc/os/timestream/win/src/system/ui/custom_window.cpp + ../../odbc/os/timestream/win/src/system/ui/dsn_configuration_window.cpp + ../../odbc/os/timestream/win/src/system/ui/window.cpp) else() - list(APPEND SOURCES - ../../odbc/os/ignite/common/os/linux/src/common/concurrent_os.cpp - ../../odbc/os/ignite/common/os/linux/src/common/platform_utils.cpp - ../../odbc/os/ignite/common/os/linux/src/common/dynamic_load_os.cpp - ) + list(APPEND + SOURCES + ../../odbc/os/ignite/common/os/linux/src/common/concurrent_os.cpp + ../../odbc/os/ignite/common/os/linux/src/common/platform_utils.cpp + ../../odbc/os/ignite/common/os/linux/src/common/dynamic_load_os.cpp) endif() add_executable(${TARGET} ${SOURCES}) @@ -83,25 +90,39 @@ add_dependencies(timestream-odbc-integration-tests timestream-odbc) target_link_libraries(${TARGET} ${ODBC_LIBRARIES}) target_link_libraries(${TARGET} ${Boost_UNIT_TEST_FRAMEWORK_LIBRARY} ${Boost_LIBRARIES}) -if (WIN32) - # ensure our self-build aws sdk library could be found - set_target_properties(aws-cpp-sdk-core aws-cpp-sdk-sts aws-cpp-sdk-timestream-query PROPERTIES - IMPORTED_IMPLIB ${CMAKE_SOURCE_DIR}/../build/aws-sdk/install/bin - ) - set_target_properties(AWS::aws-crt-cpp AWS::aws-c-cal AWS::aws-c-auth AWS::aws-c-common AWS::aws-c-io AWS::aws-checksums AWS::aws-c-event-stream AWS::aws-c-s3 AWS::aws-c-http AWS::aws-c-mqtt AWS::aws-c-compression AWS::aws-c-sdkutils PROPERTIES - IMPORTED_IMPLIB ${CMAKE_SOURCE_DIR}/../build/aws-sdk/install/lib - ) - - target_link_libraries(${TARGET} ${AWSSDK_LINK_LIBRARIES}) - target_link_libraries(${TARGET} ${CMAKE_BINARY_DIR}/odbc/${CMAKE_BUILD_TYPE}/timestream-odbc-static.lib) +if(WIN32) + # ensure our self-build aws sdk library could be found + set_target_properties(aws-cpp-sdk-core aws-cpp-sdk-sts aws-cpp-sdk-timestream-query + PROPERTIES IMPORTED_IMPLIB + ${CMAKE_SOURCE_DIR}/../build/aws-sdk/install/bin) + set_target_properties(AWS::aws-crt-cpp + AWS::aws-c-cal + AWS::aws-c-auth + AWS::aws-c-common + AWS::aws-c-io + AWS::aws-checksums + AWS::aws-c-event-stream + AWS::aws-c-s3 + AWS::aws-c-http + AWS::aws-c-mqtt + AWS::aws-c-compression + AWS::aws-c-sdkutils + PROPERTIES IMPORTED_IMPLIB + ${CMAKE_SOURCE_DIR}/../build/aws-sdk/install/lib) + + target_link_libraries(${TARGET} ${AWSSDK_LINK_LIBRARIES}) + target_link_libraries(${TARGET} + ${CMAKE_BINARY_DIR}/odbc/${CMAKE_BUILD_TYPE}/timestream-odbc-static.lib + ) elseif(APPLE) - target_link_libraries(${TARGET} ${CMAKE_LIBRARY_OUTPUT_DIRECTORY}/libtimestream-odbc.dylib) + target_link_libraries(${TARGET} + ${CMAKE_LIBRARY_OUTPUT_DIRECTORY}/libtimestream-odbc.dylib) else() - target_link_libraries(${TARGET} ${CMAKE_LIBRARY_OUTPUT_DIRECTORY}/libtimestream-odbc.so) + target_link_libraries(${TARGET} ${CMAKE_LIBRARY_OUTPUT_DIRECTORY}/libtimestream-odbc.so) endif() -if (${CODE_COVERAGE}) - target_code_coverage(${TARGET} AUTO) +if(${CODE_COVERAGE}) + target_code_coverage(${TARGET} AUTO) endif() add_definitions(-DUNICODE=1) @@ -110,21 +131,24 @@ add_definitions(-DPROJECT_VERSION_MAJOR=${CMAKE_PROJECT_VERSION_MAJOR}) add_definitions(-DPROJECT_VERSION_MINOR=${CMAKE_PROJECT_VERSION_MINOR}) add_definitions(-DPROJECT_VERSION_PATCH=${CMAKE_PROJECT_VERSION_PATCH}) -if (WIN32) - add_definitions(-DTARGET_MODULE_FULL_NAME="$") - if (MSVC_VERSION GREATER_EQUAL 1900) - target_link_libraries(${TARGET} legacy_stdio_definitions odbccp32 shlwapi) - endif() +if(WIN32) + add_definitions(-DTARGET_MODULE_FULL_NAME="$") + if(MSVC_VERSION GREATER_EQUAL 1900) + target_link_libraries(${TARGET} legacy_stdio_definitions odbccp32 shlwapi) + endif() elseif(APPLE) - add_definitions(-DBOOST_TEST_DYN_LINK) - target_link_libraries(${TARGET} iodbcinst ${CMAKE_DL_LIBS} ${CMAKE_THREAD_LIBS_INIT}) + add_definitions(-DBOOST_TEST_DYN_LINK) + target_link_libraries(${TARGET} iodbcinst ${CMAKE_DL_LIBS} ${CMAKE_THREAD_LIBS_INIT}) else() - add_definitions(-DBOOST_TEST_DYN_LINK) - target_link_libraries(${TARGET} odbcinst ${CMAKE_DL_LIBS} ${CMAKE_THREAD_LIBS_INIT}) + add_definitions(-DBOOST_TEST_DYN_LINK) + target_link_libraries(${TARGET} odbcinst ${CMAKE_DL_LIBS} ${CMAKE_THREAD_LIBS_INIT}) endif() set(TEST_TARGET IgniteOdbcTest) add_test(NAME ${TEST_TARGET} COMMAND ${TARGET} --catch_system_errors=no --log_level=all) -set_tests_properties(${TEST_TARGET} PROPERTIES ENVIRONMENT IGNITE_NATIVE_TEST_ODBC_CONFIG_PATH=${PROJECT_SOURCE_DIR}/config) +set_tests_properties(${TEST_TARGET} + PROPERTIES ENVIRONMENT + IGNITE_NATIVE_TEST_ODBC_CONFIG_PATH=${PROJECT_SOURCE_DIR}/config +) diff --git a/cpp/src/arrow/flight/sql/amazon-timestream-odbc-driver/src/tests/unit-test/CMakeLists.txt b/cpp/src/arrow/flight/sql/amazon-timestream-odbc-driver/src/tests/unit-test/CMakeLists.txt index 4896a5e8aac8e..dd05a2c435d3d 100644 --- a/cpp/src/arrow/flight/sql/amazon-timestream-odbc-driver/src/tests/unit-test/CMakeLists.txt +++ b/cpp/src/arrow/flight/sql/amazon-timestream-odbc-driver/src/tests/unit-test/CMakeLists.txt @@ -1,11 +1,11 @@ # Copyright <2022> Amazon.com, Inc. or its affiliates. All Rights Reserved. -# +# # Licensed under the Apache License, Version 2.0 (the "License"). # You may not use this file except in compliance with the License. # A copy of the License is located at -# +# # http://www.apache.org/licenses/LICENSE-2.0 -# +# # or in the "license" file accompanying this file. This file 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 @@ -15,87 +15,111 @@ project(timestream-odbc-unit-tests) set(TARGET ${PROJECT_NAME}) -if (WIN32) - set(Boost_USE_STATIC_LIBS ON) +if(WIN32) + set(Boost_USE_STATIC_LIBS ON) endif() -find_package(Boost 1.53 REQUIRED COMPONENTS unit_test_framework chrono thread system regex) +find_package(Boost 1.53 REQUIRED + COMPONENTS unit_test_framework + chrono + thread + system + regex) find_package(AWSSDK REQUIRED COMPONENTS core sts timestream-query) -if (UNIX) - find_package(ZLIB REQUIRED) +if(UNIX) + find_package(ZLIB REQUIRED) endif() find_package(Threads REQUIRED) include_directories(SYSTEM ${Boost_INCLUDE_DIRS}) -include_directories(include ../../odbc/include ../integration-test/include ${AWSSDK_INCLUDE_DIRS}) -if (WIN32) - include_directories(../../odbc/os/ignite/common/os/win/include ../../odbc/os/timestream/win/include) -else () - include_directories(../../odbc/os/ignite/common/os/linux/include ../../odbc/os/timestream/linux/include) +include_directories(include ../../odbc/include ../integration-test/include + ${AWSSDK_INCLUDE_DIRS}) +if(WIN32) + include_directories(../../odbc/os/ignite/common/os/win/include + ../../odbc/os/timestream/win/include) +else() + include_directories(../../odbc/os/ignite/common/os/linux/include + ../../odbc/os/timestream/linux/include) endif() -set(SOURCES - src/column_meta_test.cpp - src/configuration_test.cpp - src/log_test.cpp - src/unit_connection_string_parser_test.cpp - src/unit_connection_test.cpp - src/unit_data_query_test.cpp - src/utility_test.cpp - src/odbc_unit_test_suite.cpp - src/mock/mock_environment.cpp - src/mock/mock_connection.cpp - src/mock/mock_httpclient.cpp - src/mock/mock_statement.cpp - src/mock/mock_stsclient.cpp - src/mock/mock_timestream_query_client.cpp - src/mock/mock_timestream_service.cpp - ) +set(SOURCES + src/column_meta_test.cpp + src/configuration_test.cpp + src/log_test.cpp + src/unit_connection_string_parser_test.cpp + src/unit_connection_test.cpp + src/unit_data_query_test.cpp + src/utility_test.cpp + src/odbc_unit_test_suite.cpp + src/mock/mock_environment.cpp + src/mock/mock_connection.cpp + src/mock/mock_httpclient.cpp + src/mock/mock_statement.cpp + src/mock/mock_stsclient.cpp + src/mock/mock_timestream_query_client.cpp + src/mock/mock_timestream_service.cpp) add_executable(${TARGET} ${SOURCES}) add_dependencies(timestream-odbc-unit-tests timestream-odbc) target_link_libraries(${TARGET} ${Boost_UNIT_TEST_FRAMEWORK_LIBRARY} ${Boost_LIBRARIES}) -if (WIN32) - # ensure our self-build aws sdk library could be found - set_target_properties(aws-cpp-sdk-core aws-cpp-sdk-sts aws-cpp-sdk-timestream-query PROPERTIES - IMPORTED_IMPLIB ${CMAKE_SOURCE_DIR}/../build/aws-sdk/install/bin - ) - set_target_properties(AWS::aws-crt-cpp AWS::aws-c-cal AWS::aws-c-auth AWS::aws-c-common AWS::aws-c-io AWS::aws-checksums AWS::aws-c-event-stream AWS::aws-c-s3 AWS::aws-c-http AWS::aws-c-mqtt AWS::aws-c-compression AWS::aws-c-sdkutils PROPERTIES - IMPORTED_IMPLIB ${CMAKE_SOURCE_DIR}/../build/aws-sdk/install/lib - ) - - target_link_libraries(${TARGET} ${AWSSDK_LINK_LIBRARIES}) - target_link_libraries(${TARGET} ${CMAKE_BINARY_DIR}/odbc/${CMAKE_BUILD_TYPE}/timestream-odbc-static.lib) +if(WIN32) + # ensure our self-build aws sdk library could be found + set_target_properties(aws-cpp-sdk-core aws-cpp-sdk-sts aws-cpp-sdk-timestream-query + PROPERTIES IMPORTED_IMPLIB + ${CMAKE_SOURCE_DIR}/../build/aws-sdk/install/bin) + set_target_properties(AWS::aws-crt-cpp + AWS::aws-c-cal + AWS::aws-c-auth + AWS::aws-c-common + AWS::aws-c-io + AWS::aws-checksums + AWS::aws-c-event-stream + AWS::aws-c-s3 + AWS::aws-c-http + AWS::aws-c-mqtt + AWS::aws-c-compression + AWS::aws-c-sdkutils + PROPERTIES IMPORTED_IMPLIB + ${CMAKE_SOURCE_DIR}/../build/aws-sdk/install/lib) + + target_link_libraries(${TARGET} ${AWSSDK_LINK_LIBRARIES}) + target_link_libraries(${TARGET} + ${CMAKE_BINARY_DIR}/odbc/${CMAKE_BUILD_TYPE}/timestream-odbc-static.lib + ) elseif(APPLE) - target_link_libraries(${TARGET} ${CMAKE_LIBRARY_OUTPUT_DIRECTORY}/libtimestream-odbc.dylib) + target_link_libraries(${TARGET} + ${CMAKE_LIBRARY_OUTPUT_DIRECTORY}/libtimestream-odbc.dylib) else() - target_link_libraries(${TARGET} ${CMAKE_LIBRARY_OUTPUT_DIRECTORY}/libtimestream-odbc.so) + target_link_libraries(${TARGET} ${CMAKE_LIBRARY_OUTPUT_DIRECTORY}/libtimestream-odbc.so) endif() -if (${CODE_COVERAGE}) - target_code_coverage(${TARGET} AUTO) +if(${CODE_COVERAGE}) + target_code_coverage(${TARGET} AUTO) endif() add_definitions(-DUNICODE=1) -if (WIN32) - add_definitions(-DTARGET_MODULE_FULL_NAME="$") - if (MSVC_VERSION GREATER_EQUAL 1900) - target_link_libraries(${TARGET} legacy_stdio_definitions odbccp32 shlwapi) - endif() +if(WIN32) + add_definitions(-DTARGET_MODULE_FULL_NAME="$") + if(MSVC_VERSION GREATER_EQUAL 1900) + target_link_libraries(${TARGET} legacy_stdio_definitions odbccp32 shlwapi) + endif() elseif(APPLE) - add_definitions(-DBOOST_TEST_DYN_LINK) - target_link_libraries(${TARGET} iodbcinst ${CMAKE_DL_LIBS} ${CMAKE_THREAD_LIBS_INIT}) + add_definitions(-DBOOST_TEST_DYN_LINK) + target_link_libraries(${TARGET} iodbcinst ${CMAKE_DL_LIBS} ${CMAKE_THREAD_LIBS_INIT}) else() - add_definitions(-DBOOST_TEST_DYN_LINK) - target_link_libraries(${TARGET} odbcinst ${CMAKE_DL_LIBS} ${CMAKE_THREAD_LIBS_INIT}) + add_definitions(-DBOOST_TEST_DYN_LINK) + target_link_libraries(${TARGET} odbcinst ${CMAKE_DL_LIBS} ${CMAKE_THREAD_LIBS_INIT}) endif() set(TEST_TARGET IgniteOdbcUnitTest) add_test(NAME ${TEST_TARGET} COMMAND ${TARGET} --catch_system_errors=no --log_level=all) -set_tests_properties(${TEST_TARGET} PROPERTIES ENVIRONMENT IGNITE_NATIVE_TEST_ODBC_CONFIG_PATH=${PROJECT_SOURCE_DIR}/config) +set_tests_properties(${TEST_TARGET} + PROPERTIES ENVIRONMENT + IGNITE_NATIVE_TEST_ODBC_CONFIG_PATH=${PROJECT_SOURCE_DIR}/config +)