mirror of
https://github.com/microsoft/vcpkg.git
synced 2024-11-27 19:09:00 +08:00
[soci] Fix dependencies in, intern, out (#34327)
This commit is contained in:
parent
dfc21e3f28
commit
64c330e2e7
100
ports/soci/dependencies.diff
Normal file
100
ports/soci/dependencies.diff
Normal file
@ -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)
|
@ -1,14 +0,0 @@
|
||||
diff --git a/cmake/modules/FindMySQL.cmake b/cmake/modules/FindMySQL.cmake
|
||||
index 1233568..9a7cb61 100644
|
||||
--- a/cmake/modules/FindMySQL.cmake
|
||||
+++ b/cmake/modules/FindMySQL.cmake
|
||||
@@ -13,6 +13,9 @@
|
||||
#
|
||||
# Redistribution and use is allowed according to the terms of the BSD license.
|
||||
# For details see the accompanying COPYING-CMAKE-SCRIPTS file.
|
||||
+find_package(libmysql REQUIRED)
|
||||
+set(MySQL_FOUND 1)
|
||||
+return()
|
||||
|
||||
include(CheckCXXSourceCompiles)
|
||||
|
@ -1,12 +0,0 @@
|
||||
diff --git a/src/backends/mysql/session.cpp b/src/backends/mysql/session.cpp
|
||||
index 383248c..86a5bfd 100644
|
||||
--- a/src/backends/mysql/session.cpp
|
||||
+++ b/src/backends/mysql/session.cpp
|
||||
@@ -5,6 +5,7 @@
|
||||
// (See accompanying file LICENSE_1_0.txt or copy at
|
||||
// http://www.boost.org/LICENSE_1_0.txt)
|
||||
//
|
||||
+typedef bool my_bool;
|
||||
|
||||
#define SOCI_MYSQL_SOURCE
|
||||
#include "soci/mysql/soci-mysql.h"
|
@ -5,57 +5,62 @@ vcpkg_from_github(
|
||||
SHA512 d501f55e7e7408e46b4823fd8a97d6ef587f5db0f5b98434be8dfc5693c91b8c3b84a24454279c83142ab1cd1fa139c6e54d6d9a67397b2ead61650fcc88bcdb
|
||||
HEAD_REF master
|
||||
PATCHES
|
||||
fix-dependency-libmysql.patch
|
||||
export-include-dirs.patch
|
||||
fix-mysql-feature-error.patch # https://bugs.mysql.com/bug.php?id=85131
|
||||
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)
|
||||
|
||||
# Handle features
|
||||
set(_COMPONENT_FLAGS "")
|
||||
foreach(_feature IN LISTS ALL_FEATURES)
|
||||
# Uppercase the feature name and replace "-" with "_"
|
||||
string(TOUPPER "${_feature}" _FEATURE)
|
||||
string(REPLACE "-" "_" _FEATURE "${_FEATURE}")
|
||||
|
||||
# Turn "-DWITH_*=" ON or OFF depending on whether the feature
|
||||
# is in the list.
|
||||
if(_feature IN_LIST FEATURES)
|
||||
list(APPEND _COMPONENT_FLAGS "-DWITH_${_FEATURE}=ON")
|
||||
else()
|
||||
list(APPEND _COMPONENT_FLAGS "-DWITH_${_FEATURE}=OFF")
|
||||
endif()
|
||||
|
||||
if(_feature MATCHES "mysql")
|
||||
set(MYSQL_OPT "-DMYSQL_INCLUDE_DIR=${CURRENT_INSTALLED_DIR}/include/mysql")
|
||||
endif()
|
||||
endforeach()
|
||||
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_TESTS=OFF
|
||||
-DSOCI_CXX11=ON
|
||||
-DSOCI_STATIC=${SOCI_STATIC}
|
||||
-DSOCI_SHARED=${SOCI_DYNAMIC}
|
||||
${_COMPONENT_FLAGS}
|
||||
${MYSQL_OPT}
|
||||
-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 ("mysql" IN_LIST FEATURES)
|
||||
vcpkg_replace_string("${CURRENT_PACKAGES_DIR}/share/${PORT}/SOCIConfig.cmake"
|
||||
"# Create imported target SOCI::soci_mysql"
|
||||
"\ninclude(CMakeFindDependencyMacro)\nfind_dependency(libmysql)\n# Create imported target SOCI::soci_mysql"
|
||||
)
|
||||
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")
|
||||
|
||||
# Handle copyright
|
||||
set(backends ${FEATURES})
|
||||
list(REMOVE_ITEM backends core boost)
|
||||
if(backends STREQUAL "")
|
||||
message(STATUS "Attention:\n\nThis soci build doesn't include any backends.\n")
|
||||
set(backends "none")
|
||||
endif()
|
||||
configure_file("${CURRENT_PORT_DIR}/usage" "${CURRENT_PACKAGES_DIR}/share/${PORT}/usage" @ONLY)
|
||||
|
||||
vcpkg_install_copyright(FILE_LIST "${SOURCE_PATH}/LICENSE_1_0.txt")
|
||||
|
7
ports/soci/usage
Normal file
7
ports/soci/usage
Normal file
@ -0,0 +1,7 @@
|
||||
soci provides CMake targets:
|
||||
|
||||
find_package(soci CONFIG REQUIRED)
|
||||
target_link_libraries(main PRIVATE $<IF:$<TARGET_EXISTS:SOCI::soci_core>,SOCI::soci_core,SOCI::soci_core_static>)
|
||||
|
||||
# Linking specific backends (enabled: @backends@)
|
||||
target_link_libraries(main PRIVATE $<IF:$<TARGET_EXISTS:SOCI::soci_<BACKEND>,SOCI::soci_<BACKEND>,SOCI::soci_<BACKEND>_static>)
|
@ -1,15 +1,14 @@
|
||||
diff --git a/cmake/SociBackend.cmake b/cmake/SociBackend.cmake
|
||||
index 5d4ef0d..bb0edf2 100644
|
||||
index 5d4ef0d..279cb75 100644
|
||||
--- a/cmake/SociBackend.cmake
|
||||
+++ b/cmake/SociBackend.cmake
|
||||
@@ -159,8 +159,14 @@ macro(soci_backend NAME)
|
||||
@@ -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}
|
||||
@ -17,20 +16,18 @@ index 5d4ef0d..bb0edf2 100644
|
||||
|
||||
if(WIN32)
|
||||
set_target_properties(${THIS_BACKEND_TARGET}
|
||||
@@ -197,9 +203,15 @@ macro(soci_backend NAME)
|
||||
@@ -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
|
||||
OUTPUT_NAME ${THIS_BACKEND_OUTPUT_NAME}
|
@ -1,9 +1,9 @@
|
||||
{
|
||||
"name": "soci",
|
||||
"version": "4.0.3",
|
||||
"port-version": 1,
|
||||
"description": "SOCI database access library",
|
||||
"homepage": "https://github.com/SOCI/soci",
|
||||
"port-version": 2,
|
||||
"description": "SOCI - The C++ Database Access Library",
|
||||
"homepage": "https://soci.sourceforge.net/",
|
||||
"license": "BSL-1.0",
|
||||
"dependencies": [
|
||||
{
|
||||
@ -26,6 +26,9 @@
|
||||
"boost-tuple"
|
||||
]
|
||||
},
|
||||
"empty": {
|
||||
"description": "Build the backend skeleton for new backends development"
|
||||
},
|
||||
"mysql": {
|
||||
"description": "Build mysql backend",
|
||||
"dependencies": [
|
||||
@ -34,18 +37,30 @@
|
||||
},
|
||||
"odbc": {
|
||||
"description": "Build odbc backend",
|
||||
"supports": "!uwp"
|
||||
"supports": "!uwp",
|
||||
"dependencies": [
|
||||
{
|
||||
"name": "unixodbc",
|
||||
"platform": "!windows"
|
||||
}
|
||||
]
|
||||
},
|
||||
"postgresql": {
|
||||
"description": "Build postgresql backend",
|
||||
"dependencies": [
|
||||
"libpq"
|
||||
{
|
||||
"name": "libpq",
|
||||
"default-features": false
|
||||
}
|
||||
]
|
||||
},
|
||||
"sqlite3": {
|
||||
"description": "Build sqlite3 backend",
|
||||
"dependencies": [
|
||||
"sqlite3"
|
||||
{
|
||||
"name": "sqlite3",
|
||||
"default-features": false
|
||||
}
|
||||
]
|
||||
}
|
||||
}
|
||||
|
@ -1414,6 +1414,11 @@ vcpkg-ci-paraview:x64-windows-static-md=pass
|
||||
vcpkg-ci-paraview:x64-windows-static=pass
|
||||
vcpkg-ci-paraview:x64-windows=pass
|
||||
vcpkg-ci-paraview:x86-windows=pass
|
||||
vcpkg-ci-soci:x64-linux=pass
|
||||
vcpkg-ci-soci:x64-osx=pass
|
||||
vcpkg-ci-soci:x64-windows=pass
|
||||
vcpkg-ci-soci:x64-windows-static=pass
|
||||
vcpkg-ci-soci:x64-windows-static-md=pass
|
||||
vcpkg-ci-wxwidgets:arm64-windows=pass
|
||||
vcpkg-ci-wxwidgets:x64-linux=pass
|
||||
vcpkg-ci-wxwidgets:x64-osx=pass
|
||||
|
4
scripts/test_ports/vcpkg-ci-soci/portfile.cmake
Normal file
4
scripts/test_ports/vcpkg-ci-soci/portfile.cmake
Normal file
@ -0,0 +1,4 @@
|
||||
set(VCPKG_POLICY_EMPTY_PACKAGE enabled)
|
||||
|
||||
vcpkg_cmake_configure(SOURCE_PATH "${CURRENT_PORT_DIR}/project")
|
||||
vcpkg_cmake_build()
|
13
scripts/test_ports/vcpkg-ci-soci/project/CMakeLists.txt
Normal file
13
scripts/test_ports/vcpkg-ci-soci/project/CMakeLists.txt
Normal file
@ -0,0 +1,13 @@
|
||||
cmake_minimum_required(VERSION 3.7)
|
||||
project(soci-test CXX)
|
||||
|
||||
if(APPLE)
|
||||
set(CMAKE_CXX_STANDARD 11)
|
||||
endif()
|
||||
|
||||
add_executable(main main.cpp)
|
||||
|
||||
find_package(SOCI CONFIG REQUIRED)
|
||||
target_link_libraries(main PRIVATE $<IF:$<TARGET_EXISTS:SOCI::soci_mysql>,SOCI::soci_mysql,SOCI::soci_mysql_static>)
|
||||
target_link_libraries(main PRIVATE $<IF:$<TARGET_EXISTS:SOCI::soci_postgresql>,SOCI::soci_postgresql,SOCI::soci_postgresql_static>)
|
||||
target_link_libraries(main PRIVATE $<IF:$<TARGET_EXISTS:SOCI::soci_sqlite3>,SOCI::soci_sqlite3,SOCI::soci_sqlite3_static>)
|
11
scripts/test_ports/vcpkg-ci-soci/project/main.cpp
Normal file
11
scripts/test_ports/vcpkg-ci-soci/project/main.cpp
Normal file
@ -0,0 +1,11 @@
|
||||
#include <soci/soci.h>
|
||||
#include <soci/mysql/soci-mysql.h>
|
||||
#include <soci/postgresql/soci-postgresql.h>
|
||||
#include <soci/sqlite3/soci-sqlite3.h>
|
||||
|
||||
int main()
|
||||
{
|
||||
soci::session mysql_db(soci::mysql, "test:mysql");
|
||||
soci::session pgsql_db(soci::postgresql, "test:postgresql");
|
||||
soci::session sqlite3_db(soci::sqlite3, "test.db");
|
||||
}
|
20
scripts/test_ports/vcpkg-ci-soci/vcpkg.json
Normal file
20
scripts/test_ports/vcpkg-ci-soci/vcpkg.json
Normal file
@ -0,0 +1,20 @@
|
||||
{
|
||||
"name": "vcpkg-ci-soci",
|
||||
"version-string": "ci",
|
||||
"description": "Validates soci",
|
||||
"supports": "x64 & (linux | osx | windows) & !uwp",
|
||||
"dependencies": [
|
||||
{
|
||||
"name": "soci",
|
||||
"features": [
|
||||
"mysql",
|
||||
"postgresql",
|
||||
"sqlite3"
|
||||
]
|
||||
},
|
||||
{
|
||||
"name": "vcpkg-cmake",
|
||||
"host": true
|
||||
}
|
||||
]
|
||||
}
|
@ -7818,7 +7818,7 @@
|
||||
},
|
||||
"soci": {
|
||||
"baseline": "4.0.3",
|
||||
"port-version": 1
|
||||
"port-version": 2
|
||||
},
|
||||
"socket-io-client": {
|
||||
"baseline": "2023-02-14",
|
||||
|
@ -1,5 +1,10 @@
|
||||
{
|
||||
"versions": [
|
||||
{
|
||||
"git-tree": "63f4471adc41e108aed34cd585a06e354f1b4762",
|
||||
"version": "4.0.3",
|
||||
"port-version": 2
|
||||
},
|
||||
{
|
||||
"git-tree": "9a70ee9344f5a66ed9ad34a5f64608b81e66bfde",
|
||||
"version": "4.0.3",
|
||||
|
Loading…
Reference in New Issue
Block a user