Compiling MongoDB CXX Driver - 3drepo/3drepobouncer GitHub Wiki

Sources and instructions to build the Mongo CXX Driver are available from Mongo here:

https://www.mongodb.com/docs/languages/cpp/cpp-driver/current/get-started/download-and-install/

The Mongo CXX depends on the Mongo C driver at runtime. Bouncer only needs to link with the Mongo CXX Driver. The build scripts from Mongo will download and build the Mongo C driver if a path to it is not provided.

The build instructions from Mongo can be used directly, though some options to consider for Windows are described below.

Prebuilt Binaries

Windows

The instructions to build the driver on Windows from Mongo are here:

https://www.mongodb.com/developer/products/mongodb/getting-started-mongodb-cpp/ https://www.mongodb.com/docs/languages/cpp/cpp-driver/current/installation/windows/#std-label-cpp-installation-windows

The versions used are mongoc 1.19 and mongocxx 3.11.

When building on Windows, the following instructions summarise how to build with a specific version of Boost and specific generator. While Mongo CXX will download all its dependencies itself, it may be preferred to use some of bouncers existing dependencies to avoid duplicates of shared libraries.

Download the mongoc driver and extract to where the bouncer libraries should live.

Create two directories, _build & install, and enter _build.

Configure the build like so:

cmake -G "Visual Studio 16 2019" -A x64 -S .. -B . -DCMAKE_INSTALL_PREFIX=D:\3drepo\bouncer\mongo-c-driver-1.29.0\install

Set the Configuration to RelWithDebugInfo and Build All and INSTALL

Download the mongocxx driver and extract to where the bouncer libraries should live

Create two directories, _build & install, and enter _build.

Configure the build like so:

cmake -G "Visual Studio 16 2019" -A x64 -S .. -B . -DCMAKE_INSTALL_PREFIX=D:\3drepo\bouncer\mongo-cxx-driver-r3.11.0\install -DCMAKE_CXX_STANDARD=20 -DCMAKE_PREFIX_PATH=D:\3drepo\bouncer\mongo-c-driver-1.29.0\install -DBOOST_ROOT=D:\3drepo\bouncer\boost_1_86_0

Give the following commands:

cmake --build . --config RelWithDebInfo cmake --build . --target install --config RelWithDebInfo

Note the following about the above:

The Boost version must be the same as used to build bouncer (or, two sets of Boost libraries will need to be accessible on the Path) The same version of Visual Studio used to build bouncer should be specified as the generator. When building and running bouncer:

The MONGO_CXX_DRIVER_ROOT CMake variable must point to the CXX driver install directory. CMake for bouncer does not need the C driver. When running bouncer, both the C and CXX shared libraries must be available on the Path.

Finally, 3drepoSynchroReader 4.0.2 still relies on Boost 1.59 vc140, so unless this has been rebuilt, those older Boost libraries must still be available.