[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
This commit is contained in:
Luke Sparey 2019-02-08 12:22:37 +13:00 committed by Robert Schumacher
parent cc516fb763
commit 0b79c4bb74
4 changed files with 128 additions and 168 deletions

View File

@ -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.

View File

@ -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

View File

@ -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)
@ -66,59 +66,59 @@ index 4538920..e783ff5 100644
+# 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)

View File

@ -1,86 +1,90 @@
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
REPO mongodb/mongo-cxx-driver
REF r3.1.1
SHA512 ba8a735e5645cbce4497df71a4577e891d507f577dbd5270ec8a82e54c39c2806bf2ff4848b621f18b36d31fb6031e5b4211972b661c43009bff0ed7ab6cf338
REF r${VERSION_FULL}
SHA512 cad8dd6e9fd75aa3aee15321c9b3df21d43c346f5b0b3dd75c86f9117d3376ad83fcda0c4a333c0a23d555e76d79432016623dd5f860ffef9964a6e8046e84b5
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"
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
${CURRENT_PACKAGES_DIR}/debug/include
)
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()
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)