Skip to content

Commit

Permalink
As part of SQL repo split - ODBC was missing the 2.X branch
Browse files Browse the repository at this point in the history
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 <yang.db.dev@gmail.com>
  • Loading branch information
YANG-DB committed Dec 14, 2022
1 parent 77dd4ff commit 1a9305b
Show file tree
Hide file tree
Showing 48 changed files with 145 additions and 304 deletions.
4 changes: 2 additions & 2 deletions CONTRIBUTING.md
Original file line number Diff line number Diff line change
Expand Up @@ -89,7 +89,7 @@ Looking at the existing issues is a great way to find something to contribute on


## Code of Conduct
This project has adopted an [Open Source Code of Conduct](CODE_OF_CONDUCT.md).
This project has adopted an [Open Source Code of Conduct](./CODE_OF_CONDUCT.md).


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

## Licensing

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

We may ask you to sign a [Contributor License Agreement (CLA)](http://en.wikipedia.org/wiki/Contributor_License_Agreement) for larger changes.
5 changes: 0 additions & 5 deletions aws_sdk_cpp_setup.sh

This file was deleted.

12 changes: 8 additions & 4 deletions 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 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 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 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 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 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: 2 additions & 2 deletions docs/dev/BUILD_INSTRUCTIONS.md
Original file line number Diff line number Diff line change
Expand Up @@ -54,7 +54,7 @@ msbuild .\build\odbc\PACKAGE.vcxproj -p:Configuration=Release
`OpenSearch SQL ODBC Driver-<version>-Windows-<Bitness>-bit.msi` will be generated in the build directory.

### Testing
See [run_tests.md](run_tests.md)
See [run_tests.md](./run_tests.md)

## Mac

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

### Testing
See [run_tests.md](run_tests.md)
See [run_tests.md](./run_tests.md)

## General Build Info

Expand Down
2 changes: 1 addition & 1 deletion docs/dev/run_tests.md
Original file line number Diff line number Diff line change
Expand Up @@ -10,7 +10,7 @@

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.

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.
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.

First load the sample datasets provided by OpenSearch Dashboards.

Expand Down
2 changes: 1 addition & 1 deletion docs/user/windows_configure_dsn.md
Original file line number Diff line number Diff line change
Expand Up @@ -10,7 +10,7 @@

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

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

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

Expand Down
4 changes: 0 additions & 4 deletions 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 scripts/build_aws-sdk-cpp.ps1

This file was deleted.

8 changes: 6 additions & 2 deletions 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 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
30 changes: 4 additions & 26 deletions scripts/build_windows.ps1
Original file line number Diff line number Diff line change
Expand Up @@ -9,50 +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 = $Env:VCPKG_ROOT
vcpkg.exe install curl[tool]:${LIBCURL_WIN_ARCH}-windows

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 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 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 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)
1 change: 1 addition & 0 deletions src/IntegrationTests/ITODBCCatalog/test_odbc_catalog.cpp
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
5 changes: 4 additions & 1 deletion src/IntegrationTests/ITODBCConnection/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_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)
5 changes: 4 additions & 1 deletion src/IntegrationTests/ITODBCDescriptors/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_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 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)
Loading

0 comments on commit 1a9305b

Please sign in to comment.