Skip to content

Conversation

@kevinAlbs
Copy link
Contributor

@kevinAlbs kevinAlbs commented Jan 18, 2023

Summary

  • add LIBMONGOCRYPT_BUILD_TYPE option to make CMAKE_BUILD_TYPE configurable.

Background & Motivation

This is motivated by updating libmongocrypt to support decimal128 Range Index CDRIVER-4394.

The C driver currently builds libmongocrypt by invoking cmake directly in compile-unix.sh and compile-windows.sh. Here is the snippet from compile-windows.sh:

   git clone --depth=1 https://github.com/mongodb/libmongocrypt --branch 1.7.0-alpha1
   mkdir libmongocrypt/cmake-build
   cd libmongocrypt/cmake-build
   "$CMAKE" -G "$CC" "-DCMAKE_PREFIX_PATH=${INSTALL_DIR}/lib/cmake" -DENABLE_SHARED_BSON=ON -DCMAKE_INSTALL_PREFIX="$INSTALL_DIR" ../
   "$CMAKE" --build . --target INSTALL --config $BUILD_CONFIG -- $BUILD_FLAGS
   cd ../../

#522 (comment) notes the required version of cmake to build libmongocrypt is cmake will soon be 3.12.0. The C driver builds with older versions of cmake in some distros. libmongocrypt's ensure-cmake.sh script ensures the presence of a CMake executable matching a specific version. Therefore, the C driver will transition to building libmongocrypt using the compile.sh script (as is currently done in the Go driver). Here is a proposed change in compile-windows.sh

   git clone https://github.com/kevinAlbs/libmongocrypt --branch decimal128_with_BUILD_CONFIG
   MONGOCRYPT_INSTALL_PREFIX=$INSTALL_DIR \
   DEFAULT_BUILD_ONLY=true \
   LIBMONGOCRYPT_EXTRA_CMAKE_FLAGS="-DBUILD_VERSION=1.7.0-pre" \
   LIBMONGOCRYPT_BUILD_TYPE=$BUILD_CONFIG \
      ./libmongocrypt/.evergreen/compile.sh

Adding the LIBMONGOCRYPT_BUILD_TYPE option enables the C driver to continue building libmongocrypt with the same CMAKE_BUILD_TYPE as the C driver.

This enables the C driver to build with the same CMAKE_BUILD_TYPE as the C driver.

On Windows, a matching build type may be required. Mixing debug / release versions of the CRT may be problematic.
@kevinAlbs kevinAlbs changed the title make CMAKE_BUILD_TYPE configurable. MONGOCRYPT-483 make CMAKE_BUILD_TYPE configurable. Jan 18, 2023
@kevinAlbs kevinAlbs marked this pull request as ready for review January 18, 2023 14:26
@kevinAlbs kevinAlbs merged commit db648b0 into mongodb:master Jan 20, 2023
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

2 participants