aboutsummaryrefslogtreecommitdiff
path: root/vcpkg/ports/soci
diff options
context:
space:
mode:
authorEthan Morgan <ethan@gweithio.com>2026-02-14 16:44:06 +0000
committerEthan Morgan <ethan@gweithio.com>2026-02-14 16:44:06 +0000
commit54409423f767d8b1cf30cb7d0efca6b4ca138823 (patch)
treed915ac7828703ce4b963efdd9728a1777ba18c1e /vcpkg/ports/soci
move to own git serverHEADmaster
Diffstat (limited to 'vcpkg/ports/soci')
-rw-r--r--vcpkg/ports/soci/dependencies.diff100
-rw-r--r--vcpkg/ports/soci/portfile.cmake74
-rw-r--r--vcpkg/ports/soci/usage5
-rw-r--r--vcpkg/ports/soci/usage-requirements.diff33
-rw-r--r--vcpkg/ports/soci/vcpkg.json67
5 files changed, 279 insertions, 0 deletions
diff --git a/vcpkg/ports/soci/dependencies.diff b/vcpkg/ports/soci/dependencies.diff
new file mode 100644
index 0000000..187022d
--- /dev/null
+++ b/vcpkg/ports/soci/dependencies.diff
@@ -0,0 +1,100 @@
+diff --git a/cmake/dependencies/Boost.cmake b/cmake/dependencies/Boost.cmake
+index 366d32b..7ff041b 100644
+--- a/cmake/dependencies/Boost.cmake
++++ b/cmake/dependencies/Boost.cmake
+@@ -10,4 +10,6 @@ endif()
+ set(Boost_RELEASE_VERSION
+ "${Boost_MAJOR_VERSION}.${Boost_MINOR_VERSION}.${Boost_SUBMINOR_VERSION}")
+
++set(BOOST_FOUND "${Boost_FOUND}")
++set(BOOST_LIBRARIES "${Boost_LIBRARIES}")
+ boost_external_report(Boost RELEASE_VERSION INCLUDE_DIR LIBRARIES)
+diff --git a/cmake/dependencies/MySQL.cmake b/cmake/dependencies/MySQL.cmake
+index 5599b08..0a4ce0f 100644
+--- a/cmake/dependencies/MySQL.cmake
++++ b/cmake/dependencies/MySQL.cmake
+@@ -1,5 +1,9 @@
+ set(MySQL_FIND_QUIETLY TRUE)
+
+-find_package(MySQL)
++find_package(MYSQL NAMES unofficial-libmysql REQUIRED)
++set(MYSQL_LIBRARIES "$<TARGET_NAME:libmysql>")
++if(TARGET mysqlclient AND NOT TARGET libmysql)
++ set(MYSQL_LIBRARIES "$<TARGET_NAME:mysqlclient>")
++endif()
+
+ boost_external_report(MySQL INCLUDE_DIR LIBRARIES)
+diff --git a/cmake/dependencies/PostgreSQL.cmake b/cmake/dependencies/PostgreSQL.cmake
+index c6f2154..ef6bfcd 100644
+--- a/cmake/dependencies/PostgreSQL.cmake
++++ b/cmake/dependencies/PostgreSQL.cmake
+@@ -1,5 +1,8 @@
+ set(PostgreSQL_FIND_QUIETLY TRUE)
+
+-find_package(PostgreSQL)
++find_package(PostgreSQL REQUIRED)
++set(POSTGRESQL_FOUND TRUE)
++set(POSTGRESQL_INCLUDE_DIRS "${PostgreSQL_INCLUDE_DIRS}")
++set(POSTGRESQL_LIBRARIES "${PostgreSQL_LIBRARIES}")
+
+ boost_external_report(PostgreSQL INCLUDE_DIRS LIBRARIES VERSION)
+diff --git a/cmake/dependencies/SQLite3.cmake b/cmake/dependencies/SQLite3.cmake
+index 0daa9a5..17775da 100644
+--- a/cmake/dependencies/SQLite3.cmake
++++ b/cmake/dependencies/SQLite3.cmake
+@@ -1,5 +1,6 @@
+ set(SQLITE3_FIND_QUIETLY TRUE)
+
+-find_package(SQLite3)
++find_package(SQLITE3 NAMES unofficial-sqlite3 CONFIG REQUIRED)
++set(SQLITE3_LIBRARIES unofficial::sqlite3::sqlite3)
+
+ boost_external_report(SQLite3 INCLUDE_DIR LIBRARIES)
+diff --git a/cmake/resources/SOCIConfig.cmake.in b/cmake/resources/SOCIConfig.cmake.in
+index 8096a3c..354c18b 100644
+--- a/cmake/resources/SOCIConfig.cmake.in
++++ b/cmake/resources/SOCIConfig.cmake.in
+@@ -1,3 +1,11 @@
+ @PACKAGE_INIT@
+
++include(CMakeFindDependencyMacro)
++if("@WITH_MYSQL@")
++ find_dependency(unofficial-libmysql)
++endif()
++if("@WITH_SQLITE3@")
++ find_dependency(unofficial-sqlite3)
++endif()
++
+ include(${CMAKE_CURRENT_LIST_DIR}/SOCITargets.cmake)
+diff --git a/include/soci/mysql/soci-mysql.h b/include/soci/mysql/soci-mysql.h
+index 376bb7e..fbe48fa 100644
+--- a/include/soci/mysql/soci-mysql.h
++++ b/include/soci/mysql/soci-mysql.h
+@@ -21,8 +21,8 @@
+ #ifdef _WIN32
+ #include <winsock.h> // SOCKET
+ #endif // _WIN32
+-#include <mysql.h> // MySQL Client
+-#include <errmsg.h> // MySQL Error codes
++#include <mysql/mysql.h> // MySQL Client
++#include <mysql/errmsg.h> // MySQL Error codes
+ #include <vector>
+
+
+diff --git a/src/backends/CMakeLists.txt b/src/backends/CMakeLists.txt
+index 871e151..3cffc80 100644
+--- a/src/backends/CMakeLists.txt
++++ b/src/backends/CMakeLists.txt
+@@ -14,9 +14,9 @@ colormsg(_HIBLUE_ "Configuring SOCI backend libraries:")
+ foreach(dep ${SOCI_BACKENDS_DB_DEPENDENCIES})
+ string(TOUPPER ${dep} depUP)
+ if (WITH_${depUP})
+- find_package(${dep})
+- endif()
+- if(${dep}_FOUND OR ${depUP}_FOUND)
++ if(NOT (${dep}_FOUND OR ${depUP}_FOUND))
++ message(FATAL_ERROR "${depUP} not found, check SociDependencies.cmake")
++ endif()
+ set(${depUP}_FOUND ON)
+ else()
+ set(${depUP}_FOUND OFF)
diff --git a/vcpkg/ports/soci/portfile.cmake b/vcpkg/ports/soci/portfile.cmake
new file mode 100644
index 0000000..b675782
--- /dev/null
+++ b/vcpkg/ports/soci/portfile.cmake
@@ -0,0 +1,74 @@
+vcpkg_from_github(
+ OUT_SOURCE_PATH SOURCE_PATH
+ REPO SOCI/soci
+ REF "v${VERSION}"
+ SHA512 d501f55e7e7408e46b4823fd8a97d6ef587f5db0f5b98434be8dfc5693c91b8c3b84a24454279c83142ab1cd1fa139c6e54d6d9a67397b2ead61650fcc88bcdb
+ HEAD_REF master
+ PATCHES
+ dependencies.diff
+ usage-requirements.diff
+)
+file(REMOVE
+ "${SOURCE_PATH}/cmake/modules/FindPostgreSQL.cmake"
+)
+
+string(COMPARE EQUAL "${VCPKG_LIBRARY_LINKAGE}" "dynamic" SOCI_DYNAMIC)
+string(COMPARE EQUAL "${VCPKG_LIBRARY_LINKAGE}" "static" SOCI_STATIC)
+
+vcpkg_check_features(OUT_FEATURE_OPTIONS options
+ FEATURES
+ boost WITH_BOOST
+ boost CMAKE_REQUIRE_FIND_PACKAGE_Boost
+ empty SOCI_EMPTY
+ mysql WITH_MYSQL
+ odbc WITH_ODBC
+ odbc CMAKE_REQUIRE_FIND_PACKAGE_ODBC
+ postgresql WITH_POSTGRESQL
+ sqlite3 WITH_SQLITE3
+ INVERTED_FEATURES
+ core WITH_DB2
+ core WITH_FIREBIRD
+ core WITH_ORACLE
+ core WITH_VALGRIND
+)
+
+vcpkg_cmake_configure(
+ SOURCE_PATH "${SOURCE_PATH}"
+ OPTIONS
+ -DSOCI_CXX11=ON
+ -DSOCI_SHARED=${SOCI_DYNAMIC}
+ -DSOCI_STATIC=${SOCI_STATIC}
+ -DSOCI_TESTS=OFF
+ ${options}
+ MAYBE_UNUSED_VARIABLES
+ CMAKE_REQUIRE_FIND_PACKAGE_Boost
+ CMAKE_REQUIRE_FIND_PACKAGE_ODBC
+)
+
+vcpkg_cmake_install()
+vcpkg_copy_pdbs()
+vcpkg_cmake_config_fixup(CONFIG_PATH lib/cmake/SOCI)
+
+if(VCPKG_LIBRARY_LINKAGE STREQUAL "dynamic")
+ vcpkg_replace_string("${CURRENT_PACKAGES_DIR}/include/soci/soci-platform.h" "ifdef SOCI_DLL" "if 1")
+endif()
+
+file(REMOVE_RECURSE "${CURRENT_PACKAGES_DIR}/debug/include")
+
+file(READ "${CURRENT_PORT_DIR}/usage" usage)
+set(backends ${FEATURES})
+list(REMOVE_ITEM backends core boost)
+if(backends STREQUAL "")
+ string(APPEND usage "
+This soci build doesn't include any backend and may not be useful.
+")
+endif()
+foreach(backend IN LISTS backends)
+ string(APPEND usage "
+ # Using the ${backend} backend directly
+ target_link_libraries(main PRIVATE $<IF:$<TARGET_EXISTS:SOCI::soci_${backend}>,SOCI::soci_${backend},SOCI::soci_${backend}_static>)
+")
+endforeach()
+file(WRITE "${CURRENT_PACKAGES_DIR}/share/${PORT}/usage" "${usage}")
+
+vcpkg_install_copyright(FILE_LIST "${SOURCE_PATH}/LICENSE_1_0.txt")
diff --git a/vcpkg/ports/soci/usage b/vcpkg/ports/soci/usage
new file mode 100644
index 0000000..fc30442
--- /dev/null
+++ b/vcpkg/ports/soci/usage
@@ -0,0 +1,5 @@
+soci provides CMake targets:
+
+ find_package(SOCI CONFIG REQUIRED)
+ # Using core (loading backends at runtime)
+ target_link_libraries(main PRIVATE $<IF:$<TARGET_EXISTS:SOCI::soci_core>,SOCI::soci_core,SOCI::soci_core_static>)
diff --git a/vcpkg/ports/soci/usage-requirements.diff b/vcpkg/ports/soci/usage-requirements.diff
new file mode 100644
index 0000000..9ecd405
--- /dev/null
+++ b/vcpkg/ports/soci/usage-requirements.diff
@@ -0,0 +1,33 @@
+diff --git a/cmake/SociBackend.cmake b/cmake/SociBackend.cmake
+index 5d4ef0d..279cb75 100644
+--- a/cmake/SociBackend.cmake
++++ b/cmake/SociBackend.cmake
+@@ -159,8 +159,13 @@ macro(soci_backend NAME)
+ ${THIS_BACKEND_HEADERS})
+
+ target_link_libraries(${THIS_BACKEND_TARGET}
++ PUBLIC
+ ${SOCI_CORE_TARGET}
+ ${THIS_BACKEND_DEPENDS_LIBRARIES})
++ target_include_directories(${THIS_BACKEND_TARGET}
++ PUBLIC
++ ${THIS_BACKEND_DEPENDS_INCLUDE_DIRS}
++ )
+
+ if(WIN32)
+ set_target_properties(${THIS_BACKEND_TARGET}
+@@ -197,8 +202,14 @@ macro(soci_backend NAME)
+
+ # Still need to link the libraries for tests to work
+ target_link_libraries (${THIS_BACKEND_TARGET_STATIC}
++ PUBLIC
++ ${SOCI_CORE_TARGET}_static
+ ${THIS_BACKEND_DEPENDS_LIBRARIES}
+ )
++ target_include_directories(${THIS_BACKEND_TARGET_STATIC}
++ PUBLIC
++ ${THIS_BACKEND_DEPENDS_INCLUDE_DIRS}
++ )
+
+ set_target_properties(${THIS_BACKEND_TARGET_STATIC}
+ PROPERTIES
diff --git a/vcpkg/ports/soci/vcpkg.json b/vcpkg/ports/soci/vcpkg.json
new file mode 100644
index 0000000..004473e
--- /dev/null
+++ b/vcpkg/ports/soci/vcpkg.json
@@ -0,0 +1,67 @@
+{
+ "name": "soci",
+ "version": "4.0.3",
+ "port-version": 3,
+ "description": "SOCI - The C++ Database Access Library",
+ "homepage": "https://soci.sourceforge.net/",
+ "license": "BSL-1.0",
+ "dependencies": [
+ {
+ "name": "vcpkg-cmake",
+ "host": true
+ },
+ {
+ "name": "vcpkg-cmake-config",
+ "host": true
+ }
+ ],
+ "features": {
+ "boost": {
+ "description": "Integration with Boost",
+ "dependencies": [
+ "boost-date-time",
+ "boost-fusion",
+ "boost-optional",
+ "boost-preprocessor",
+ "boost-tuple"
+ ]
+ },
+ "empty": {
+ "description": "Build the backend skeleton for new backends development"
+ },
+ "mysql": {
+ "description": "Build mysql backend",
+ "dependencies": [
+ "libmysql"
+ ]
+ },
+ "odbc": {
+ "description": "Build odbc backend",
+ "supports": "!uwp",
+ "dependencies": [
+ {
+ "name": "unixodbc",
+ "platform": "!windows"
+ }
+ ]
+ },
+ "postgresql": {
+ "description": "Build postgresql backend",
+ "dependencies": [
+ {
+ "name": "libpq",
+ "default-features": false
+ }
+ ]
+ },
+ "sqlite3": {
+ "description": "Build sqlite3 backend",
+ "dependencies": [
+ {
+ "name": "sqlite3",
+ "default-features": false
+ }
+ ]
+ }
+ }
+}