Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

[Backport 1.x] Update MacOS Version for ODBC Driver #987 #1040

Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
11 changes: 6 additions & 5 deletions .github/workflows/sql-odbc-main.yml
Original file line number Diff line number Diff line change
Expand Up @@ -13,14 +13,15 @@ env:
CI_OUTPUT_PATH: "sql-odbc/ci-output"
ODBC_LIB_PATH: "./build/odbc/lib"
ODBC_BIN_PATH: "./build/odbc/bin"
ODBC_BUILD_PATH: "./build/odbc/build"
AWS_SDK_INSTALL_PATH: "./build/aws-sdk/install"
ODBC_BUILD_PATH: "./build/odbc/cmake"
VCPKG_X64_INSTALL_PATH: ".\\src\\vcpkg_installed\\x64-windows"
VCPKG_X86_INSTALL_PATH: ".\\src\\vcpkg_installed\\x86-windows"

# Tests are disabled (commented out) in all jobs because they are fail and/or outdated
# Keeping them for the brighten future when we can re-activate them
jobs:
build-mac:
runs-on: macos-10.15
runs-on: macos-12
defaults:
run:
working-directory: sql-odbc
Expand Down Expand Up @@ -103,7 +104,7 @@ jobs:
- name: build-installer
if: success()
run: |
.\scripts\build_installer.ps1 Release Win32 .\src $Env:ODBC_BUILD_PATH $Env:AWS_SDK_INSTALL_PATH
.\scripts\build_installer.ps1 Release Win32 .\src $Env:ODBC_BUILD_PATH $Env:VCPKG_X86_INSTALL_PATH
#- name: test
# run: |
# cp .\\libraries\\VisualLeakDetector\\bin32\\*.* .\\bin32\\Release
Expand Down Expand Up @@ -148,7 +149,7 @@ jobs:
- name: build-installer
if: success()
run: |
.\scripts\build_installer.ps1 Release x64 .\src $Env:ODBC_BUILD_PATH $Env:AWS_SDK_INSTALL_PATH
.\scripts\build_installer.ps1 Release x64 .\src $Env:ODBC_BUILD_PATH $Env:VCPKG_X64_INSTALL_PATH
#- name: test
# run: |
# cp .\\libraries\\VisualLeakDetector\\bin64\\*.* .\\bin64\\Release
Expand Down
5 changes: 0 additions & 5 deletions sql-odbc/aws_sdk_cpp_setup.sh

This file was deleted.

12 changes: 8 additions & 4 deletions sql-odbc/build_mac_debug64.sh
Original file line number Diff line number Diff line change
@@ -1,14 +1,18 @@
# Build AWS SDK
# $BITNESS=64
#!/bin/bash

cd src
git clone -b "1.7.329" "https://github.com/aws/aws-sdk-cpp.git"
vcpkg install
cd ..

vcpkg_installed_dir='x64-osx'
if [[ $MACHTYPE == 'arm64-apple-darwin'* ]]; then
vcpkg_installed_dir='arm64-osx'
fi

PREFIX_PATH=$(pwd)
mkdir cmake-build64
cd cmake-build64
cmake ../src -DCMAKE_INSTALL_PREFIX=${PREFIX_PATH}/AWSSDK/ -DCMAKE_BUILD_TYPE=Debug -DBUILD_ONLY="core" -DCUSTOM_MEMORY_MANAGEMENT="OFF" -DENABLE_RTTI="OFF" -DENABLE_TESTING="OFF"
cmake ../src -DCMAKE_INSTALL_PREFIX=${PREFIX_PATH}/src/vcpkg_installed/${vcpkg_installed_dir}/ -DCMAKE_BUILD_TYPE=Debug -DBUILD_ONLY="core" -DCUSTOM_MEMORY_MANAGEMENT="OFF" -DENABLE_RTTI="OFF" -DENABLE_TESTING="OFF"
cd ..

cmake --build cmake-build64 -- -j 4
12 changes: 8 additions & 4 deletions sql-odbc/build_mac_release64.sh
Original file line number Diff line number Diff line change
@@ -1,14 +1,18 @@
# Build AWS SDK
# $BITNESS=64
#!/bin/bash

cd src
git clone -b "1.7.329" "https://github.com/aws/aws-sdk-cpp.git"
vcpkg install
cd ..

vcpkg_installed_dir='x64-osx'
if [[ $MACHTYPE == 'arm64-apple-darwin'* ]]; then
vcpkg_installed_dir='arm64-osx'
fi

PREFIX_PATH=$(pwd)
mkdir cmake-build64
cd cmake-build64
cmake ../src -DCMAKE_INSTALL_PREFIX=${PREFIX_PATH}/AWSSDK/ -DCMAKE_BUILD_TYPE=Release -DBUILD_ONLY="core" -DCUSTOM_MEMORY_MANAGEMENT="OFF" -DENABLE_RTTI="OFF" -DENABLE_TESTING="OFF"
cmake ../src -DCMAKE_INSTALL_PREFIX=${PREFIX_PATH}/src/vcpkg_installed/${vcpkg_installed_dir}/ -DCMAKE_BUILD_TYPE=Release -DBUILD_ONLY="core" -DCUSTOM_MEMORY_MANAGEMENT="OFF" -DENABLE_RTTI="OFF" -DENABLE_TESTING="OFF"
cd ..

cmake --build cmake-build64 -- -j 4
4 changes: 4 additions & 0 deletions sql-odbc/build_win_debug32.ps1
Original file line number Diff line number Diff line change
@@ -1,2 +1,6 @@
$WORKING_DIR = (Get-Location).Path
$env:VCPKG_DEFAULT_TRIPLET = 'x86-windows'
cd src
vcpkg install
cd ..
.\scripts\build_windows.ps1 $WORKING_DIR Debug 32
4 changes: 4 additions & 0 deletions sql-odbc/build_win_debug64.ps1
Original file line number Diff line number Diff line change
@@ -1,2 +1,6 @@
$WORKING_DIR = (Get-Location).Path
$env:VCPKG_DEFAULT_TRIPLET = 'x64-windows'
cd src
vcpkg install
cd ..
.\scripts\build_windows.ps1 $WORKING_DIR Debug 64
4 changes: 4 additions & 0 deletions sql-odbc/build_win_release32.ps1
Original file line number Diff line number Diff line change
@@ -1,2 +1,6 @@
$WORKING_DIR = (Get-Location).Path
$env:VCPKG_DEFAULT_TRIPLET = 'x86-windows'
cd src
vcpkg install
cd ..
.\scripts\build_windows.ps1 $WORKING_DIR Release 32
4 changes: 4 additions & 0 deletions sql-odbc/build_win_release64.ps1
Original file line number Diff line number Diff line change
@@ -1,2 +1,6 @@
$WORKING_DIR = (Get-Location).Path
$env:VCPKG_DEFAULT_TRIPLET = 'x64-windows'
cd src
vcpkg install
cd ..
.\scripts\build_windows.ps1 $WORKING_DIR Release 64
4 changes: 0 additions & 4 deletions sql-odbc/libraries/rabbit/include/rabbit.hpp
Original file line number Diff line number Diff line change
Expand Up @@ -1150,10 +1150,6 @@ class basic_array : public basic_value<Traits, array_tag>
: base_type(alloc)
{}

basic_array(const basic_array& other)
: base_type(other)
{}

template <typename OtherTraits>
basic_array(const basic_value_ref<OtherTraits>& other)
: base_type(other)
Expand Down
45 changes: 0 additions & 45 deletions sql-odbc/scripts/build_aws-sdk-cpp.ps1

This file was deleted.

8 changes: 6 additions & 2 deletions sql-odbc/scripts/build_driver.ps1
Original file line number Diff line number Diff line change
Expand Up @@ -2,13 +2,17 @@ $CONFIGURATION = $args[0]
$WIN_ARCH = $args[1]
$SRC_DIR = $args[2]
$BUILD_DIR = $args[3]
$INSTALL_DIR = $args[4]
$VCPKG_INSTALLED_DIR = $args[4]

# aws-sdk-cpp fails compilation with warning:
# "Various members of std::allocator are deprecated in C++17"
$env:CL='-D_SILENCE_CXX17_OLD_ALLOCATOR_MEMBERS_DEPRECATION_WARNING'

cmake -S $SRC_DIR `
-B $BUILD_DIR `
-A $WIN_ARCH `
-D CMAKE_BUILD_TYPE=$CONFIGURATION `
-D CMAKE_INSTALL_PREFIX=$INSTALL_DIR `
-D CMAKE_INSTALL_PREFIX=$VCPKG_INSTALLED_DIR `
-D BUILD_WITH_TESTS=ON

# # Build Project
Expand Down
4 changes: 4 additions & 0 deletions sql-odbc/scripts/build_installer.ps1
Original file line number Diff line number Diff line change
Expand Up @@ -6,6 +6,10 @@ $INSTALL_DIR = $args[4]

Write-Host $args

# aws-sdk-cpp fails compilation with warning:
# "Various members of std::allocator are deprecated in C++17"
$env:CL='-D_SILENCE_CXX17_OLD_ALLOCATOR_MEMBERS_DEPRECATION_WARNING'

cmake -S $SRC_DIR `
-B $BUILD_DIR `
-A $WIN_ARCH `
Expand Down
31 changes: 4 additions & 27 deletions sql-odbc/scripts/build_windows.ps1
Original file line number Diff line number Diff line change
Expand Up @@ -9,51 +9,28 @@ if ($BITNESS -eq "64") {
else {
$WIN_ARCH = "Win32"
}
if ($BITNESS -eq "64") {
$LIBCURL_WIN_ARCH = "x64"
}
else {
$LIBCURL_WIN_ARCH = "x86"
}

# Create build directory; remove if exists
$BUILD_DIR = "${WORKING_DIR}\build"
# $BUILD_DIR = "${WORKING_DIR}\build\${CONFIGURATION}${BITNESS}"
New-Item -Path $BUILD_DIR -ItemType Directory -Force | Out-Null

$VCPKG_DIR = "${WORKING_DIR}/src/vcpkg"

.\scripts\build_libcurl-vcpkg.ps1 $VCPKG_DIR $LIBCURL_WIN_ARCH

Set-Location $CURRENT_DIR

# Build AWS SDK CPP
$SDK_SOURCE_DIR = "${WORKING_DIR}\src\aws-sdk-cpp"
$SDK_BUILD_DIR = "${BUILD_DIR}\aws-sdk\build"
$SDK_INSTALL_DIR = "${BUILD_DIR}\aws-sdk\install"

.\scripts\build_aws-sdk-cpp.ps1 `
$CONFIGURATION $WIN_ARCH `
$SDK_SOURCE_DIR $SDK_BUILD_DIR $SDK_INSTALL_DIR $VCPKG_DIR `
$LIBCURL_WIN_ARCH

Set-Location $CURRENT_DIR

# Build driver
$DRIVER_SOURCE_DIR = "${WORKING_DIR}\src"
$DRIVER_BUILD_DIR = "${BUILD_DIR}\odbc\cmake"
$VCPKG_INSTALLED_DIR = "${DRIVER_SOURCE_DIR}\vcpkg_installed\$env:VCPKG_DEFAULT_TRIPLET"

.\scripts\build_driver.ps1 `
$CONFIGURATION $WIN_ARCH `
$DRIVER_SOURCE_DIR $DRIVER_BUILD_DIR $SDK_INSTALL_DIR
$DRIVER_SOURCE_DIR $DRIVER_BUILD_DIR $VCPKG_INSTALLED_DIR
Set-Location $CURRENT_DIR

# Move driver dependencies to bin directory for testing
$DRIVER_BIN_DIR = "$DRIVER_BUILD_DIR\..\bin\$CONFIGURATION"
$DRIVER_BIN_DIR = "${BUILD_DIR}\odbc\bin\$CONFIGURATION"
New-Item -Path $DRIVER_BIN_DIR -ItemType Directory -Force | Out-Null

Copy-Item $SDK_BUILD_DIR\bin\$CONFIGURATION\* $DRIVER_BIN_DIR
Copy-Item $DRIVER_BUILD_DIR\bin\$CONFIGURATION\* $DRIVER_BIN_DIR
Copy-Item $VCPKG_INSTALLED_DIR\bin\* $DRIVER_BIN_DIR
if ($BITNESS -eq "32") {
# Strip bitness from 32bit VLD DLL dir name
$BITNESS = $null
Expand Down
26 changes: 7 additions & 19 deletions sql-odbc/src/CMakeLists.txt
Original file line number Diff line number Diff line change
Expand Up @@ -74,21 +74,17 @@ set(PERFORMANCE_TESTS "${CMAKE_CURRENT_SOURCE_DIR}/PerformanceTests")
set(UT_HELPER "${UNIT_TESTS}/UTHelper")
set(IT_HELPER "${INTEGRATION_TESTS}/ITODBCHelper")
set(RABBIT_SRC ${LIBRARY_DIRECTORY}/rabbit/include)
set(RAPIDJSON_SRC ${LIBRARY_DIRECTORY}/rapidjson/include)
set(VLD_SRC ${LIBRARY_DIRECTORY}/VisualLeakDetector/include)

if(WIN32)
set(RAPIDJSON_SRC ${LIBRARY_DIRECTORY}/rapidjson/include)
endif ()
# Without this symbols will be exporting to Unix but not Windows
set(CMAKE_WINDOWS_EXPORT_ALL_SYMBOLS TRUE)

# Set path for AWS SDK
set(aws-cpp-sdk-base "${CMAKE_CURRENT_SOURCE_DIR}/aws-sdk-cpp")
set(aws-cpp-sdk-core_DIR "${PROJECT_ROOT}/sdk-build${BITNESS}/AWSSDK/lib/cmake/aws-cpp-sdk-core")
set(aws-c-event-stream_DIR "${PROJECT_ROOT}/sdk-build${BITNESS}/AWSSDK/lib/aws-c-event-stream/cmake")
set(aws-c-common_DIR "${PROJECT_ROOT}/sdk-build${BITNESS}/AWSSDK/lib/aws-c-common/cmake")
set(aws-checksums_DIR "${PROJECT_ROOT}/sdk-build${BITNESS}/AWSSDK/lib/aws-checksums/cmake")

if (WIN32)
find_package(AWSSDK REQUIRED core)
find_package(aws-cpp-sdk-core CONFIG REQUIRED)
if(APPLE)
find_package(ZLIB REQUIRED)
find_package(RapidJSON CONFIG REQUIRED)
endif()

# General compiler definitions
Expand Down Expand Up @@ -134,18 +130,10 @@ endif()

if(BUILD_WITH_TESTS)
# GTest import
include(gtest/googletest.cmake)
fetch_googletest(
${PROJECT_SOURCE_DIR}/gtest
${PROJECT_BINARY_DIR}/googletest
)
enable_testing()
endif()

# Projects to build
if (APPLE)
add_subdirectory(${aws-cpp-sdk-base})
endif()
add_subdirectory(${OPENSEARCHODBC_SRC})
add_subdirectory(${OPENSEARCHENLIST_SRC})
add_subdirectory(${INSTALL_SRC})
Expand Down
5 changes: 4 additions & 1 deletion sql-odbc/src/IntegrationTests/ITODBCAwsAuth/CMakeLists.txt
Original file line number Diff line number Diff line change
Expand Up @@ -12,6 +12,9 @@ include_directories( ${UT_HELPER}
# Generate executable
add_executable(itodbc_aws_auth ${SOURCE_FILES})

# Find packages from vcpkg
find_package(GTest CONFIG REQUIRED)

# Library dependencies
target_link_libraries(itodbc_aws_auth sqlodbc itodbc_helper ut_helper gtest_main aws-cpp-sdk-core)
target_link_libraries(itodbc_aws_auth sqlodbc itodbc_helper ut_helper GTest::gtest_main aws-cpp-sdk-core)
target_compile_definitions(itodbc_aws_auth PUBLIC _UNICODE UNICODE)
5 changes: 4 additions & 1 deletion sql-odbc/src/IntegrationTests/ITODBCCatalog/CMakeLists.txt
Original file line number Diff line number Diff line change
Expand Up @@ -10,7 +10,10 @@ include_directories( ${UT_HELPER}
# Generate executable
add_executable(itodbc_catalog ${SOURCE_FILES})

# Find packages from vcpkg
find_package(GTest CONFIG REQUIRED)

# Library dependencies
target_code_coverage(itodbc_catalog PUBLIC AUTO ALL)
target_link_libraries(itodbc_catalog sqlodbc itodbc_helper ut_helper gtest_main)
target_link_libraries(itodbc_catalog sqlodbc itodbc_helper ut_helper GTest::gtest_main)
target_compile_definitions(itodbc_catalog PUBLIC _UNICODE UNICODE)
Original file line number Diff line number Diff line change
Expand Up @@ -3,6 +3,7 @@
#include "pch.h"
#include "unit_test_helper.h"
#include "it_odbc_helper.h"
#include <algorithm>
// clang-format on

// General test constants and structures
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -10,7 +10,10 @@ include_directories( ${UT_HELPER}
# Generate executable
add_executable(itodbc_connection ${SOURCE_FILES})

# Find packages from vcpkg
find_package(GTest CONFIG REQUIRED)

# Library dependencies
target_code_coverage(itodbc_connection PUBLIC AUTO ALL)
target_link_libraries(itodbc_connection sqlodbc itodbc_helper ut_helper gtest_main)
target_link_libraries(itodbc_connection sqlodbc itodbc_helper ut_helper GTest::gtest_main)
target_compile_definitions(itodbc_connection PUBLIC _UNICODE UNICODE)
Original file line number Diff line number Diff line change
Expand Up @@ -10,7 +10,10 @@ include_directories( ${UT_HELPER}
# Generate executable
add_executable(itodbc_descriptors ${SOURCE_FILES})

# Find packages from vcpkg
find_package(GTest CONFIG REQUIRED)

# Library dependencies
target_code_coverage(itodbc_descriptors PUBLIC AUTO ALL)
target_link_libraries(itodbc_descriptors sqlodbc itodbc_helper ut_helper gtest_main)
target_link_libraries(itodbc_descriptors sqlodbc itodbc_helper ut_helper GTest::gtest_main)
target_compile_definitions(itodbc_descriptors PUBLIC _UNICODE UNICODE)
5 changes: 4 additions & 1 deletion sql-odbc/src/IntegrationTests/ITODBCExecution/CMakeLists.txt
Original file line number Diff line number Diff line change
Expand Up @@ -10,6 +10,9 @@ include_directories( ${UT_HELPER}
# Generate executable
add_executable(itodbc_execution ${SOURCE_FILES})

# Find packages from vcpkg
find_package(GTest CONFIG REQUIRED)

# Library dependencies
target_link_libraries(itodbc_execution sqlodbc itodbc_helper ut_helper gtest_main)
target_link_libraries(itodbc_execution sqlodbc itodbc_helper ut_helper GTest::gtest_main)
target_compile_definitions(itodbc_execution PUBLIC _UNICODE UNICODE)
5 changes: 4 additions & 1 deletion sql-odbc/src/IntegrationTests/ITODBCHelper/CMakeLists.txt
Original file line number Diff line number Diff line change
Expand Up @@ -12,6 +12,9 @@ include_directories(
# Generate dll (SHARED)
add_library(itodbc_helper SHARED ${SOURCE_FILES} ${HEADER_FILES})

# Find packages from vcpkg
find_package(GTest CONFIG REQUIRED)

# Library dependencies
target_link_libraries(itodbc_helper sqlodbc ut_helper gtest_main)
target_link_libraries(itodbc_helper sqlodbc ut_helper GTest::gtest_main)
target_compile_definitions(itodbc_helper PUBLIC _UNICODE UNICODE)
5 changes: 4 additions & 1 deletion sql-odbc/src/IntegrationTests/ITODBCInfo/CMakeLists.txt
Original file line number Diff line number Diff line change
Expand Up @@ -10,7 +10,10 @@ include_directories( ${UT_HELPER}
# Generate executable
add_executable(itodbc_info ${SOURCE_FILES})

# Find packages from vcpkg
find_package(GTest CONFIG REQUIRED)

# Library dependencies
target_code_coverage(itodbc_info PUBLIC AUTO ALL)
target_link_libraries(itodbc_info sqlodbc itodbc_helper ut_helper gtest_main)
target_link_libraries(itodbc_info sqlodbc itodbc_helper ut_helper GTest::gtest_main)
target_compile_definitions(itodbc_info PUBLIC _UNICODE UNICODE)
Loading