Skip to content

Commit 1a9305b

Browse files
committed
As part of SQL repo split - ODBC was missing the 2.X branch
This cherry-picking if intended to sync the ODBC new repo to the existing 2.X state of the unified SQL repo see :: Update MacOS Version for ODBC Driver #987 Origin PR: opensearch-project/sql#987 Done by: https://github.com/forestmvey Signed-off-by: YANGDB <[email protected]>
1 parent 77dd4ff commit 1a9305b

Some content is hidden

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

48 files changed

+145
-304
lines changed

CONTRIBUTING.md

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -89,7 +89,7 @@ Looking at the existing issues is a great way to find something to contribute on
8989

9090

9191
## Code of Conduct
92-
This project has adopted an [Open Source Code of Conduct](CODE_OF_CONDUCT.md).
92+
This project has adopted an [Open Source Code of Conduct](./CODE_OF_CONDUCT.md).
9393

9494

9595
## Security issue notifications
@@ -98,6 +98,6 @@ If you discover a potential security issue in this project we ask that you notif
9898

9999
## Licensing
100100

101-
See the [LICENSE](LICENSE.txt) file for our project's licensing. We will ask you to confirm the licensing of your contribution.
101+
See the [LICENSE](./LICENSE.txt) file for our project's licensing. We will ask you to confirm the licensing of your contribution.
102102

103103
We may ask you to sign a [Contributor License Agreement (CLA)](http://en.wikipedia.org/wiki/Contributor_License_Agreement) for larger changes.

aws_sdk_cpp_setup.sh

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

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

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

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

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

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

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

docs/dev/BUILD_INSTRUCTIONS.md

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -54,7 +54,7 @@ msbuild .\build\odbc\PACKAGE.vcxproj -p:Configuration=Release
5454
`OpenSearch SQL ODBC Driver-<version>-Windows-<Bitness>-bit.msi` will be generated in the build directory.
5555

5656
### Testing
57-
See [run_tests.md](run_tests.md)
57+
See [run_tests.md](./run_tests.md)
5858

5959
## Mac
6060

@@ -99,7 +99,7 @@ cpack .
9999
`OpenSearch SQL ODBC Driver-<version>-Darwin.pkg` will be generated in the build directory.
100100

101101
### Testing
102-
See [run_tests.md](run_tests.md)
102+
See [run_tests.md](./run_tests.md)
103103

104104
## General Build Info
105105

docs/dev/run_tests.md

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -10,7 +10,7 @@
1010

1111
Loading a dataset requires an [OpenSearch](https://docs-beta.opensearch.org/opensearch/install/index/) service running with [OpenSearch Dashboards](https://docs-beta.opensearch.org/dashboards/index/). If either of these are missing, please refer to the documentation on how to set them up.
1212

13-
Note, if you wish to work with SSL/TLS, you need to configure OpenSearch and OpenSearch Dashboards to support it. See the [build instructions](BUILD_INSTRUCTIONS.md) for more info.
13+
Note, if you wish to work with SSL/TLS, you need to configure OpenSearch and OpenSearch Dashboards to support it. See the [build instructions](./BUILD_INSTRUCTIONS.md) for more info.
1414

1515
First load the sample datasets provided by OpenSearch Dashboards.
1616

docs/user/windows_configure_dsn.md

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -10,7 +10,7 @@
1010

1111
<img src="img/win_system_dsn.png" width="60%">
1212

13-
3. DSN Setup window will open with default values for [configuration options](configuration_options.md).
13+
3. DSN Setup window will open with default values for [configuration options](./configuration_options.md).
1414

1515
<img src="img/win_configure_dsn.png" width="50%">
1616

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)

scripts/build_aws-sdk-cpp.ps1

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

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

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 `

scripts/build_windows.ps1

Lines changed: 4 additions & 26 deletions
Original file line numberDiff line numberDiff line change
@@ -9,50 +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 = $Env:VCPKG_ROOT
25-
vcpkg.exe install curl[tool]:${LIBCURL_WIN_ARCH}-windows
26-
27-
Set-Location $CURRENT_DIR
28-
29-
# Build AWS SDK CPP
30-
$SDK_SOURCE_DIR = "${WORKING_DIR}\src\aws-sdk-cpp"
31-
$SDK_BUILD_DIR = "${BUILD_DIR}\aws-sdk\build"
32-
$SDK_INSTALL_DIR = "${BUILD_DIR}\aws-sdk\install"
33-
34-
.\scripts\build_aws-sdk-cpp.ps1 `
35-
$CONFIGURATION $WIN_ARCH `
36-
$SDK_SOURCE_DIR $SDK_BUILD_DIR $SDK_INSTALL_DIR $VCPKG_DIR `
37-
$LIBCURL_WIN_ARCH
38-
3917
Set-Location $CURRENT_DIR
4018

4119
# Build driver
4220
$DRIVER_SOURCE_DIR = "${WORKING_DIR}\src"
4321
$DRIVER_BUILD_DIR = "${BUILD_DIR}\odbc\cmake"
22+
$VCPKG_INSTALLED_DIR = "${DRIVER_SOURCE_DIR}\vcpkg_installed\$env:VCPKG_DEFAULT_TRIPLET"
4423

4524
.\scripts\build_driver.ps1 `
4625
$CONFIGURATION $WIN_ARCH `
47-
$DRIVER_SOURCE_DIR $DRIVER_BUILD_DIR $SDK_INSTALL_DIR
26+
$DRIVER_SOURCE_DIR $DRIVER_BUILD_DIR $VCPKG_INSTALLED_DIR
4827
Set-Location $CURRENT_DIR
4928

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

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

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})

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)

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)

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

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)

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)

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)

0 commit comments

Comments
 (0)