From a91554237552d9426b6ec4eb1a875879c52820a6 Mon Sep 17 00:00:00 2001 From: Kevin Albertson Date: Tue, 17 Jan 2023 10:53:22 -0500 Subject: [PATCH 1/2] make CMAKE_BUILD_TYPE configurable 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. --- .evergreen/build_all.sh | 21 +++++++++++---------- 1 file changed, 11 insertions(+), 10 deletions(-) diff --git a/.evergreen/build_all.sh b/.evergreen/build_all.sh index 1621b8891..660f2caa9 100755 --- a/.evergreen/build_all.sh +++ b/.evergreen/build_all.sh @@ -13,6 +13,7 @@ echo "Begin compile process" _cxxflags="" : "${CONFIGURE_ONLY:=}" +: "${LIBMONGOCRYPT_BUILD_TYPE:=RelWithDebInfo}" if [ "$OS_NAME" = "windows" ]; then # Enable exception handling for MSVC @@ -56,7 +57,7 @@ common_cmake_args=( -DCMAKE_C_FLAGS="$LIBMONGOCRYPT_EXTRA_CFLAGS" -DCMAKE_CXX_FLAGS="$LIBMONGOCRYPT_EXTRA_CFLAGS $_cxxflags" -DCMAKE_EXPORT_COMPILE_COMMANDS=ON - -DCMAKE_BUILD_TYPE=RelWithDebInfo + -DCMAKE_BUILD_TYPE="$LIBMONGOCRYPT_BUILD_TYPE" -H"$LIBMONGOCRYPT_DIR" -B"$build_dir" ) @@ -81,10 +82,10 @@ if [ "$CONFIGURE_ONLY" ]; then exit 0; fi echo "Installing libmongocrypt" -run_cmake --build "$build_dir" --target install --config RelWithDebInfo -run_cmake --build "$build_dir" --target test-mongocrypt --config RelWithDebInfo -run_cmake --build "$build_dir" --target test_kms_request --config RelWithDebInfo -run_chdir "$build_dir" run_ctest -C RelWithDebInfo +run_cmake --build "$build_dir" --target install --config "$LIBMONGOCRYPT_BUILD_TYPE" +run_cmake --build "$build_dir" --target test-mongocrypt --config "$LIBMONGOCRYPT_BUILD_TYPE" +run_cmake --build "$build_dir" --target test_kms_request --config "$LIBMONGOCRYPT_BUILD_TYPE" +run_chdir "$build_dir" run_ctest -C "$LIBMONGOCRYPT_BUILD_TYPE" # MONGOCRYPT-372, ensure macOS universal builds contain both x86_64 and arm64 architectures. if [ "$MACOS_UNIVERSAL" = "ON" ]; then @@ -114,9 +115,9 @@ run_cmake \ -DCMAKE_INSTALL_PREFIX="$MONGOCRYPT_INSTALL_PREFIX/nocrypto" \ "${common_cmake_args[@]}" -run_cmake --build "$build_dir" --target install --config RelWithDebInfo -run_cmake --build "$build_dir" --target test-mongocrypt --config RelWithDebInfo -run_chdir "$build_dir" run_ctest -C RelWithDebInfo +run_cmake --build "$build_dir" --target install --config "$LIBMONGOCRYPT_BUILD_TYPE" +run_cmake --build "$build_dir" --target test-mongocrypt --config "$LIBMONGOCRYPT_BUILD_TYPE" +run_chdir "$build_dir" run_ctest -C "$LIBMONGOCRYPT_BUILD_TYPE" # Build and install libmongocrypt without statically linking libbson run_cmake \ @@ -125,5 +126,5 @@ run_cmake \ -DCMAKE_INSTALL_PREFIX="$MONGOCRYPT_INSTALL_PREFIX/sharedbson" \ "${common_cmake_args[@]}" -run_cmake --build "$build_dir" --target install --config RelWithDebInfo -run_chdir "$build_dir" run_ctest -C RelWithDebInfo +run_cmake --build "$build_dir" --target install --config "$LIBMONGOCRYPT_BUILD_TYPE" +run_chdir "$build_dir" run_ctest -C "$LIBMONGOCRYPT_BUILD_TYPE" From 5770899b1abd5bd5cf41a084f95d6667ccaea09a Mon Sep 17 00:00:00 2001 From: Kevin Albertson Date: Wed, 18 Jan 2023 09:07:31 -0500 Subject: [PATCH 2/2] remove unused CMAKE variable --- .evergreen/build_all.sh | 2 -- 1 file changed, 2 deletions(-) diff --git a/.evergreen/build_all.sh b/.evergreen/build_all.sh index 660f2caa9..ad9a6e5d5 100755 --- a/.evergreen/build_all.sh +++ b/.evergreen/build_all.sh @@ -39,8 +39,6 @@ if [ "$MACOS_UNIVERSAL" = "ON" ]; then ADDITIONAL_CMAKE_FLAGS="$ADDITIONAL_CMAKE_FLAGS -DCMAKE_OSX_ARCHITECTURES='arm64;x86_64'" fi -: "${CMAKE:=cmake}" - for suffix in "dll" "dylib" "so"; do cand="$(abspath "$LIBMONGOCRYPT_DIR/../mongocrypt_v1.$suffix")" if test -f "$cand"; then