2018-05-20 09:07:16 +08:00
|
|
|
vcpkg_from_github(
|
|
|
|
OUT_SOURCE_PATH SOURCE_PATH
|
|
|
|
REPO SOCI/soci
|
2023-02-17 02:21:30 +08:00
|
|
|
REF "v${VERSION}"
|
|
|
|
SHA512 d501f55e7e7408e46b4823fd8a97d6ef587f5db0f5b98434be8dfc5693c91b8c3b84a24454279c83142ab1cd1fa139c6e54d6d9a67397b2ead61650fcc88bcdb
|
2018-05-20 09:07:16 +08:00
|
|
|
HEAD_REF master
|
2021-04-10 01:39:04 +08:00
|
|
|
PATCHES
|
2023-10-11 08:32:58 +08:00
|
|
|
dependencies.diff
|
|
|
|
usage-requirements.diff
|
|
|
|
)
|
|
|
|
file(REMOVE
|
|
|
|
"${SOURCE_PATH}/cmake/modules/FindPostgreSQL.cmake"
|
2016-11-18 11:53:37 +08:00
|
|
|
)
|
|
|
|
|
2018-05-20 09:07:16 +08:00
|
|
|
string(COMPARE EQUAL "${VCPKG_LIBRARY_LINKAGE}" "dynamic" SOCI_DYNAMIC)
|
|
|
|
string(COMPARE EQUAL "${VCPKG_LIBRARY_LINKAGE}" "static" SOCI_STATIC)
|
2016-11-22 05:05:45 +08:00
|
|
|
|
2023-10-11 08:32:58 +08:00
|
|
|
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
|
|
|
|
)
|
2019-03-01 04:41:02 +08:00
|
|
|
|
2021-09-17 01:34:09 +08:00
|
|
|
vcpkg_cmake_configure(
|
|
|
|
SOURCE_PATH "${SOURCE_PATH}"
|
2016-11-18 11:53:37 +08:00
|
|
|
OPTIONS
|
2020-02-08 01:34:22 +08:00
|
|
|
-DSOCI_CXX11=ON
|
2016-11-22 05:05:45 +08:00
|
|
|
-DSOCI_SHARED=${SOCI_DYNAMIC}
|
2023-10-11 08:32:58 +08:00
|
|
|
-DSOCI_STATIC=${SOCI_STATIC}
|
|
|
|
-DSOCI_TESTS=OFF
|
|
|
|
${options}
|
|
|
|
MAYBE_UNUSED_VARIABLES
|
|
|
|
CMAKE_REQUIRE_FIND_PACKAGE_Boost
|
|
|
|
CMAKE_REQUIRE_FIND_PACKAGE_ODBC
|
2016-11-18 11:53:37 +08:00
|
|
|
)
|
|
|
|
|
2021-09-17 01:34:09 +08:00
|
|
|
vcpkg_cmake_install()
|
2021-02-20 05:06:34 +08:00
|
|
|
vcpkg_copy_pdbs()
|
2021-09-17 01:34:09 +08:00
|
|
|
vcpkg_cmake_config_fixup(CONFIG_PATH lib/cmake/SOCI)
|
2021-04-10 01:39:04 +08:00
|
|
|
|
2023-10-11 08:32:58 +08:00
|
|
|
if(VCPKG_LIBRARY_LINKAGE STREQUAL "dynamic")
|
|
|
|
vcpkg_replace_string("${CURRENT_PACKAGES_DIR}/include/soci/soci-platform.h" "ifdef SOCI_DLL" "if 1")
|
2021-04-10 01:39:04 +08:00
|
|
|
endif()
|
2016-11-18 11:53:37 +08:00
|
|
|
|
2021-09-17 01:34:09 +08:00
|
|
|
file(REMOVE_RECURSE "${CURRENT_PACKAGES_DIR}/debug/include")
|
2018-05-20 09:07:16 +08:00
|
|
|
|
2023-10-14 02:05:30 +08:00
|
|
|
file(READ "${CURRENT_PORT_DIR}/usage" usage)
|
2023-10-11 08:32:58 +08:00
|
|
|
set(backends ${FEATURES})
|
|
|
|
list(REMOVE_ITEM backends core boost)
|
|
|
|
if(backends STREQUAL "")
|
2023-10-14 02:05:30 +08:00
|
|
|
string(APPEND usage "
|
|
|
|
This soci build doesn't include any backend and may not be useful.
|
|
|
|
")
|
2023-10-11 08:32:58 +08:00
|
|
|
endif()
|
2023-10-14 02:05:30 +08:00
|
|
|
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}")
|
2023-10-11 08:32:58 +08:00
|
|
|
|
2023-02-17 02:21:30 +08:00
|
|
|
vcpkg_install_copyright(FILE_LIST "${SOURCE_PATH}/LICENSE_1_0.txt")
|