目录
环境
Windows7,cmake,boost,Visual Studio 2019,Python3
源码
MongoDB C库源码
下载地址:https://github.com/mongodb/mongo-c-driver/releases
MongoDB C++库源码
下载地址:https://github.com/mongodb/mongo-cxx-driver/releases
注意:下载release版本,非release版没有版本号,编译时需要指定版本号
进入命令行,开始编译
编译MongoDB C库源码
cmake -S "C:\Users\jincheng.zhou\Downloads\mongo-c-driver-1.16.2" -B "C:\Users\jincheng.zhou\Downloads\mongo-c-driver-1.16.2\build" -G "Visual Studio 16 2019" -A Win32 "-DCMAKE_INSTALL_PREFIX=D:\mongo-c-driver" -DBUILD_VERSION=1.15.3
编译MongoDB C++库源码
cmake -S "C:\Users\jincheng.zhou\Downloads\mongo-cxx-driver-r3.5.0" -B "C:\Users\jincheng.zhou\Downloads\mongo-cxx-driver-r3.5.0\build" -G "Visual Studio 16 2019" -A Win32 "-DCMAKE_INSTALL_PREFIX=D:\mongo-cxx-driver-r3.5" "-DCMAKE_PREFIX_PATH=D:\mongo-c-driver" "-DBOOST_ROOT=D:\ZJCTestProjects\ThirdParty\boost_1_73_0" -DCMAKE_BUILD_TYPE=Release -DBUILD_SHARED_AND_STATIC_LIBS=ON -DBSONCXX_POLY_USE_BOOST=1 -DBUILD_VERSION=3.5.0
注:
cmake
-A
option, to specify a target platform name (architecture). For example:
-
cmake -G "Visual Studio 16 2019" -A Win32
-
cmake -G "Visual Studio 16 2019" -A x64
-
cmake -G "Visual Studio 16 2019" -A ARM
-
cmake -G "Visual Studio 16 2019" -A ARM64