[soci] Add postgresql feature (#5029)

Signed-off-by: Andrei Lebedev <lebdron@gmail.com>
This commit is contained in:
Andrei Lebedev 2019-02-28 23:41:02 +03:00 committed by Phil Christensen
parent 0a5c27a823
commit a3a42ede13
3 changed files with 64 additions and 7 deletions

View File

@ -1,4 +1,18 @@
Source: soci
Version: 3.2.3-1
Build-Depends: sqlite3
Version: 3.2.3-2
Description: SOCI database access library
Feature: boost
Build-Depends: boost-date-time, boost-fusion, boost-optional, boost-preprocessor, boost-tuple
Description: Integration with Boost
Feature: sqlite3
Build-Depends: sqlite3
Description: Build sqlite3 backend
Feature: postgresql
Build-Depends: libpq
Description: Build postgresql backend
Feature: odbc
Description: Build odbc backend

View File

@ -0,0 +1,30 @@
diff --git a/src/cmake/modules/FindPostgreSQL.cmake b/src/cmake/modules/FindPostgreSQL.cmake
index 8178418..6e15d5b 100644
--- a/src/cmake/modules/FindPostgreSQL.cmake
+++ b/src/cmake/modules/FindPostgreSQL.cmake
@@ -65,6 +65,25 @@ find_library(POSTGRESQL_LIBRARIES NAMES pq libpq
$ENV{ProgramFiles}/PostgreSQL/*/lib/ms
$ENV{SystemDrive}/PostgreSQL/*/lib/ms)
+find_library(POSTGRESQL_LIBRARIES_DEBUG NAMES pqd libpqd
+ PATHS
+ ${PG_CONFIG_LIBDIR}
+ /usr/lib
+ /usr/local/lib
+ /usr/lib/postgresql
+ /usr/lib64
+ /usr/local/lib64
+ /usr/lib64/postgresql
+ $ENV{ProgramFiles}/PostgreSQL/*/lib
+ $ENV{SystemDrive}/PostgreSQL/*/lib
+ $ENV{ProgramFiles}/PostgreSQL/*/lib/ms
+ $ENV{SystemDrive}/PostgreSQL/*/lib/ms)
+
+if(WIN32 AND POSTGRESQL_LIBRARIES AND POSTGRESQL_LIBRARIES_DEBUG)
+ set(POSTGRESQL_LIBRARIES optimized ${POSTGRESQL_LIBRARIES}
+ debug ${POSTGRESQL_LIBRARIES_DEBUG})
+endif()
+
if(POSTGRESQL_INCLUDE_DIR AND POSTGRESQL_LIBRARIES)
set(POSTGRESQL_FOUND TRUE)
else()

View File

@ -6,11 +6,28 @@ vcpkg_from_github(
SHA512 8c597b37efe82c85e6d951f66cb0f818d2c12cb673914bc7b322bc0a9da676e6c02f221c9104fb06d1b4b02fed4e5a4fb872dd3370b9117f248c3b948faf4fb3
HEAD_REF master
PATCHES "${CMAKE_CURRENT_LIST_DIR}/no-define-snprintf.patch"
"${CMAKE_CURRENT_LIST_DIR}/find-libpqd.patch"
)
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()
endforeach()
vcpkg_configure_cmake(
SOURCE_PATH ${SOURCE_PATH}/src
PREFER_NINJA
@ -21,14 +38,10 @@ vcpkg_configure_cmake(
-DLIBDIR:STRING=lib
-DSOCI_STATIC=${SOCI_STATIC}
-DSOCI_SHARED=${SOCI_DYNAMIC}
${_COMPONENT_FLAGS}
-DWITH_SQLITE3=ON
-DWITH_BOOST=OFF
-DWITH_MYSQL=OFF
-DWITH_ODBC=OFF
-DWITH_ORACLE=OFF
-DWITH_POSTGRESQL=OFF
-DWITH_FIREBIRD=OFF
-DWITH_DB2=OFF
)