[vcpkg baseline][mongo-c-driver] Fix utf8proc dependency export, cleanup (#40249)

This commit is contained in:
Kai Pastor 2024-08-06 09:35:47 +02:00 committed by GitHub
parent 6214cccba5
commit 78de513e83
No known key found for this signature in database
GPG Key ID: B5690EEEBB952194
8 changed files with 81 additions and 48 deletions

View File

@ -1,3 +1,19 @@
diff --git a/CMakeLists.txt b/CMakeLists.txt
index 1fe4c76..96be699 100644
--- a/CMakeLists.txt
+++ b/CMakeLists.txt
@@ -354,11 +354,9 @@ if (USE_SYSTEM_LIBBSON)
set (USING_SYSTEM_BSON TRUE)
if (NOT TARGET mongo::bson_shared)
- message (FATAL_ERROR "System libbson built without shared library target")
endif ()
set (BSON_LIBRARIES mongo::bson_shared)
if (NOT TARGET mongo::bson_static)
- message (FATAL_ERROR "System libbson built without static library target")
endif ()
set (BSON_STATIC_LIBRARIES mongo::bson_static)
endif ()
diff --git a/src/libmongoc/CMakeLists.txt b/src/libmongoc/CMakeLists.txt
index 74c541f..737e566 100644
--- a/src/libmongoc/CMakeLists.txt

View File

@ -1,33 +1,3 @@
diff --git a/CMakeLists.txt b/CMakeLists.txt
index 1fe4c76..96be699 100644
--- a/CMakeLists.txt
+++ b/CMakeLists.txt
@@ -347,11 +347,9 @@ if (USE_SYSTEM_LIBBSON)
set (USING_SYSTEM_BSON TRUE)
if (NOT TARGET mongo::bson_shared)
- message (FATAL_ERROR "System libbson built without shared library target")
endif ()
set (BSON_LIBRARIES mongo::bson_shared)
if (NOT TARGET mongo::bson_static)
- message (FATAL_ERROR "System libbson built without static library target")
endif ()
set (BSON_STATIC_LIBRARIES mongo::bson_static)
endif ()
diff --git a/build/cmake/libmongoc-1.0-config.cmake.in b/build/cmake/libmongoc-1.0-config.cmake.in
index a068408..d0aeadd 100644
--- a/build/cmake/libmongoc-1.0-config.cmake.in
+++ b/build/cmake/libmongoc-1.0-config.cmake.in
@@ -24,6 +24,9 @@ set (MONGOC_VERSION_FULL @libmongoc_VERSION_FULL@)
include(CMakeFindDependencyMacro)
find_dependency (mongoc-1.0)
+if("@ENABLE_SNAPPY@" STREQUAL "ON")
+ find_dependency(Snappy CONFIG)
+endif()
set(MONGOC_LIBRARY mongo::mongoc_shared)
set(MONGOC_LIBRARIES mongo::mongoc_shared)
diff --git a/build/cmake/libmongoc-static-1.0-config.cmake.in b/build/cmake/libmongoc-static-1.0-config.cmake.in
index bec3163..a32d5f3 100644
--- a/build/cmake/libmongoc-static-1.0-config.cmake.in
@ -43,7 +13,7 @@ index bec3163..a32d5f3 100644
set(MONGOC_STATIC_LIBRARY mongo::mongoc_static)
set(MONGOC_STATIC_LIBRARIES mongo::mongoc_static)
diff --git a/src/libmongoc/CMakeLists.txt b/src/libmongoc/CMakeLists.txt
index 5f553c5..4675313 100644
index 0a18f5a..5346a9d 100644
--- a/src/libmongoc/CMakeLists.txt
+++ b/src/libmongoc/CMakeLists.txt
@@ -50,7 +50,7 @@ endif ()
@ -69,16 +39,60 @@ index 5f553c5..4675313 100644
endif ()
mongo_bool01 (MONGOC_ENABLE_SHM_COUNTERS ENABLE_SHM_COUNTERS)
@@ -759,7 +759,7 @@ set (STATIC_LIBRARIES
)
# utf8proc configuration
-find_package(Utf8Proc REQUIRED)
+find_package(unofficial-utf8proc CONFIG REQUIRED)
set(UTF8PROC_INCLUDE_DIRS, "")
if (USE_BUNDLED_UTF8PROC)
set (
@@ -955,7 +955,7 @@ if (MONGOC_ENABLE_STATIC_BUILD)
set_target_properties (mongoc_static PROPERTIES
VERSION 0.0.0
OUTPUT_NAME "${MONGOC_OUTPUT_BASENAME}-static-${MONGOC_API_VERSION}"
- pkg_config_REQUIRES "libbson-static-1.0"
+ pkg_config_REQUIRES "libbson-static-1.0 libutf8proc"
)
if(MONGOC_ENABLE_STATIC_INSTALL)
mongo_generate_pkg_config (mongoc_static FILENAME libmongoc-static-${MONGOC_API_VERSION}.pc INSTALL)
diff --git a/src/libmongoc/src/mongoc-config.cmake b/src/libmongoc/src/mongoc-config.cmake
index 31e6cbc..365fb5b 100644
index 31e6cbc..cdbb756 100644
--- a/src/libmongoc/src/mongoc-config.cmake
+++ b/src/libmongoc/src/mongoc-config.cmake
@@ -1,5 +1,8 @@
include(CMakeFindDependencyMacro)
find_dependency(bson-1.0 @libmongoc_VERSION@)
+if("@ENABLE_SNAPPY@" STREQUAL "ON")
+if("@ENABLE_SNAPPY@")
+ find_dependency(Snappy CONFIG)
+endif()
# If we need to import a TLS package for our imported targets, do that now:
set(MONGOC_TLS_BACKEND [[@TLS_BACKEND@]])
@@ -13,8 +16,6 @@ if(_tls_package)
set(CMAKE_MODULE_PATH "${_prev_path}")
endif()
-include("${CMAKE_CURRENT_LIST_DIR}/mongoc-targets.cmake")
-
unset(_required)
unset(_quiet)
if(${CMAKE_FIND_PACKAGE_NAME}_FIND_REQUIRED)
@@ -29,9 +30,8 @@ if(NOT _mongoc_built_with_bundled_utf8proc AND NOT TARGET PkgConfig::PC_UTF8PROC
# libmongoc was compiled against an external utf8proc and links against a
# FindPkgConfig-generated IMPORTED target. Find that package and generate that
# imported target here:
- find_dependency(PkgConfig)
- pkg_check_modules(PC_UTF8PROC ${_required} ${_quiet} libutf8proc IMPORTED_TARGET GLOBAL)
endif()
+find_dependency(unofficial-utf8proc CONFIG)
# Find dependencies for SASL
set(_sasl_backend [[@SASL_BACKEND@]])
@@ -43,3 +43,5 @@ if(_sasl_backend STREQUAL "Cyrus")
find_dependency(SASL2 2.0)
set(CMAKE_MODULE_PATH "${_prev_path}")
endif()
+
+include("${CMAKE_CURRENT_LIST_DIR}/mongoc-targets.cmake")

View File

@ -1,5 +0,0 @@
include(CMakeFindDependencyMacro)
find_dependency(libmongoc-static-1.0 ${${CMAKE_FIND_PACKAGE_NAME}_FIND_VERSION} CONFIG)
set(MONGOC_DEFINITIONS "${MONGOC_STATIC_DEFINITIONS}")
set(MONGOC_INCLUDE_DIRS "${MONGOC_STATIC_INCLUDE_DIRS}")
set(MONGOC_LIBRARIES "${MONGOC_STATIC_LIBRARIES}")

View File

@ -12,6 +12,9 @@ vcpkg_from_github(
fix-mingw.patch
)
file(WRITE "${SOURCE_PATH}/VERSION_CURRENT" "${VERSION}")
file(TOUCH "${SOURCE_PATH}/src/utf8proc-editable")
file(GLOB vendored_libs "${SOURCE_PATH}/src/utf8proc-*" "${SOURCE_PATH}/src/zlib-*/*.h")
file(REMOVE_RECURSE ${vendored_libs})
# Cannot use string(COMPARE EQUAL ...)
set(ENABLE_STATIC OFF)
@ -74,16 +77,16 @@ if("snappy" IN_LIST FEATURES AND VCPKG_LIBRARY_LINKAGE STREQUAL "static")
endif()
vcpkg_fixup_pkgconfig()
vcpkg_cmake_config_fixup(PACKAGE_NAME mongoc-1.0 CONFIG_PATH "lib/cmake/mongoc-1.0" DO_NOT_DELETE_PARENT_CONFIG_PATH)
# deprecated
vcpkg_cmake_config_fixup(PACKAGE_NAME libmongoc-1.0 CONFIG_PATH "lib/cmake/libmongoc-1.0" DO_NOT_DELETE_PARENT_CONFIG_PATH)
if(VCPKG_LIBRARY_LINKAGE STREQUAL "static")
vcpkg_cmake_config_fixup(PACKAGE_NAME libmongoc-static-1.0 CONFIG_PATH "lib/cmake/libmongoc-static-1.0" DO_NOT_DELETE_PARENT_CONFIG_PATH)
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")
else()
vcpkg_cmake_config_fixup(PACKAGE_NAME libmongoc-1.0 CONFIG_PATH "lib/cmake/libmongoc-1.0")
vcpkg_replace_string("${CURRENT_PACKAGES_DIR}/share/libmongoc-1.0/libmongoc-1.0-config.cmake" "mongoc_shared" "mongoc_static")
endif()
# recommended
vcpkg_cmake_config_fixup(PACKAGE_NAME mongoc-1.0 CONFIG_PATH "lib/cmake/mongoc-1.0")
file(REMOVE_RECURSE
"${CURRENT_PACKAGES_DIR}/debug/include"

View File

@ -1,4 +1,4 @@
mongo-c-driver provides CMake targets:
find_package(mongoc-1.0 CONFIG REQUIRED)
target_link_libraries(main PRIVATE $<IF:$<TARGET_EXISTS:mongo::mongoc_shared>,mongo::mongoc_shared,mongo::mongoc_static>)
find_package(mongoc-1.0 CONFIG REQUIRED)
target_link_libraries(main PRIVATE $<IF:$<TARGET_EXISTS:mongo::mongoc_shared>,mongo::mongoc_shared,mongo::mongoc_static>)

View File

@ -1,7 +1,7 @@
{
"name": "mongo-c-driver",
"version": "1.27.4",
"port-version": 1,
"port-version": 2,
"description": "Client library written in C for MongoDB.",
"homepage": "https://github.com/mongodb/mongo-c-driver",
"license": null,

View File

@ -5906,7 +5906,7 @@
},
"mongo-c-driver": {
"baseline": "1.27.4",
"port-version": 1
"port-version": 2
},
"mongo-cxx-driver": {
"baseline": "3.10.2",

View File

@ -1,5 +1,10 @@
{
"versions": [
{
"git-tree": "5feb5bb8f584c01633e780733ffa72f03066a45e",
"version": "1.27.4",
"port-version": 2
},
{
"git-tree": "e0d49789eb2474ec5c4a4bf3b1d54f16805e997d",
"version": "1.27.4",