diff options
Diffstat (limited to 'vcpkg/ports/mongo-cxx-driver')
| -rw-r--r-- | vcpkg/ports/mongo-cxx-driver/cmake-project-include.cmake | 4 | ||||
| -rw-r--r-- | vcpkg/ports/mongo-cxx-driver/fix-dependencies.patch | 35 | ||||
| -rw-r--r-- | vcpkg/ports/mongo-cxx-driver/portfile.cmake | 56 | ||||
| -rw-r--r-- | vcpkg/ports/mongo-cxx-driver/usage | 7 | ||||
| -rw-r--r-- | vcpkg/ports/mongo-cxx-driver/vcpkg.json | 19 |
5 files changed, 121 insertions, 0 deletions
diff --git a/vcpkg/ports/mongo-cxx-driver/cmake-project-include.cmake b/vcpkg/ports/mongo-cxx-driver/cmake-project-include.cmake new file mode 100644 index 0000000..4c4f5b0 --- /dev/null +++ b/vcpkg/ports/mongo-cxx-driver/cmake-project-include.cmake @@ -0,0 +1,4 @@ +if(BSONCXX_POLY_USE_STD AND NOT CMAKE_CXX_STANDARD VERSION_GREATER_EQUAL "17") + message(WARNING "Enabling C++17 compiler support.") + set(CMAKE_CXX_STANDARD 17) +endif() diff --git a/vcpkg/ports/mongo-cxx-driver/fix-dependencies.patch b/vcpkg/ports/mongo-cxx-driver/fix-dependencies.patch new file mode 100644 index 0000000..2e6dd14 --- /dev/null +++ b/vcpkg/ports/mongo-cxx-driver/fix-dependencies.patch @@ -0,0 +1,35 @@ +diff --git a/src/bsoncxx/CMakeLists.txt b/src/bsoncxx/CMakeLists.txt +index 1e241f5..adf9a27 100644 +--- a/src/bsoncxx/CMakeLists.txt ++++ b/src/bsoncxx/CMakeLists.txt +@@ -105,7 +105,7 @@ else() + else() + # Require package of old libbson name (with lib). + if(NOT BSONCXX_LINK_WITH_STATIC_MONGOC) +- find_package(libbson-${LIBBSON_REQUIRED_ABI_VERSION} ${LIBBSON_REQUIRED_VERSION} REQUIRED) ++ find_package(libbson-${LIBBSON_REQUIRED_ABI_VERSION} REQUIRED) + message(STATUS "found libbson version ${BSON_VERSION}") + set(libbson_target ${BSON_LIBRARIES}) + set(libbson_include_directories ${BSON_INCLUDE_DIRS}) +diff --git a/src/mongocxx/CMakeLists.txt b/src/mongocxx/CMakeLists.txt +index 4fe323f..2e27410 100644 +--- a/src/mongocxx/CMakeLists.txt ++++ b/src/mongocxx/CMakeLists.txt +@@ -41,7 +41,7 @@ if(TARGET mongoc_shared OR TARGET mongoc_static) + set(MONGOCXX_PKG_DEP "find_dependency(mongoc-${LIBMONGOC_REQUIRED_ABI_VERSION} REQUIRED)") + else() + # Attempt to find libmongoc by new package name (without lib). +- find_package(mongoc-${LIBMONGOC_REQUIRED_ABI_VERSION} ${LIBMONGOC_REQUIRED_VERSION} QUIET) ++ find_package(mongoc-${LIBMONGOC_REQUIRED_ABI_VERSION} CONFIG REQUIRED) + + if(mongoc-${LIBMONGOC_REQUIRED_ABI_VERSION}_FOUND) + message(STATUS "found libmongoc version ${mongoc-${LIBMONGOC_REQUIRED_ABI_VERSION}_VERSION}") +@@ -56,7 +56,7 @@ else() + else() + # Require package of old libmongoc name (with lib). + if(NOT MONGOCXX_LINK_WITH_STATIC_MONGOC) +- find_package(libmongoc-${LIBMONGOC_REQUIRED_ABI_VERSION} ${LIBMONGOC_REQUIRED_VERSION} REQUIRED) ++ find_package(libmongoc-${LIBMONGOC_REQUIRED_ABI_VERSION} REQUIRED) + message(STATUS "found libmongoc version ${MONGOC_VERSION}") + set(libmongoc_target ${MONGOC_LIBRARIES}) + set(libmongoc_definitions ${MONGOC_DEFINITIONS}) diff --git a/vcpkg/ports/mongo-cxx-driver/portfile.cmake b/vcpkg/ports/mongo-cxx-driver/portfile.cmake new file mode 100644 index 0000000..22e2e6f --- /dev/null +++ b/vcpkg/ports/mongo-cxx-driver/portfile.cmake @@ -0,0 +1,56 @@ +vcpkg_from_github(
+ OUT_SOURCE_PATH SOURCE_PATH
+ REPO mongodb/mongo-cxx-driver
+ REF "r${VERSION}"
+ SHA512 7b6564cb5087b03886f3c99aa5da9e87a898b1bd1098393a7668e39d673d6203a39f7fa95e5bef995f5e53c18654ef1806823cf643a994a8c19a1df75b9eb306
+ HEAD_REF master
+ PATCHES
+ fix-dependencies.patch
+)
+
+file(WRITE "${SOURCE_PATH}/build/VERSION_CURRENT" "${VERSION}")
+
+vcpkg_cmake_configure(
+ SOURCE_PATH "${SOURCE_PATH}"
+ OPTIONS
+ "-DCMAKE_PROJECT_MONGO_CXX_DRIVER_INCLUDE=${CMAKE_CURRENT_LIST_DIR}/cmake-project-include.cmake"
+ -DBSONCXX_HEADER_INSTALL_DIR=include
+ -DENABLE_TESTS=OFF
+ -DENABLE_UNINSTALL=OFF
+ -DMONGOCXX_HEADER_INSTALL_DIR=include
+ -DNEED_DOWNLOAD_C_DRIVER=OFF
+ MAYBE_UNUSED_VARIABLES
+ BSONCXX_HEADER_INSTALL_DIR
+ MONGOCXX_HEADER_INSTALL_DIR
+)
+vcpkg_cmake_install()
+vcpkg_copy_pdbs()
+vcpkg_fixup_pkgconfig()
+
+vcpkg_cmake_config_fixup(PACKAGE_NAME "bsoncxx" CONFIG_PATH "lib/cmake/bsoncxx-${VERSION}" DO_NOT_DELETE_PARENT_CONFIG_PATH)
+vcpkg_cmake_config_fixup(PACKAGE_NAME "mongocxx" CONFIG_PATH "lib/cmake/mongocxx-${VERSION}")
+
+file(REMOVE_RECURSE
+ "${CURRENT_PACKAGES_DIR}/debug/include"
+ "${CURRENT_PACKAGES_DIR}/debug/share"
+)
+
+function(auto_clean dir)
+ file(GLOB entries "${dir}/*")
+ file(GLOB files LIST_DIRECTORIES false "${dir}/*")
+ foreach(entry IN LISTS entries)
+ if(entry IN_LIST files)
+ continue()
+ endif()
+ file(GLOB_RECURSE children "${entry}/*")
+ if(children)
+ auto_clean("${entry}")
+ else()
+ file(REMOVE_RECURSE "${entry}")
+ endif()
+ endforeach()
+endfunction()
+auto_clean("${CURRENT_PACKAGES_DIR}/include")
+
+file(INSTALL "${CMAKE_CURRENT_LIST_DIR}/usage" DESTINATION "${CURRENT_PACKAGES_DIR}/share/${PORT}")
+vcpkg_install_copyright(FILE_LIST "${SOURCE_PATH}/LICENSE")
diff --git a/vcpkg/ports/mongo-cxx-driver/usage b/vcpkg/ports/mongo-cxx-driver/usage new file mode 100644 index 0000000..f02fb81 --- /dev/null +++ b/vcpkg/ports/mongo-cxx-driver/usage @@ -0,0 +1,7 @@ +mongo-cxx-driver provides CMake targets: + + find_package(bsoncxx CONFIG REQUIRED) + target_link_libraries(main PRIVATE $<IF:$<TARGET_EXISTS:mongo::bsoncxx_static>,mongo::bsoncxx_static,mongo::bsoncxx_shared>) + + find_package(mongocxx CONFIG REQUIRED) + target_link_libraries(main PRIVATE $<IF:$<TARGET_EXISTS:mongo::mongocxx_static>,mongo::mongocxx_static,mongo::mongocxx_shared>) diff --git a/vcpkg/ports/mongo-cxx-driver/vcpkg.json b/vcpkg/ports/mongo-cxx-driver/vcpkg.json new file mode 100644 index 0000000..54a35e1 --- /dev/null +++ b/vcpkg/ports/mongo-cxx-driver/vcpkg.json @@ -0,0 +1,19 @@ +{ + "name": "mongo-cxx-driver", + "version": "4.0.0", + "description": "MongoDB C++ Driver.", + "homepage": "https://github.com/mongodb/mongo-cxx-driver", + "license": "Apache-2.0", + "dependencies": [ + "libbson", + "mongo-c-driver", + { + "name": "vcpkg-cmake", + "host": true + }, + { + "name": "vcpkg-cmake-config", + "host": true + } + ] +} |