Skip to content

Commit 0df1476

Browse files
authored
Avoid passing Linux-like flags on Windows distros (#1095)
1 parent 775b978 commit 0df1476

File tree

1 file changed

+39
-33
lines changed

1 file changed

+39
-33
lines changed

.evergreen/compile.sh

Lines changed: 39 additions & 33 deletions
Original file line numberDiff line numberDiff line change
@@ -69,7 +69,6 @@ export CMAKE_BUILD_PARALLEL_LEVEL
6969
if command -V ccache 2>/dev/null; then
7070
export CMAKE_CXX_COMPILER_LAUNCHER=ccache
7171

72-
7372
# Allow reuse of ccache compilation results between different build directories.
7473
export CCACHE_BASEDIR CCACHE_NOHASHDIR
7574
CCACHE_BASEDIR="$(pwd)"
@@ -99,7 +98,7 @@ esac
9998
: "${cmake_examples_target:?}"
10099

101100
# Create a VERSION_CURRENT file in the build directory to include in the dist tarball.
102-
python ./etc/calc_release_version.py > ./build/VERSION_CURRENT
101+
python ./etc/calc_release_version.py >./build/VERSION_CURRENT
103102
cd build
104103

105104
cmake_flags=(
@@ -116,7 +115,7 @@ case "${OSTYPE:?}" in
116115
cygwin)
117116
case "${generator:-}" in
118117
*2015*) cmake_flags+=("-DBOOST_ROOT=C:/local/boost_1_60_0") ;;
119-
*2017*|*2019*) cmake_flags+=("-DCMAKE_CXX_STANDARD=17") ;;
118+
*2017* | *2019*) cmake_flags+=("-DCMAKE_CXX_STANDARD=17") ;;
120119
*)
121120
echo "missing explicit CMake Generator on Windows distro" 1>&2
122121
exit 1
@@ -147,7 +146,9 @@ cc_flags=()
147146
cxx_flags=()
148147

149148
case "${OSTYPE:?}" in
150-
cygwin) ;;
149+
cygwin)
150+
# Most compiler flags are not applicable to builds on Windows distros.
151+
;;
151152
darwin*)
152153
cc_flags+=("${cc_flags_init[@]}")
153154
cxx_flags+=("${cxx_flags_init[@]}" -stdlib=libc++)
@@ -162,35 +163,40 @@ linux*)
162163
;;
163164
esac
164165

165-
# Sanitizers overwrite the usual compiler flags.
166-
if [[ "${USE_SANITIZER_ASAN:-}" == "ON" ]]; then
167-
cxx_flags=(
168-
"${cxx_flags_init[@]}"
169-
-D_GLIBCXX_USE_CXX11_ABI=0
170-
-fsanitize=address
171-
-O1 -g -fno-omit-frame-pointer
172-
)
173-
fi
174-
if [[ "${USE_SANITIZER_UBSAN:-}" == "ON" ]]; then
175-
cxx_flags=(
176-
"${cxx_flags_init[@]}"
177-
-D_GLIBCXX_USE_CXX11_ABI=0
178-
-fsanitize=undefined
179-
-fsanitize-blacklist="$(pwd)/../etc/ubsan.ignorelist"
180-
-fno-sanitize-recover=undefined
181-
-O1 -g -fno-omit-frame-pointer
182-
)
183-
fi
184-
185-
# Ignore warnings generated by core::optional in mnmlstc/core.
186-
if [[ "${OSTYPE:?}" == linux* && "${HOSTTYPE:?}" == powerpc64le ]]; then
187-
cxx_flags+=(-Wno-error=maybe-uninitialized)
188-
fi
189-
190-
# Ignore deprecation warnings when building on a release branch.
191-
if [ "$(echo "${branch_name:?}" | cut -f2 -d'/')" != "${branch_name:?}" ]; then
192-
cc_flags+=(-Wno-deprecated-declarations)
193-
cxx_flags+=(-Wno-deprecated-declarations)
166+
# Most compiler flags are not applicable to builds on Windows distros.
167+
if [[ "${OSTYPE:?}" != cygwin ]]; then
168+
# Sanitizers overwrite the usual compiler flags.
169+
if [[ "${USE_SANITIZER_ASAN:-}" == "ON" ]]; then
170+
cxx_flags=(
171+
"${cxx_flags_init[@]}"
172+
-D_GLIBCXX_USE_CXX11_ABI=0
173+
-fsanitize=address
174+
-O1 -g -fno-omit-frame-pointer
175+
)
176+
fi
177+
178+
# Sanitizers overwrite the usual compiler flags.
179+
if [[ "${USE_SANITIZER_UBSAN:-}" == "ON" ]]; then
180+
cxx_flags=(
181+
"${cxx_flags_init[@]}"
182+
-D_GLIBCXX_USE_CXX11_ABI=0
183+
-fsanitize=undefined
184+
-fsanitize-blacklist="$(pwd)/../etc/ubsan.ignorelist"
185+
-fno-sanitize-recover=undefined
186+
-O1 -g -fno-omit-frame-pointer
187+
)
188+
fi
189+
190+
# Ignore warnings generated by core::optional in mnmlstc/core.
191+
if [[ "${OSTYPE:?}" == linux* && "${HOSTTYPE:?}" == powerpc64le ]]; then
192+
cxx_flags+=(-Wno-error=maybe-uninitialized)
193+
fi
194+
195+
# Ignore deprecation warnings when building on a release branch.
196+
if [[ "$(echo "${branch_name:?}" | cut -f2 -d'/')" != "${branch_name:?}" ]]; then
197+
cc_flags+=(-Wno-deprecated-declarations)
198+
cxx_flags+=(-Wno-deprecated-declarations)
199+
fi
194200
fi
195201

196202
if [[ "${#cc_flags[@]}" -gt 0 ]]; then

0 commit comments

Comments
 (0)