Skip to content

ccache: support MSVC by using /Z7 via MSVC_DEBUG_INFORMATION_FORMAT #1853

New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Merged
merged 3 commits into from
Feb 7, 2025
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
9 changes: 9 additions & 0 deletions .evergreen/scripts/compile-libmongocrypt.sh
Original file line number Diff line number Diff line change
Expand Up @@ -20,6 +20,15 @@ compile_libmongocrypt() {
"-DBUILD_VERSION=1.12.0"
)

. "$(dirname "${BASH_SOURCE[0]}")/find-ccache.sh"
find_ccache_and_export_vars "$(pwd)/libmongocrypt" || true
if command -v "${CMAKE_C_COMPILER_LAUNCHER:-}" && [[ "${OSTYPE:?}" == cygwin ]]; then
crypt_cmake_flags+=(
"-DCMAKE_POLICY_DEFAULT_CMP0141=NEW"
"-DCMAKE_MSVC_DEBUG_INFORMATION_FORMAT=Embedded"
)
fi

env \
DEBUG="0" \
CMAKE_EXE="${cmake_binary}" \
Expand Down
10 changes: 7 additions & 3 deletions .evergreen/scripts/compile-std.sh
Original file line number Diff line number Diff line change
Expand Up @@ -131,12 +131,16 @@ echo "Installing libmongocrypt..."
}
echo "Installing libmongocrypt... done."

echo "CFLAGS: ${CFLAGS}"
echo "configure_flags: ${configure_flags[*]}"

# Use ccache if able.
. "${script_dir:?}/find-ccache.sh"
find_ccache_and_export_vars "$(pwd)" || true
if command -v "${CMAKE_C_COMPILER_LAUNCHER:-}" && [[ "${OSTYPE:?}" == cygwin ]]; then
configure_flags_append "-DCMAKE_POLICY_DEFAULT_CMP0141=NEW"
configure_flags_append "-DCMAKE_MSVC_DEBUG_INFORMATION_FORMAT=$<$<CONFIG:Debug,RelWithDebInfo>:Embedded>"
fi

echo "CFLAGS: ${CFLAGS}"
echo "configure_flags: ${configure_flags[*]}"

"${cmake_binary}" "${configure_flags[@]}" .
"${cmake_binary}" --build .
10 changes: 9 additions & 1 deletion .evergreen/scripts/compile-windows.sh
Original file line number Diff line number Diff line change
Expand Up @@ -134,6 +134,14 @@ if [ "${COMPILE_LIBMONGOCRYPT}" = "ON" ]; then
configure_flags_append "-DENABLE_CLIENT_SIDE_ENCRYPTION=ON"
fi

# Use ccache if able.
. "${script_dir:?}/find-ccache.sh"
find_ccache_and_export_vars "$(pwd)" || true
if command -v "${CMAKE_C_COMPILER_LAUNCHER:-}" && [[ "${OSTYPE:?}" == cygwin ]]; then
configure_flags_append "-DCMAKE_POLICY_DEFAULT_CMP0141=NEW"
configure_flags_append "-DCMAKE_MSVC_DEBUG_INFORMATION_FORMAT=$<$<CONFIG:Debug,RelWithDebInfo>:Embedded>"
fi

"${cmake_binary:?}" -S . -B "${build_dir:?}" -G "$CC" "${configure_flags[@]}" "${extra_configure_flags[@]}"
"${cmake_binary:?}" --build "${build_dir:?}" --config "${build_config:?}"
"${cmake_binary:?}" --install "${build_dir:?}" --config "${build_config:?}"
Expand All @@ -147,4 +155,4 @@ fi
if [[ "$EXTRA_CONFIGURE_FLAGS" != *"ENABLE_MONGOC=OFF"* ]]; then
# Check public headers for extra warnings.
"${cmake_binary:?}" --build "${build_dir:?}" --config "${build_config:?}" --target public-header-warnings
fi
fi
4 changes: 4 additions & 0 deletions .evergreen/scripts/link-sample-program.sh
Original file line number Diff line number Diff line change
Expand Up @@ -76,6 +76,10 @@ ZSTD="AUTO"
if [[ -f $DIR/find-ccache.sh ]]; then
. $DIR/find-ccache.sh
find_ccache_and_export_vars "$SCRATCH_DIR" || true
if command -v "${CMAKE_C_COMPILER_LAUNCHER:-}" && [[ "${OSTYPE:?}" == cygwin ]]; then
configure_flags_append "-DCMAKE_POLICY_DEFAULT_CMP0141=NEW"
configure_flags_append "-DCMAKE_MSVC_DEBUG_INFORMATION_FORMAT=$<$<CONFIG:Debug,RelWithDebInfo>:Embedded>"
fi
fi

$CMAKE -DCMAKE_INSTALL_PREFIX=$INSTALL_DIR -DCMAKE_PREFIX_PATH=$INSTALL_DIR/lib/cmake $SSL_CMAKE_OPTION $SNAPPY_CMAKE_OPTION $STATIC_CMAKE_OPTION -DENABLE_ZSTD=$ZSTD "$SCRATCH_DIR"
Expand Down