2018-05-20 09:07:16 +08:00
|
|
|
vcpkg_from_github(
|
|
|
|
OUT_SOURCE_PATH SOURCE_PATH
|
|
|
|
REPO SOCI/soci
|
2020-11-21 03:54:07 +08:00
|
|
|
REF 334cc55d9fa7b42d7214a8533a246d637bc92899 #version 4.0.1 commit on 2020.10.19
|
|
|
|
SHA512 b300b13f68347d78252812e09efffb1735072cf5019940da53366a5cdee997f4b8b03a584a87a95ba764b0a78640ad6eb4966b53f9156280cb452465607afbc7
|
2018-05-20 09:07:16 +08:00
|
|
|
HEAD_REF master
|
2021-04-10 01:39:04 +08:00
|
|
|
PATCHES
|
|
|
|
fix-dependency-libmysql.patch
|
|
|
|
export-include-dirs.patch
|
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
|
|
|
|
2019-03-01 04:41:02 +08:00
|
|
|
# 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()
|
2021-01-17 11:43:54 +08:00
|
|
|
|
|
|
|
if(_feature MATCHES "mysql")
|
2021-04-10 01:39:04 +08:00
|
|
|
set(MYSQL_OPT -DMYSQL_INCLUDE_DIR=${CURRENT_INSTALLED_DIR}/include/mysql)
|
2021-01-17 11:43:54 +08:00
|
|
|
endif()
|
2019-03-01 04:41:02 +08:00
|
|
|
endforeach()
|
|
|
|
|
2016-11-18 11:53:37 +08:00
|
|
|
vcpkg_configure_cmake(
|
2019-04-09 14:54:58 +08:00
|
|
|
SOURCE_PATH ${SOURCE_PATH}
|
2018-05-20 09:08:17 +08:00
|
|
|
PREFER_NINJA
|
2016-11-18 11:53:37 +08:00
|
|
|
OPTIONS
|
|
|
|
-DSOCI_TESTS=OFF
|
2020-02-08 01:34:22 +08:00
|
|
|
-DSOCI_CXX11=ON
|
2018-05-20 09:08:17 +08:00
|
|
|
-DSOCI_LIBDIR:STRING=lib # This is to always have output in the lib folder and not lib64 for 64-bit builds
|
|
|
|
-DLIBDIR:STRING=lib
|
2016-11-22 05:05:45 +08:00
|
|
|
-DSOCI_STATIC=${SOCI_STATIC}
|
|
|
|
-DSOCI_SHARED=${SOCI_DYNAMIC}
|
2019-03-01 04:41:02 +08:00
|
|
|
${_COMPONENT_FLAGS}
|
2021-01-17 11:43:54 +08:00
|
|
|
${MYSQL_OPT}
|
2018-05-20 09:07:16 +08:00
|
|
|
-DWITH_ORACLE=OFF
|
|
|
|
-DWITH_FIREBIRD=OFF
|
|
|
|
-DWITH_DB2=OFF
|
2016-11-18 11:53:37 +08:00
|
|
|
)
|
|
|
|
|
|
|
|
vcpkg_install_cmake()
|
2021-02-20 05:06:34 +08:00
|
|
|
vcpkg_copy_pdbs()
|
2021-01-17 11:43:54 +08:00
|
|
|
vcpkg_fixup_cmake_targets(CONFIG_PATH cmake)
|
|
|
|
# Correct the config file name
|
2021-04-10 01:39:04 +08:00
|
|
|
file(RENAME ${CURRENT_PACKAGES_DIR}/share/${PORT}/SOCI.cmake ${CURRENT_PACKAGES_DIR}/share/${PORT}/SOCIConfig.cmake)
|
|
|
|
|
|
|
|
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"
|
|
|
|
)
|
|
|
|
endif()
|
2016-11-18 11:53:37 +08:00
|
|
|
|
2019-11-20 02:50:11 +08:00
|
|
|
file(REMOVE_RECURSE ${CURRENT_PACKAGES_DIR}/debug/include ${CURRENT_PACKAGES_DIR}/debug/share)
|
2018-05-20 09:07:16 +08:00
|
|
|
|
2016-11-18 11:53:37 +08:00
|
|
|
# Handle copyright
|
2019-11-20 02:50:11 +08:00
|
|
|
file(INSTALL ${SOURCE_PATH}/LICENSE_1_0.txt DESTINATION ${CURRENT_PACKAGES_DIR}/share/${PORT} RENAME copyright)
|