2020-05-02 03:43:06 +08:00
|
|
|
# This port needs to be updated at the same time as libbson
|
2022-11-02 22:39:31 +01:00
|
|
|
|
|
|
|
vcpkg_minimum_required(VERSION 2022-10-12) # for ${VERSION}
|
|
|
|
|
2020-05-02 03:43:06 +08:00
|
|
|
vcpkg_from_github(
|
|
|
|
OUT_SOURCE_PATH SOURCE_PATH
|
|
|
|
REPO mongodb/mongo-c-driver
|
2022-11-02 22:39:31 +01:00
|
|
|
REF "${VERSION}"
|
|
|
|
SHA512 36cd8844b1cc9a935c50afc240523f9aaac7cffa58a5d0f9850848f22ab0f1f5a7202ec9b56b0a7d15f075f665bcecbec63b28d2074d35a7cf25065f9075c15e
|
2020-05-02 03:43:06 +08:00
|
|
|
HEAD_REF master
|
|
|
|
PATCHES
|
2022-11-02 22:39:31 +01:00
|
|
|
disable-dynamic-when-static.patch
|
|
|
|
fix-include-directory.patch # vcpkg legacy decision
|
2021-10-27 06:31:19 +01:00
|
|
|
fix-dependencies.patch
|
2022-11-02 22:39:31 +01:00
|
|
|
fix-mingw.patch
|
|
|
|
pkgconfig.patch
|
2020-05-02 03:43:06 +08:00
|
|
|
)
|
2022-11-02 22:39:31 +01:00
|
|
|
file(WRITE "${SOURCE_PATH}/VERSION_CURRENT" "${VERSION}")
|
2020-05-02 03:43:06 +08:00
|
|
|
|
2022-11-02 22:39:31 +01:00
|
|
|
# Cannot use string(COMPARE EQUAL ...)
|
|
|
|
set(ENABLE_STATIC OFF)
|
2021-10-27 06:31:19 +01:00
|
|
|
if(VCPKG_LIBRARY_LINKAGE STREQUAL "static")
|
|
|
|
set(ENABLE_STATIC ON)
|
|
|
|
endif()
|
2020-05-02 03:43:06 +08:00
|
|
|
|
2022-11-02 22:39:31 +01:00
|
|
|
vcpkg_check_features(OUT_FEATURE_OPTIONS OPTIONS
|
|
|
|
FEATURES
|
|
|
|
icu ENABLE_ICU
|
|
|
|
snappy ENABLE_SNAPPY
|
|
|
|
zstd ENABLE_ZSTD
|
|
|
|
)
|
|
|
|
|
|
|
|
if("openssl" IN_LIST FEATURES)
|
|
|
|
list(APPEND OPTIONS -DENABLE_SSL=OPENSSL)
|
|
|
|
elseif(VCPKG_TARGET_IS_WINDOWS)
|
|
|
|
list(APPEND OPTIONS -DENABLE_SSL=WINDOWS)
|
|
|
|
elseif(VCPKG_TARGET_IS_OSX OR VCPKG_TARGET_IS_IOS)
|
|
|
|
list(APPEND OPTIONS -DENABLE_SSL=DARWIN)
|
2020-05-02 03:43:06 +08:00
|
|
|
else()
|
2022-11-02 22:39:31 +01:00
|
|
|
list(APPEND OPTIONS -DENABLE_SSL=OFF)
|
2020-05-02 03:43:06 +08:00
|
|
|
endif()
|
|
|
|
|
2020-10-14 00:50:53 +02:00
|
|
|
if(VCPKG_TARGET_IS_ANDROID)
|
2022-11-02 22:39:31 +01:00
|
|
|
vcpkg_list(APPEND OPTIONS -DENABLE_SRV=OFF)
|
2020-10-14 00:50:53 +02:00
|
|
|
endif()
|
|
|
|
|
2021-09-08 11:56:06 -07:00
|
|
|
vcpkg_cmake_configure(
|
|
|
|
SOURCE_PATH "${SOURCE_PATH}"
|
2020-05-02 03:43:06 +08:00
|
|
|
OPTIONS
|
2022-11-02 22:39:31 +01:00
|
|
|
${OPTIONS}
|
2020-05-02 03:43:06 +08:00
|
|
|
-DENABLE_BSON=SYSTEM
|
|
|
|
-DENABLE_EXAMPLES=OFF
|
2022-11-02 22:39:31 +01:00
|
|
|
-DENABLE_SHM_COUNTERS=OFF
|
2020-05-02 03:43:06 +08:00
|
|
|
-DENABLE_STATIC=${ENABLE_STATIC}
|
2022-11-02 22:39:31 +01:00
|
|
|
-DENABLE_TESTS=OFF
|
|
|
|
-DENABLE_UNINSTALL=OFF
|
|
|
|
-DENABLE_ZLIB=SYSTEM
|
|
|
|
-DVCPKG_HOST_TRIPLET=${HOST_TRIPLET} # for host pkgconf in PATH
|
2020-05-02 03:43:06 +08:00
|
|
|
)
|
2021-09-08 11:56:06 -07:00
|
|
|
vcpkg_cmake_install()
|
2020-05-02 03:43:06 +08:00
|
|
|
vcpkg_copy_pdbs()
|
2022-11-02 22:39:31 +01:00
|
|
|
vcpkg_fixup_pkgconfig()
|
2020-05-02 03:43:06 +08:00
|
|
|
|
2021-10-27 06:31:19 +01:00
|
|
|
vcpkg_cmake_config_fixup(PACKAGE_NAME mongoc-1.0 CONFIG_PATH "lib/cmake/mongoc-1.0" DO_NOT_DELETE_PARENT_CONFIG_PATH)
|
2022-11-02 22:39:31 +01:00
|
|
|
if(VCPKG_LIBRARY_LINKAGE STREQUAL "static")
|
|
|
|
vcpkg_replace_string("${CURRENT_PACKAGES_DIR}/include/mongoc/mongoc-macros.h"
|
|
|
|
"#define MONGOC_MACROS_H" "#define MONGOC_MACROS_H\n#ifndef MONGOC_STATIC\n#define MONGOC_STATIC\n#endif")
|
|
|
|
vcpkg_cmake_config_fixup(PACKAGE_NAME libmongoc-static-1.0 CONFIG_PATH "lib/cmake/libmongoc-static-1.0")
|
|
|
|
file(MAKE_DIRECTORY "${CURRENT_PACKAGES_DIR}/share/libmongoc-1.0")
|
|
|
|
file(INSTALL "${CMAKE_CURRENT_LIST_DIR}/libmongoc-1.0-config.cmake" DESTINATION "${CURRENT_PACKAGES_DIR}/share/libmongoc-1.0")
|
2020-05-02 03:43:06 +08:00
|
|
|
else()
|
2021-10-27 06:31:19 +01:00
|
|
|
vcpkg_cmake_config_fixup(PACKAGE_NAME libmongoc-1.0 CONFIG_PATH "lib/cmake/libmongoc-1.0")
|
2020-05-02 03:43:06 +08:00
|
|
|
endif()
|
2021-10-27 06:31:19 +01:00
|
|
|
|
2022-11-02 22:39:31 +01:00
|
|
|
file(REMOVE_RECURSE
|
|
|
|
"${CURRENT_PACKAGES_DIR}/debug/include"
|
|
|
|
"${CURRENT_PACKAGES_DIR}/debug/share"
|
|
|
|
)
|
2020-05-02 03:43:06 +08:00
|
|
|
|
2022-11-02 22:39:31 +01:00
|
|
|
file(INSTALL "${CMAKE_CURRENT_LIST_DIR}/usage" DESTINATION "${CURRENT_PACKAGES_DIR}/share/${PORT}")
|
2021-10-28 00:19:28 +02:00
|
|
|
|
2022-11-02 22:39:31 +01:00
|
|
|
vcpkg_install_copyright(
|
|
|
|
FILE_LIST
|
|
|
|
"${SOURCE_PATH}/COPYING"
|
|
|
|
"${SOURCE_PATH}/THIRD_PARTY_NOTICES"
|
|
|
|
"${SOURCE_PATH}/src/libmongoc/THIRD_PARTY_NOTICES"
|
|
|
|
)
|