Skip to content

Commit 8570a1f

Browse files
Merge pull request opensearch-project#1040 from Bit-Quill/backport/backport-987-to-1.x
[Backport 1.x] Update MacOS Version for ODBC Driver opensearch-project#987
2 parents ae33291 + 8f088e9 commit 8570a1f

Some content is hidden

Large Commits have some content hidden by default. Use the searchbox below for content that may be hidden.

44 files changed

+144
-303
lines changed

.github/workflows/sql-odbc-main.yml

Lines changed: 6 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -13,14 +13,15 @@ env:
1313
CI_OUTPUT_PATH: "sql-odbc/ci-output"
1414
ODBC_LIB_PATH: "./build/odbc/lib"
1515
ODBC_BIN_PATH: "./build/odbc/bin"
16-
ODBC_BUILD_PATH: "./build/odbc/build"
17-
AWS_SDK_INSTALL_PATH: "./build/aws-sdk/install"
16+
ODBC_BUILD_PATH: "./build/odbc/cmake"
17+
VCPKG_X64_INSTALL_PATH: ".\\src\\vcpkg_installed\\x64-windows"
18+
VCPKG_X86_INSTALL_PATH: ".\\src\\vcpkg_installed\\x86-windows"
1819

1920
# Tests are disabled (commented out) in all jobs because they are fail and/or outdated
2021
# Keeping them for the brighten future when we can re-activate them
2122
jobs:
2223
build-mac:
23-
runs-on: macos-10.15
24+
runs-on: macos-12
2425
defaults:
2526
run:
2627
working-directory: sql-odbc
@@ -103,7 +104,7 @@ jobs:
103104
- name: build-installer
104105
if: success()
105106
run: |
106-
.\scripts\build_installer.ps1 Release Win32 .\src $Env:ODBC_BUILD_PATH $Env:AWS_SDK_INSTALL_PATH
107+
.\scripts\build_installer.ps1 Release Win32 .\src $Env:ODBC_BUILD_PATH $Env:VCPKG_X86_INSTALL_PATH
107108
#- name: test
108109
# run: |
109110
# cp .\\libraries\\VisualLeakDetector\\bin32\\*.* .\\bin32\\Release
@@ -148,7 +149,7 @@ jobs:
148149
- name: build-installer
149150
if: success()
150151
run: |
151-
.\scripts\build_installer.ps1 Release x64 .\src $Env:ODBC_BUILD_PATH $Env:AWS_SDK_INSTALL_PATH
152+
.\scripts\build_installer.ps1 Release x64 .\src $Env:ODBC_BUILD_PATH $Env:VCPKG_X64_INSTALL_PATH
152153
#- name: test
153154
# run: |
154155
# cp .\\libraries\\VisualLeakDetector\\bin64\\*.* .\\bin64\\Release

sql-odbc/aws_sdk_cpp_setup.sh

Lines changed: 0 additions & 5 deletions
This file was deleted.

sql-odbc/build_mac_debug64.sh

Lines changed: 8 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -1,14 +1,18 @@
1-
# Build AWS SDK
2-
# $BITNESS=64
1+
#!/bin/bash
32

43
cd src
5-
git clone -b "1.7.329" "https://github.com/aws/aws-sdk-cpp.git"
4+
vcpkg install
65
cd ..
76

7+
vcpkg_installed_dir='x64-osx'
8+
if [[ $MACHTYPE == 'arm64-apple-darwin'* ]]; then
9+
vcpkg_installed_dir='arm64-osx'
10+
fi
11+
812
PREFIX_PATH=$(pwd)
913
mkdir cmake-build64
1014
cd cmake-build64
11-
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"
15+
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"
1216
cd ..
1317

1418
cmake --build cmake-build64 -- -j 4

sql-odbc/build_mac_release64.sh

Lines changed: 8 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -1,14 +1,18 @@
1-
# Build AWS SDK
2-
# $BITNESS=64
1+
#!/bin/bash
32

43
cd src
5-
git clone -b "1.7.329" "https://github.com/aws/aws-sdk-cpp.git"
4+
vcpkg install
65
cd ..
76

7+
vcpkg_installed_dir='x64-osx'
8+
if [[ $MACHTYPE == 'arm64-apple-darwin'* ]]; then
9+
vcpkg_installed_dir='arm64-osx'
10+
fi
11+
812
PREFIX_PATH=$(pwd)
913
mkdir cmake-build64
1014
cd cmake-build64
11-
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"
15+
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"
1216
cd ..
1317

1418
cmake --build cmake-build64 -- -j 4

sql-odbc/build_win_debug32.ps1

Lines changed: 4 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1,2 +1,6 @@
11
$WORKING_DIR = (Get-Location).Path
2+
$env:VCPKG_DEFAULT_TRIPLET = 'x86-windows'
3+
cd src
4+
vcpkg install
5+
cd ..
26
.\scripts\build_windows.ps1 $WORKING_DIR Debug 32

sql-odbc/build_win_debug64.ps1

Lines changed: 4 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1,2 +1,6 @@
11
$WORKING_DIR = (Get-Location).Path
2+
$env:VCPKG_DEFAULT_TRIPLET = 'x64-windows'
3+
cd src
4+
vcpkg install
5+
cd ..
26
.\scripts\build_windows.ps1 $WORKING_DIR Debug 64

sql-odbc/build_win_release32.ps1

Lines changed: 4 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1,2 +1,6 @@
11
$WORKING_DIR = (Get-Location).Path
2+
$env:VCPKG_DEFAULT_TRIPLET = 'x86-windows'
3+
cd src
4+
vcpkg install
5+
cd ..
26
.\scripts\build_windows.ps1 $WORKING_DIR Release 32

sql-odbc/build_win_release64.ps1

Lines changed: 4 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1,2 +1,6 @@
11
$WORKING_DIR = (Get-Location).Path
2+
$env:VCPKG_DEFAULT_TRIPLET = 'x64-windows'
3+
cd src
4+
vcpkg install
5+
cd ..
26
.\scripts\build_windows.ps1 $WORKING_DIR Release 64

sql-odbc/libraries/rabbit/include/rabbit.hpp

Lines changed: 0 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -1150,10 +1150,6 @@ class basic_array : public basic_value<Traits, array_tag>
11501150
: base_type(alloc)
11511151
{}
11521152

1153-
basic_array(const basic_array& other)
1154-
: base_type(other)
1155-
{}
1156-
11571153
template <typename OtherTraits>
11581154
basic_array(const basic_value_ref<OtherTraits>& other)
11591155
: base_type(other)

sql-odbc/scripts/build_aws-sdk-cpp.ps1

Lines changed: 0 additions & 45 deletions
This file was deleted.

sql-odbc/scripts/build_driver.ps1

Lines changed: 6 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -2,13 +2,17 @@ $CONFIGURATION = $args[0]
22
$WIN_ARCH = $args[1]
33
$SRC_DIR = $args[2]
44
$BUILD_DIR = $args[3]
5-
$INSTALL_DIR = $args[4]
5+
$VCPKG_INSTALLED_DIR = $args[4]
6+
7+
# aws-sdk-cpp fails compilation with warning:
8+
# "Various members of std::allocator are deprecated in C++17"
9+
$env:CL='-D_SILENCE_CXX17_OLD_ALLOCATOR_MEMBERS_DEPRECATION_WARNING'
610

711
cmake -S $SRC_DIR `
812
-B $BUILD_DIR `
913
-A $WIN_ARCH `
1014
-D CMAKE_BUILD_TYPE=$CONFIGURATION `
11-
-D CMAKE_INSTALL_PREFIX=$INSTALL_DIR `
15+
-D CMAKE_INSTALL_PREFIX=$VCPKG_INSTALLED_DIR `
1216
-D BUILD_WITH_TESTS=ON
1317

1418
# # Build Project

sql-odbc/scripts/build_installer.ps1

Lines changed: 4 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -6,6 +6,10 @@ $INSTALL_DIR = $args[4]
66

77
Write-Host $args
88

9+
# aws-sdk-cpp fails compilation with warning:
10+
# "Various members of std::allocator are deprecated in C++17"
11+
$env:CL='-D_SILENCE_CXX17_OLD_ALLOCATOR_MEMBERS_DEPRECATION_WARNING'
12+
913
cmake -S $SRC_DIR `
1014
-B $BUILD_DIR `
1115
-A $WIN_ARCH `

sql-odbc/scripts/build_windows.ps1

Lines changed: 4 additions & 27 deletions
Original file line numberDiff line numberDiff line change
@@ -9,51 +9,28 @@ if ($BITNESS -eq "64") {
99
else {
1010
$WIN_ARCH = "Win32"
1111
}
12-
if ($BITNESS -eq "64") {
13-
$LIBCURL_WIN_ARCH = "x64"
14-
}
15-
else {
16-
$LIBCURL_WIN_ARCH = "x86"
17-
}
1812

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

24-
$VCPKG_DIR = "${WORKING_DIR}/src/vcpkg"
25-
26-
.\scripts\build_libcurl-vcpkg.ps1 $VCPKG_DIR $LIBCURL_WIN_ARCH
27-
28-
Set-Location $CURRENT_DIR
29-
30-
# Build AWS SDK CPP
31-
$SDK_SOURCE_DIR = "${WORKING_DIR}\src\aws-sdk-cpp"
32-
$SDK_BUILD_DIR = "${BUILD_DIR}\aws-sdk\build"
33-
$SDK_INSTALL_DIR = "${BUILD_DIR}\aws-sdk\install"
34-
35-
.\scripts\build_aws-sdk-cpp.ps1 `
36-
$CONFIGURATION $WIN_ARCH `
37-
$SDK_SOURCE_DIR $SDK_BUILD_DIR $SDK_INSTALL_DIR $VCPKG_DIR `
38-
$LIBCURL_WIN_ARCH
39-
4017
Set-Location $CURRENT_DIR
4118

4219
# Build driver
4320
$DRIVER_SOURCE_DIR = "${WORKING_DIR}\src"
4421
$DRIVER_BUILD_DIR = "${BUILD_DIR}\odbc\cmake"
22+
$VCPKG_INSTALLED_DIR = "${DRIVER_SOURCE_DIR}\vcpkg_installed\$env:VCPKG_DEFAULT_TRIPLET"
4523

4624
.\scripts\build_driver.ps1 `
4725
$CONFIGURATION $WIN_ARCH `
48-
$DRIVER_SOURCE_DIR $DRIVER_BUILD_DIR $SDK_INSTALL_DIR
26+
$DRIVER_SOURCE_DIR $DRIVER_BUILD_DIR $VCPKG_INSTALLED_DIR
4927
Set-Location $CURRENT_DIR
5028

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

55-
Copy-Item $SDK_BUILD_DIR\bin\$CONFIGURATION\* $DRIVER_BIN_DIR
56-
Copy-Item $DRIVER_BUILD_DIR\bin\$CONFIGURATION\* $DRIVER_BIN_DIR
33+
Copy-Item $VCPKG_INSTALLED_DIR\bin\* $DRIVER_BIN_DIR
5734
if ($BITNESS -eq "32") {
5835
# Strip bitness from 32bit VLD DLL dir name
5936
$BITNESS = $null

sql-odbc/src/CMakeLists.txt

Lines changed: 7 additions & 19 deletions
Original file line numberDiff line numberDiff line change
@@ -74,21 +74,17 @@ set(PERFORMANCE_TESTS "${CMAKE_CURRENT_SOURCE_DIR}/PerformanceTests")
7474
set(UT_HELPER "${UNIT_TESTS}/UTHelper")
7575
set(IT_HELPER "${INTEGRATION_TESTS}/ITODBCHelper")
7676
set(RABBIT_SRC ${LIBRARY_DIRECTORY}/rabbit/include)
77-
set(RAPIDJSON_SRC ${LIBRARY_DIRECTORY}/rapidjson/include)
7877
set(VLD_SRC ${LIBRARY_DIRECTORY}/VisualLeakDetector/include)
79-
78+
if(WIN32)
79+
set(RAPIDJSON_SRC ${LIBRARY_DIRECTORY}/rapidjson/include)
80+
endif ()
8081
# Without this symbols will be exporting to Unix but not Windows
8182
set(CMAKE_WINDOWS_EXPORT_ALL_SYMBOLS TRUE)
8283

83-
# Set path for AWS SDK
84-
set(aws-cpp-sdk-base "${CMAKE_CURRENT_SOURCE_DIR}/aws-sdk-cpp")
85-
set(aws-cpp-sdk-core_DIR "${PROJECT_ROOT}/sdk-build${BITNESS}/AWSSDK/lib/cmake/aws-cpp-sdk-core")
86-
set(aws-c-event-stream_DIR "${PROJECT_ROOT}/sdk-build${BITNESS}/AWSSDK/lib/aws-c-event-stream/cmake")
87-
set(aws-c-common_DIR "${PROJECT_ROOT}/sdk-build${BITNESS}/AWSSDK/lib/aws-c-common/cmake")
88-
set(aws-checksums_DIR "${PROJECT_ROOT}/sdk-build${BITNESS}/AWSSDK/lib/aws-checksums/cmake")
89-
90-
if (WIN32)
91-
find_package(AWSSDK REQUIRED core)
84+
find_package(aws-cpp-sdk-core CONFIG REQUIRED)
85+
if(APPLE)
86+
find_package(ZLIB REQUIRED)
87+
find_package(RapidJSON CONFIG REQUIRED)
9288
endif()
9389

9490
# General compiler definitions
@@ -134,18 +130,10 @@ endif()
134130

135131
if(BUILD_WITH_TESTS)
136132
# GTest import
137-
include(gtest/googletest.cmake)
138-
fetch_googletest(
139-
${PROJECT_SOURCE_DIR}/gtest
140-
${PROJECT_BINARY_DIR}/googletest
141-
)
142133
enable_testing()
143134
endif()
144135

145136
# Projects to build
146-
if (APPLE)
147-
add_subdirectory(${aws-cpp-sdk-base})
148-
endif()
149137
add_subdirectory(${OPENSEARCHODBC_SRC})
150138
add_subdirectory(${OPENSEARCHENLIST_SRC})
151139
add_subdirectory(${INSTALL_SRC})

sql-odbc/src/IntegrationTests/ITODBCAwsAuth/CMakeLists.txt

Lines changed: 4 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -12,6 +12,9 @@ include_directories( ${UT_HELPER}
1212
# Generate executable
1313
add_executable(itodbc_aws_auth ${SOURCE_FILES})
1414

15+
# Find packages from vcpkg
16+
find_package(GTest CONFIG REQUIRED)
17+
1518
# Library dependencies
16-
target_link_libraries(itodbc_aws_auth sqlodbc itodbc_helper ut_helper gtest_main aws-cpp-sdk-core)
19+
target_link_libraries(itodbc_aws_auth sqlodbc itodbc_helper ut_helper GTest::gtest_main aws-cpp-sdk-core)
1720
target_compile_definitions(itodbc_aws_auth PUBLIC _UNICODE UNICODE)

sql-odbc/src/IntegrationTests/ITODBCCatalog/CMakeLists.txt

Lines changed: 4 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -10,7 +10,10 @@ include_directories( ${UT_HELPER}
1010
# Generate executable
1111
add_executable(itodbc_catalog ${SOURCE_FILES})
1212

13+
# Find packages from vcpkg
14+
find_package(GTest CONFIG REQUIRED)
15+
1316
# Library dependencies
1417
target_code_coverage(itodbc_catalog PUBLIC AUTO ALL)
15-
target_link_libraries(itodbc_catalog sqlodbc itodbc_helper ut_helper gtest_main)
18+
target_link_libraries(itodbc_catalog sqlodbc itodbc_helper ut_helper GTest::gtest_main)
1619
target_compile_definitions(itodbc_catalog PUBLIC _UNICODE UNICODE)

sql-odbc/src/IntegrationTests/ITODBCCatalog/test_odbc_catalog.cpp

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -3,6 +3,7 @@
33
#include "pch.h"
44
#include "unit_test_helper.h"
55
#include "it_odbc_helper.h"
6+
#include <algorithm>
67
// clang-format on
78

89
// General test constants and structures

sql-odbc/src/IntegrationTests/ITODBCConnection/CMakeLists.txt

Lines changed: 4 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -10,7 +10,10 @@ include_directories( ${UT_HELPER}
1010
# Generate executable
1111
add_executable(itodbc_connection ${SOURCE_FILES})
1212

13+
# Find packages from vcpkg
14+
find_package(GTest CONFIG REQUIRED)
15+
1316
# Library dependencies
1417
target_code_coverage(itodbc_connection PUBLIC AUTO ALL)
15-
target_link_libraries(itodbc_connection sqlodbc itodbc_helper ut_helper gtest_main)
18+
target_link_libraries(itodbc_connection sqlodbc itodbc_helper ut_helper GTest::gtest_main)
1619
target_compile_definitions(itodbc_connection PUBLIC _UNICODE UNICODE)

sql-odbc/src/IntegrationTests/ITODBCDescriptors/CMakeLists.txt

Lines changed: 4 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -10,7 +10,10 @@ include_directories( ${UT_HELPER}
1010
# Generate executable
1111
add_executable(itodbc_descriptors ${SOURCE_FILES})
1212

13+
# Find packages from vcpkg
14+
find_package(GTest CONFIG REQUIRED)
15+
1316
# Library dependencies
1417
target_code_coverage(itodbc_descriptors PUBLIC AUTO ALL)
15-
target_link_libraries(itodbc_descriptors sqlodbc itodbc_helper ut_helper gtest_main)
18+
target_link_libraries(itodbc_descriptors sqlodbc itodbc_helper ut_helper GTest::gtest_main)
1619
target_compile_definitions(itodbc_descriptors PUBLIC _UNICODE UNICODE)

sql-odbc/src/IntegrationTests/ITODBCExecution/CMakeLists.txt

Lines changed: 4 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -10,6 +10,9 @@ include_directories( ${UT_HELPER}
1010
# Generate executable
1111
add_executable(itodbc_execution ${SOURCE_FILES})
1212

13+
# Find packages from vcpkg
14+
find_package(GTest CONFIG REQUIRED)
15+
1316
# Library dependencies
14-
target_link_libraries(itodbc_execution sqlodbc itodbc_helper ut_helper gtest_main)
17+
target_link_libraries(itodbc_execution sqlodbc itodbc_helper ut_helper GTest::gtest_main)
1518
target_compile_definitions(itodbc_execution PUBLIC _UNICODE UNICODE)

sql-odbc/src/IntegrationTests/ITODBCHelper/CMakeLists.txt

Lines changed: 4 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -12,6 +12,9 @@ include_directories(
1212
# Generate dll (SHARED)
1313
add_library(itodbc_helper SHARED ${SOURCE_FILES} ${HEADER_FILES})
1414

15+
# Find packages from vcpkg
16+
find_package(GTest CONFIG REQUIRED)
17+
1518
# Library dependencies
16-
target_link_libraries(itodbc_helper sqlodbc ut_helper gtest_main)
19+
target_link_libraries(itodbc_helper sqlodbc ut_helper GTest::gtest_main)
1720
target_compile_definitions(itodbc_helper PUBLIC _UNICODE UNICODE)

sql-odbc/src/IntegrationTests/ITODBCInfo/CMakeLists.txt

Lines changed: 4 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -10,7 +10,10 @@ include_directories( ${UT_HELPER}
1010
# Generate executable
1111
add_executable(itodbc_info ${SOURCE_FILES})
1212

13+
# Find packages from vcpkg
14+
find_package(GTest CONFIG REQUIRED)
15+
1316
# Library dependencies
1417
target_code_coverage(itodbc_info PUBLIC AUTO ALL)
15-
target_link_libraries(itodbc_info sqlodbc itodbc_helper ut_helper gtest_main)
18+
target_link_libraries(itodbc_info sqlodbc itodbc_helper ut_helper GTest::gtest_main)
1619
target_compile_definitions(itodbc_info PUBLIC _UNICODE UNICODE)

0 commit comments

Comments
 (0)