Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
17 changes: 13 additions & 4 deletions .evergreen/build_all.sh
Original file line number Diff line number Diff line change
Expand Up @@ -27,6 +27,10 @@ export CMAKE_INSTALL_PREFIX="${MONGOCRYPT_INSTALL_PREFIX-}"
export CTEST_OUTPUT_ON_FAILURE=1
# Generate a compilation database for use by other tools
export CMAKE_EXPORT_COMPILE_COMMANDS=1
# Permit skipping build of tests.
BUILD_TESTING="${BUILD_TESTING-TRUE}"
# Build nocrypto and sharedbson variants (true by defualt).
LIBMONGOCRYPT_BUILD_VARIANTS="${LIBMONGOCRYPT_BUILD_VARIANTS:-TRUE}"

# Accumulate arguments that are passed to CMake
cmake_args=(
Expand All @@ -38,7 +42,7 @@ cmake_args=(
# Toggle compiling with shared BSON
-D USE_SHARED_LIBBSON="${USE_SHARED_LIBBSON-FALSE}"
# Toggle building of tests
-D BUILD_TESTING="${BUILD_TESTING-TRUE}"
-D BUILD_TESTING="${BUILD_TESTING:?}"
# Enable additional warnings-as-errors
-D ENABLE_MORE_WARNINGS_AS_ERRORS=TRUE
)
Expand Down Expand Up @@ -85,7 +89,7 @@ if [ "$CONFIGURE_ONLY" ]; then
exit 0;
fi
echo "Installing libmongocrypt"
_cmake_with_env --build "$BINARY_DIR" --target install test-mongocrypt test_kms_request
_cmake_with_env --build "$BINARY_DIR" --target install
run_chdir "$BINARY_DIR" run_ctest

# MONGOCRYPT-372, ensure macOS universal builds contain both x86_64 and arm64 architectures.
Expand All @@ -105,18 +109,23 @@ if [ "$PPA_BUILD_ONLY" ]; then
exit 0;
fi

if [ "${LIBMONGOCRYPT_BUILD_VARIANTS:?}" != "TRUE" ]; then
echo "Skipping build of libmongocrypt variants";
exit 0;
fi

# Build and install libmongocrypt with no native crypto.
_cmake_with_env "${cmake_args[@]}" \
-DDISABLE_NATIVE_CRYPTO=ON \
-DCMAKE_INSTALL_PREFIX="$MONGOCRYPT_INSTALL_PREFIX/nocrypto" \
-B "$BINARY_DIR" -S "$LIBMONGOCRYPT_DIR"
_cmake_with_env --build "$BINARY_DIR" --target install test-mongocrypt
_cmake_with_env --build "$BINARY_DIR" --target install
run_chdir "$BINARY_DIR" run_ctest

# Build and install libmongocrypt without statically linking libbson
_cmake_with_env "${cmake_args[@]}" \
-DUSE_SHARED_LIBBSON=ON \
-DCMAKE_INSTALL_PREFIX="$MONGOCRYPT_INSTALL_PREFIX/sharedbson" \
-B "$BINARY_DIR" -S "$LIBMONGOCRYPT_DIR"
_cmake_with_env --build "$BINARY_DIR" --target install test-mongocrypt
_cmake_with_env --build "$BINARY_DIR" --target install
run_chdir "$BINARY_DIR" run_ctest
4 changes: 4 additions & 0 deletions CMakeLists.txt
Original file line number Diff line number Diff line change
Expand Up @@ -499,6 +499,8 @@ set (TEST_MONGOCRYPT_SOURCES
test/test-unicode-fold.c
)

if (BUILD_TESTING)

# Define test-mongocrypt
add_executable (test-mongocrypt ${TEST_MONGOCRYPT_SOURCES})
# Use the static version since it allows the test binary to use private symbols
Expand Down Expand Up @@ -549,6 +551,8 @@ if ("cxx_relaxed_constexpr" IN_LIST CMAKE_CXX_COMPILE_FEATURES)
endforeach ()
endif ()

endif () # BUILD_TESTING

if ("cxx_std_20" IN_LIST CMAKE_CXX_COMPILE_FEATURES)
add_executable (csfle-markup src/csfle-markup.cpp)
target_link_libraries (csfle-markup PRIVATE mongocrypt_static _mongocrypt::libbson_for_static mongo::mc-mlib)
Expand Down