From 0b79c4bb74aa1a1908c23edb3ca07b5e6dd39141 Mon Sep 17 00:00:00 2001 From: Luke Sparey <44617984+lsparey@users.noreply.github.com> Date: Fri, 8 Feb 2019 12:22:37 +1300 Subject: [PATCH] [mongo-cxx-driver] Update to 3.2.0 and add cmake targets (#5178) * [mongo-cxx-driver] Update to 3.2.0 and add cmake targets * [mongo-cxx-driver] Replace cmake config files to support debug binaries --- ports/mongo-cxx-driver/CONTROL | 2 +- ports/mongo-cxx-driver/disable_shared.patch | 46 ------ .../disable_test_and_example.patch | 132 +++++++++--------- ports/mongo-cxx-driver/portfile.cmake | 116 +++++++-------- 4 files changed, 128 insertions(+), 168 deletions(-) delete mode 100644 ports/mongo-cxx-driver/disable_shared.patch diff --git a/ports/mongo-cxx-driver/CONTROL b/ports/mongo-cxx-driver/CONTROL index 08de8ddec1..3a8e6108fb 100644 --- a/ports/mongo-cxx-driver/CONTROL +++ b/ports/mongo-cxx-driver/CONTROL @@ -1,4 +1,4 @@ Source: mongo-cxx-driver -Version: 3.1.1-3 +Version: 3.2.0-1 Build-Depends: libbson, mongo-c-driver, boost-smart-ptr, boost-optional, boost-utility Description: MongoDB C++ Driver. diff --git a/ports/mongo-cxx-driver/disable_shared.patch b/ports/mongo-cxx-driver/disable_shared.patch deleted file mode 100644 index 5f2f9a04e0..0000000000 --- a/ports/mongo-cxx-driver/disable_shared.patch +++ /dev/null @@ -1,46 +0,0 @@ -diff --git a/src/bsoncxx/CMakeLists.txt b/src/bsoncxx/CMakeLists.txt -index a9a7ada..6b87a6d 100644 ---- a/src/bsoncxx/CMakeLists.txt -+++ b/src/bsoncxx/CMakeLists.txt -@@ -117,9 +117,15 @@ if (WIN32) - ) - endif() - --add_library(bsoncxx SHARED -- ${bsoncxx_sources} --) -+if(BUILD_SHARED_LIBS) -+ add_library(bsoncxx SHARED -+ ${bsoncxx_sources} -+ ) -+else() -+ add_library(bsoncxx SHARED -+ exception/error_code.cpp -+ ) -+endif() - - set(bsoncxx_libs ${LIBBSON_LIBRARIES}) - -diff --git a/src/mongocxx/CMakeLists.txt b/src/mongocxx/CMakeLists.txt -index 2ef54e4..53a13f7 100644 ---- a/src/mongocxx/CMakeLists.txt -+++ b/src/mongocxx/CMakeLists.txt -@@ -134,9 +134,15 @@ set_target_properties(mongocxx_mocked PROPERTIES - VERSION ${MONGOCXX_VERSION} - ) - --add_library(mongocxx SHARED -- ${mongocxx_sources} --) -+if(BUILD_SHARED_LIBS) -+ add_library(mongocxx SHARED -+ ${mongocxx_sources} -+ ) -+else() -+ add_library(mongocxx SHARED -+ exception/error_code.cpp -+ ) -+endif() - - set_target_properties (mongocxx PROPERTIES - OUTPUT_NAME mongocxx diff --git a/ports/mongo-cxx-driver/disable_test_and_example.patch b/ports/mongo-cxx-driver/disable_test_and_example.patch index d542628f75..734f52f263 100644 --- a/ports/mongo-cxx-driver/disable_test_and_example.patch +++ b/ports/mongo-cxx-driver/disable_test_and_example.patch @@ -1,8 +1,8 @@ diff --git a/CMakeLists.txt b/CMakeLists.txt -index 4538920..e783ff5 100644 +index 27cf3b6b8..896eee19a 100644 --- a/CMakeLists.txt +++ b/CMakeLists.txt -@@ -74,66 +74,66 @@ endif() +@@ -87,68 +87,68 @@ endif() set(CMAKE_EXPORT_COMPILE_COMMANDS ON) @@ -63,63 +63,63 @@ index 4538920..e783ff5 100644 -) - -set(THIRD_PARTY_SOURCE_DIR ${CMAKE_CURRENT_SOURCE_DIR}/src/third_party) -+#add_custom_target(hugo_dir -+# COMMAND ${CMAKE_COMMAND} -E make_directory hugo -+#) -+# -+#add_custom_target(hugo -+# DEPENDS hugo_dir -+# WORKING_DIRECTORY ${CMAKE_CURRENT_SOURCE_DIR}/docs -+# COMMAND hugo -+# VERBATIM -+#) -+# -+#add_custom_target(hugo-deploy -+# DEPENDS hugo -+# WORKING_DIRECTORY ${CMAKE_CURRENT_SOURCE_DIR} -+# COMMAND etc/deploy-to-ghpages.pl --hugo git@github.com:mongodb/mongo-cxx-driver -+# VERBATIM -+#) -+# -+#add_custom_target(docs_dir_current -+# COMMAND ${CMAKE_COMMAND} -E make_directory docs/api/current -+#) -+# -+#add_custom_target(doxygen-current -+# DEPENDS docs_dir_current -+# WORKING_DIRECTORY ${CMAKE_CURRENT_SOURCE_DIR} -+# COMMAND doxygen ${CMAKE_CURRENT_SOURCE_DIR}/Doxyfile -+# VERBATIM -+#) -+# -+#add_custom_target(doxygen-all -+# WORKING_DIRECTORY ${CMAKE_CURRENT_SOURCE_DIR} -+# COMMAND etc/generate-all-apidocs.pl -+# VERBATIM -+#) -+# -+#add_custom_target(doxygen-deploy -+# DEPENDS doxygen-all -+# WORKING_DIRECTORY ${CMAKE_CURRENT_SOURCE_DIR} -+# COMMAND etc/deploy-to-ghpages.pl --doxygen git@github.com:mongodb/mongo-cxx-driver -+# VERBATIM -+#) -+# -+#add_custom_target(format -+# python ${CMAKE_SOURCE_DIR}/etc/clang_format.py format -+# VERBATIM -+#) -+# -+#add_custom_target(format-lint -+# python ${CMAKE_SOURCE_DIR}/etc/clang_format.py lint -+# VERBATIM -+#) -+# -+#add_custom_target(docs -+# DEPENDS hugo doxygen-current -+#) -+# -+#set(THIRD_PARTY_SOURCE_DIR ${CMAKE_CURRENT_SOURCE_DIR}/src/third_party) ++# add_custom_target(hugo_dir ++# COMMAND ${CMAKE_COMMAND} -E make_directory hugo ++# ) ++ ++# add_custom_target(hugo ++# DEPENDS hugo_dir ++# WORKING_DIRECTORY ${CMAKE_CURRENT_SOURCE_DIR}/docs ++# COMMAND hugo ++# VERBATIM ++# ) ++ ++# add_custom_target(hugo-deploy ++# DEPENDS hugo ++# WORKING_DIRECTORY ${CMAKE_CURRENT_SOURCE_DIR} ++# COMMAND etc/deploy-to-ghpages.pl --hugo git@github.com:mongodb/mongo-cxx-driver ++# VERBATIM ++# ) ++ ++# add_custom_target(docs_dir_current ++# COMMAND ${CMAKE_COMMAND} -E make_directory docs/api/current ++# ) ++ ++# add_custom_target(doxygen-current ++# DEPENDS docs_dir_current ++# WORKING_DIRECTORY ${CMAKE_CURRENT_SOURCE_DIR} ++# COMMAND doxygen ${CMAKE_CURRENT_SOURCE_DIR}/Doxyfile ++# VERBATIM ++# ) ++ ++# add_custom_target(doxygen-all ++# WORKING_DIRECTORY ${CMAKE_CURRENT_SOURCE_DIR} ++# COMMAND etc/generate-all-apidocs.pl ++# VERBATIM ++# ) ++ ++# add_custom_target(doxygen-deploy ++# DEPENDS doxygen-all ++# WORKING_DIRECTORY ${CMAKE_CURRENT_SOURCE_DIR} ++# COMMAND etc/deploy-to-ghpages.pl --doxygen git@github.com:mongodb/mongo-cxx-driver ++# VERBATIM ++# ) ++ ++# add_custom_target(format ++# python ${CMAKE_SOURCE_DIR}/etc/clang_format.py format ++# VERBATIM ++# ) ++ ++# add_custom_target(format-lint ++# python ${CMAKE_SOURCE_DIR}/etc/clang_format.py lint ++# VERBATIM ++# ) ++ ++# add_custom_target(docs ++# DEPENDS hugo doxygen-current ++# ) ++ ++# set(THIRD_PARTY_SOURCE_DIR ${CMAKE_CURRENT_SOURCE_DIR}/src/third_party) enable_testing() @@ -127,22 +127,24 @@ index 4538920..e783ff5 100644 -add_subdirectory(examples EXCLUDE_FROM_ALL) +#add_subdirectory(examples EXCLUDE_FROM_ALL) + + add_subdirectory(benchmark EXCLUDE_FROM_ALL) diff --git a/src/bsoncxx/CMakeLists.txt b/src/bsoncxx/CMakeLists.txt -index 010f5e4..a9a7ada 100644 +index bd6e40662..d6054b022 100644 --- a/src/bsoncxx/CMakeLists.txt +++ b/src/bsoncxx/CMakeLists.txt -@@ -202,4 +202,4 @@ install( - DESTINATION lib/cmake/libbsoncxx-${BSONCXX_VERSION} +@@ -249,4 +249,4 @@ install( + DESTINATION lib/cmake/${PKG}-${BSONCXX_VERSION} ) -add_subdirectory(test) +#add_subdirectory(test) diff --git a/src/mongocxx/CMakeLists.txt b/src/mongocxx/CMakeLists.txt -index 12d188b..2ef54e4 100644 +index a05021228..3dd7c1224 100644 --- a/src/mongocxx/CMakeLists.txt +++ b/src/mongocxx/CMakeLists.txt -@@ -209,4 +209,4 @@ install( - DESTINATION lib/cmake/libmongocxx-${MONGOCXX_VERSION} +@@ -238,4 +238,4 @@ install( + DESTINATION lib/cmake/${PKG}-${MONGOCXX_VERSION} ) -add_subdirectory(test) diff --git a/ports/mongo-cxx-driver/portfile.cmake b/ports/mongo-cxx-driver/portfile.cmake index b80c8a5bf3..69ac66b040 100644 --- a/ports/mongo-cxx-driver/portfile.cmake +++ b/ports/mongo-cxx-driver/portfile.cmake @@ -1,88 +1,92 @@ include(vcpkg_common_functions) + +set(VERSION_MAJOR 3) +set(VERSION_MINOR 2) +set(VERSION_PATCH 0) +set(VERSION_FULL ${VERSION_MAJOR}.${VERSION_MINOR}.${VERSION_PATCH}) + vcpkg_from_github( - OUT_SOURCE_PATH SOURCE_PATH + OUT_SOURCE_PATH SOURCE_PATH REPO mongodb/mongo-cxx-driver - REF r3.1.1 - SHA512 ba8a735e5645cbce4497df71a4577e891d507f577dbd5270ec8a82e54c39c2806bf2ff4848b621f18b36d31fb6031e5b4211972b661c43009bff0ed7ab6cf338 - HEAD_REF master - PATCHES - "${CURRENT_PORT_DIR}/disable_test_and_example.patch" - "${CURRENT_PORT_DIR}/disable_shared.patch" - "${CURRENT_PORT_DIR}/fix-uwp.patch" - "${CURRENT_PORT_DIR}/disable-c2338-mongo-cxx-driver.patch" + REF r${VERSION_FULL} + SHA512 cad8dd6e9fd75aa3aee15321c9b3df21d43c346f5b0b3dd75c86f9117d3376ad83fcda0c4a333c0a23d555e76d79432016623dd5f860ffef9964a6e8046e84b5 + HEAD_REF master + PATCHES + disable_test_and_example.patch + fix-uwp.patch + disable-c2338-mongo-cxx-driver.patch ) vcpkg_configure_cmake( SOURCE_PATH ${SOURCE_PATH} + PREFER_NINJA OPTIONS -DLIBBSON_DIR=${CURRENT_INSTALLED_DIR} -DLIBMONGOC_DIR=${CURRENT_INSTALLED_DIR} + -DMONGOCXX_HEADER_INSTALL_DIR=include + -DBSONCXX_HEADER_INSTALL_DIR=include ) vcpkg_install_cmake() -file(RENAME - ${CURRENT_PACKAGES_DIR}/include/bsoncxx/v_noabi/bsoncxx - ${CURRENT_PACKAGES_DIR}/temp) -file(REMOVE_RECURSE ${CURRENT_PACKAGES_DIR}/include/bsoncxx) -file(RENAME ${CURRENT_PACKAGES_DIR}/temp ${CURRENT_PACKAGES_DIR}/include/bsoncxx) +file(WRITE ${CURRENT_PACKAGES_DIR}/share/libbsoncxx/libbsoncxx-config.cmake +" +set(LIBBSONCXX_VERSION_MAJOR ${VERSION_MAJOR}) +set(LIBBSONCXX_VERSION_MINOR ${VERSION_MINOR}) +set(LIBBSONCXX_VERSION_PATCH ${VERSION_PATCH}) +set(LIBBSONCXX_PACKAGE_VERSION ${VERSION_FULL}) -file(RENAME - ${CURRENT_PACKAGES_DIR}/include/mongocxx/v_noabi/mongocxx - ${CURRENT_PACKAGES_DIR}/temp) -file(REMOVE_RECURSE ${CURRENT_PACKAGES_DIR}/include/mongocxx) -file(RENAME ${CURRENT_PACKAGES_DIR}/temp ${CURRENT_PACKAGES_DIR}/include/mongocxx) +get_filename_component(PACKAGE_PREFIX_DIR \"\${CMAKE_CURRENT_LIST_DIR}/../../\" ABSOLUTE) + +set(LIBBSONCXX_INCLUDE_DIRS \"\${PACKAGE_PREFIX_DIR}/include\") +find_library(LIBBSONCXX_LIBRARY_PATH_RELEASE bsoncxx bsoncxx-static PATHS \"\${PACKAGE_PREFIX_DIR}/lib\" NO_DEFAULT_PATH) +find_library(LIBBSONCXX_LIBRARY_PATH_DEBUG bsoncxx bsoncxx-static PATHS \"\${PACKAGE_PREFIX_DIR}/debug/lib\" NO_DEFAULT_PATH) +set(LIBBSONCXX_LIBRARIES optimized \${LIBBSONCXX_LIBRARY_PATH_RELEASE} debug \${LIBBSONCXX_LIBRARY_PATH_DEBUG}) +" +) +file(WRITE ${CURRENT_PACKAGES_DIR}/share/libmongocxx/libmongocxx-config.cmake +" +set(LIBMONGOCXX_VERSION_MAJOR ${VERSION_MAJOR}) +set(LIBMONGOCXX_VERSION_MINOR ${VERSION_MINOR}) +set(LIBMONGOCXX_VERSION_PATCH ${VERSION_PATCH}) +set(LIBMONGOCXX_PACKAGE_VERSION ${VERSION_FULL}) + +include(CMakeFindDependencyMacro) + +find_dependency(libbsoncxx) + +get_filename_component(PACKAGE_PREFIX_DIR \"\${CMAKE_CURRENT_LIST_DIR}/../../\" ABSOLUTE) + +set(LIBMONGOCXX_INCLUDE_DIRS \"\${PACKAGE_PREFIX_DIR}/include\" \${LIBBSONCXX_INCLUDE_DIRS}) +find_library(LIBMONGOCXX_LIBRARY_PATH_RELEASE NAMES mongocxx mongocxx-static PATHS \"\${PACKAGE_PREFIX_DIR}/lib\" NO_DEFAULT_PATH) +find_library(LIBMONGOCXX_LIBRARY_PATH_DEBUG NAMES mongocxx mongocxx-static PATHS \"\${PACKAGE_PREFIX_DIR}/debug/lib\" NO_DEFAULT_PATH) +set(LIBMONGOCXX_LIBRARIES optimized \${LIBMONGOCXX_LIBRARY_PATH_RELEASE} debug \${LIBMONGOCXX_LIBRARY_PATH_DEBUG} \${LIBBSONCXX_LIBRARIES}) +" +) + +file(REMOVE_RECURSE ${CURRENT_PACKAGES_DIR}/lib/cmake ${CURRENT_PACKAGES_DIR}/debug/lib/cmake) file(REMOVE_RECURSE - ${CURRENT_PACKAGES_DIR}/lib/cmake - ${CURRENT_PACKAGES_DIR}/debug/lib/cmake - ${CURRENT_PACKAGES_DIR}/include/bsoncxx/cmake ${CURRENT_PACKAGES_DIR}/include/bsoncxx/config/private ${CURRENT_PACKAGES_DIR}/include/bsoncxx/private ${CURRENT_PACKAGES_DIR}/include/bsoncxx/test + ${CURRENT_PACKAGES_DIR}/include/bsoncxx/test_util ${CURRENT_PACKAGES_DIR}/include/bsoncxx/third_party ${CURRENT_PACKAGES_DIR}/include/mongocxx/cmake ${CURRENT_PACKAGES_DIR}/include/mongocxx/config/private - ${CURRENT_PACKAGES_DIR}/include/mongocxx/test - ${CURRENT_PACKAGES_DIR}/include/mongocxx/test_util - ${CURRENT_PACKAGES_DIR}/include/mongocxx/private ${CURRENT_PACKAGES_DIR}/include/mongocxx/exception/private ${CURRENT_PACKAGES_DIR}/include/mongocxx/options/private + ${CURRENT_PACKAGES_DIR}/include/mongocxx/gridfs/private + ${CURRENT_PACKAGES_DIR}/include/mongocxx/private + ${CURRENT_PACKAGES_DIR}/include/mongocxx/test + ${CURRENT_PACKAGES_DIR}/include/mongocxx/test_util - ${CURRENT_PACKAGES_DIR}/debug/include) - - -if (VCPKG_LIBRARY_LINKAGE STREQUAL static) - file(REMOVE_RECURSE ${CURRENT_PACKAGES_DIR}/bin) - file(REMOVE_RECURSE ${CURRENT_PACKAGES_DIR}/debug/bin) - file(REMOVE ${CURRENT_PACKAGES_DIR}/lib/bsoncxx.lib) - file(REMOVE ${CURRENT_PACKAGES_DIR}/debug/lib/bsoncxx.lib) - file(REMOVE ${CURRENT_PACKAGES_DIR}/lib/mongocxx.lib) - file(REMOVE ${CURRENT_PACKAGES_DIR}/debug/lib/mongocxx.lib) - - file(RENAME - ${CURRENT_PACKAGES_DIR}/lib/libbsoncxx.lib - ${CURRENT_PACKAGES_DIR}/lib/bsoncxx.lib) - file(RENAME - ${CURRENT_PACKAGES_DIR}/debug/lib/libmongocxx.lib - ${CURRENT_PACKAGES_DIR}/debug/lib/mongocxx.lib) - - # define MONGOCXX_STATIC in config/export.hpp - vcpkg_apply_patches( - SOURCE_PATH ${CURRENT_PACKAGES_DIR}/include - PATCHES - ${CMAKE_CURRENT_LIST_DIR}/static.patch - ) -else() - file(REMOVE ${CURRENT_PACKAGES_DIR}/lib/libbsoncxx.lib) - file(REMOVE ${CURRENT_PACKAGES_DIR}/debug/lib/libbsoncxx.lib) - file(REMOVE ${CURRENT_PACKAGES_DIR}/lib/libmongocxx.lib) - file(REMOVE ${CURRENT_PACKAGES_DIR}/debug/lib/libmongocxx.lib) -endif() + ${CURRENT_PACKAGES_DIR}/debug/include +) file(INSTALL ${SOURCE_PATH}/LICENSE DESTINATION ${CURRENT_PACKAGES_DIR}/share/mongo-cxx-driver RENAME copyright) file(COPY ${SOURCE_PATH}/THIRD-PARTY-NOTICES DESTINATION ${CURRENT_PACKAGES_DIR}/share/mongo-cxx-driver) -vcpkg_copy_pdbs() \ No newline at end of file +vcpkg_copy_pdbs()