Skip to content
Draft
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
32 changes: 32 additions & 0 deletions ports/odbccpp/portfile.cmake
Original file line number Diff line number Diff line change
@@ -0,0 +1,32 @@
vcpkg_from_github(
OUT_SOURCE_PATH SOURCE_PATH
REPO SAP/odbc-cpp-wrapper
REF "v${VERSION}"
SHA512 c36d83b0ec5a560c2e845001594f549d1cc39d721e25345cbc6525458ec1591e01e5ae49cacd01807eed86db38ed717d55d63c94d7e7179010752044855bf838
HEAD_REF master
PATCHES
use-vcpkg-unixodbc.patch
)

vcpkg_list(SET options)
if(VCPKG_TARGET_IS_LINUX OR VCPKG_TARGET_IS_OSX)
list(APPEND options -DODBCCPP_USE_UNIXODBC=ON)
endif()

vcpkg_cmake_configure(
SOURCE_PATH "${SOURCE_PATH}"
OPTIONS
-DCMAKE_DISABLE_FIND_PACKAGE_GTest=ON
-DCMAKE_DISABLE_FIND_PACKAGE_Doxygen=ON
${options}
)

vcpkg_cmake_install()

vcpkg_copy_pdbs()

file(REMOVE_RECURSE "${CURRENT_PACKAGES_DIR}/debug/include")

vcpkg_cmake_config_fixup(CONFIG_PATH lib/cmake/${PORT})

vcpkg_install_copyright(FILE_LIST "${SOURCE_PATH}/LICENSE")
20 changes: 20 additions & 0 deletions ports/odbccpp/use-vcpkg-unixodbc.patch
Original file line number Diff line number Diff line change
@@ -0,0 +1,20 @@
--- a/CMakeLists.txt
+++ b/CMakeLists.txt
@@ -4,7 +4,15 @@ SET(CMAKE_CXX_STANDARD 11)

INCLUDE(GNUInstallDirs)
INCLUDE(CMakePackageConfigHelpers)

-FIND_PACKAGE(ODBC REQUIRED)
+IF(ODBCCPP_USE_UNIXODBC)
+ FIND_PACKAGE(unofficial-unixodbc CONFIG REQUIRED)
+ SET(ODBC_TARGET unofficial::unixodbc::unixodbc)
+ ADD_LIBRARY(ODBC::ODBC ALIAS ${ODBC_TARGET})
+ELSE()
+ FIND_PACKAGE(ODBC REQUIRED)
+ SET(ODBC_TARGET ODBC::ODBC)
+ENDIF()
Comment on lines +8 to +16
Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

This must match the dependencies expressed in the manifests. I have more suggestions once the manifest dependency question is answered.

Copy link
Copy Markdown
Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Good point, this is wrongfully adapted. Depending on the result of the other comment, this probably should be IF(LINUX OR APPLE).

Copy link
Copy Markdown
Contributor

@JavierMatosD JavierMatosD Mar 3, 2026

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

This must match the dependencies expressed in the manifests. I have more suggestions once the manifest dependency question is answered.

@dg0yt, is there anything else you want to suggest? Otherwise, this port looks good to go to me

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

IF(UNIX) still seems wrong to me. This would become an installation order dependency when unixodbc is extended to support bsd or ios or android.

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

The safest wiring would be an option which is controlled by the portfile. Here (project mode):

if(ODBCCPP_USE_UNIXODBC)
   FIND_PACKAGE(unofficial-unixodbc CONFIG REQUIRED)
   SET(ODBC_TARGET unofficial::unixodbc::unixodbc)
ELSE()
   ...

and in the portfile (vcpkg script mode):

vcpkg_list(SET options)
if(VCPKG_TARGET_IS_LINUX OR VCPKG_TARGET_IS_OSX)
    list(APPEND options -DODBCCPP_USE_UNIXODBC=ON)
endif()

vcpkg_cmake_configure(
    ...
    OPTIONS
       ${options}
    ...
)
  • I would probably create an alias ODBC::ODBC instead of replacing its use with a variable.
  • There is no installed CMake config. But unless using dynamic loading, there are conditional transitive usage requirements. User must duplicate the condition.

Copy link
Copy Markdown

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Thanks for the careful check. I added a config file to odbccpp, this is a good thing anyway. Also, I added your suggestions, I hope it fits now.

+
FIND_PACKAGE(Doxygen)
FIND_PACKAGE(GTest)

22 changes: 22 additions & 0 deletions ports/odbccpp/vcpkg.json
Original file line number Diff line number Diff line change
@@ -0,0 +1,22 @@
{
"name": "odbccpp",
"version": "1.6",
"description": "An object-oriented C++ wrapper of the ODBC API from SAP",
"homepage": "https://github.com/SAP/odbc-cpp-wrapper",
"license": "Apache-2.0",
"supports": "!uwp & !android",
"dependencies": [
{
"name": "unixodbc",
"platform": "linux | osx"
},
{
"name": "vcpkg-cmake",
"host": true
},
{
"name": "vcpkg-cmake-config",
"host": true
}
]
}
16 changes: 10 additions & 6 deletions versions/baseline.json
Original file line number Diff line number Diff line change
Expand Up @@ -4424,31 +4424,31 @@
"baseline": "6.23.0",
"port-version": 0
},
"kf6i18n": {
"kf6breezeicons": {
"baseline": "6.23.0",
"port-version": 0
},
"kf6globalaccel": {
"kf6codecs": {
"baseline": "6.23.0",
"port-version": 0
},
"kf6itemmodels": {
"kf6coreaddons": {
"baseline": "6.23.0",
"port-version": 0
},
"kf6dbusaddons": {
"baseline": "6.23.0",
"port-version": 0
},
"kf6coreaddons": {
"kf6globalaccel": {
"baseline": "6.23.0",
"port-version": 0
},
"kf6codecs": {
"kf6i18n": {
"baseline": "6.23.0",
"port-version": 0
},
"kf6breezeicons": {
"kf6itemmodels": {
"baseline": "6.23.0",
"port-version": 0
},
Expand Down Expand Up @@ -7156,6 +7156,10 @@
"baseline": "1.10.0",
"port-version": 0
},
"odbccpp": {
"baseline": "1.6",
"port-version": 0
},
"ode": {
"baseline": "0.16.6",
"port-version": 0
Expand Down
9 changes: 9 additions & 0 deletions versions/o-/odbccpp.json
Original file line number Diff line number Diff line change
@@ -0,0 +1,9 @@
{
"versions": [
{
"git-tree": "4cf05da841cdd917850bf0f5d90a6f2fa4f6da87",
"version": "1.6",
"port-version": 0
}
]
}