From 5b5f46f90f16cf2769b34edd6ae3d08302b439a1 Mon Sep 17 00:00:00 2001 From: fasiondog Date: Sun, 30 Jan 2022 21:52:04 +0800 Subject: [PATCH] update mongo-c-driver; add mongo-cxx-driver (#963) --- packages/m/mongo-c-driver/xmake.lua | 1 + packages/m/mongo-cxx-driver/xmake.lua | 38 +++++++++++++++++++++++++++ 2 files changed, 39 insertions(+) create mode 100644 packages/m/mongo-cxx-driver/xmake.lua diff --git a/packages/m/mongo-c-driver/xmake.lua b/packages/m/mongo-c-driver/xmake.lua index ee3a82403..62be6c113 100644 --- a/packages/m/mongo-c-driver/xmake.lua +++ b/packages/m/mongo-c-driver/xmake.lua @@ -6,6 +6,7 @@ package("mongo-c-driver") add_urls("https://github.com/mongodb/mongo-c-driver/archive/$(version).zip", "https://github.com/mongodb/mongo-c-driver.git") + add_versions("1.20.1", "3a856e1c40b02fc5160cb7b39594d654f3076eeb671829b867971e7d35ed497c") add_versions("1.19.0", "3e545964ee82ee60afe4213852208e6174297b19d6b837eca3c711af34a4b107") add_deps("cmake") diff --git a/packages/m/mongo-cxx-driver/xmake.lua b/packages/m/mongo-cxx-driver/xmake.lua new file mode 100644 index 000000000..182903ca4 --- /dev/null +++ b/packages/m/mongo-cxx-driver/xmake.lua @@ -0,0 +1,38 @@ +package("mongo-cxx-driver") + + set_homepage("https://github.com/mongodb/mongo-cxx-driver") + set_description("mongodb c++ driver") + + add_urls("https://github.com/mongodb/mongo-cxx-driver/archive/r$(version).zip") + add_versions("3.6.6", "4413de483c5070b48dc5b5c8ee3e32c8e7a2b74b892fe2a55ef78fb758bc01e0") + + add_deps("cmake") + add_deps("mongo-c-driver") + if is_plat("windows") then + add_deps("boost") + end + + add_configs("shared", {description = "Build shared library.", default = true, type = "boolean", readonly = true}) + + add_includedirs("include/bsoncxx/v_noabi") + add_includedirs("include/mongocxx/v_noabi") + + on_install("windows", "macosx", "linux", function (package) + local configs = { + "-DBUILD_SHARED_AND_STATIC_LIBS=OFF", + "-DBUILD_SHARED_LIBS=ON", + "-DENABLE_TESTS=OFF"} + table.insert(configs, "-DCMAKE_BUILD_TYPE=" .. (package:debug() and "Debug" or "Release")) + if package:version() then + table.insert(configs, "-DBUILD_VERSION=" .. package:version()) + end + io.replace("CMakeLists.txt", "add_subdirectory(examples EXCLUDE_FROM_ALL)", "", {plain = true}) + io.replace("CMakeLists.txt", "add_subdirectory(benchmark EXCLUDE_FROM_ALL)", "", {plain = true}) + io.replace("CMakeLists.txt", "add_subdirectory (docs)", "", {plain = true}) + import("package.tools.cmake").install(package, configs, {cmake_build = true, config = (package:debug() and "Debug" or "Release")}) + end) + + on_test(function (package) + assert(package:has_cxxfuncs("mongocxx::instance{nullptr}", + {configs = {languages = "c++14"}, includes = "mongocxx/instance.hpp"})) + end)