2
1
mirror of https://github.com/qpdf/qpdf.git synced 2024-12-22 02:49:00 +00:00
qpdf/cmake-win
Jay Berkenbilt 341cd7b5d9 Tweak cmake-win
Avoid running generate_auto_job -- rather than using maintainer mode,
just enable WERROR.
2022-05-21 09:50:17 -04:00

45 lines
1.1 KiB
Bash
Executable File

#!/bin/bash
set -e
whoami=$(basename $0)
tool=$1
mode=$2
dir=$(realpath --relative-to . $(dirname $0))
if [ "$dir" = "." ]; then
echo 1>&2 "$whoami: run from other than the source directory."
exit 2
fi
declare -a args
case $tool in
msvc)
args=(-DCMAKE_BUILD_TYPE=RelWithDebInfo)
if cl 2>&1 | grep -q 'for x86'; then
args=("${args[@]}" -A win32)
fi
;;
mingw)
args=(-G 'MSYS Makefiles' -DCMAKE_BUILD_TYPE=RelWithDebInfo)
;;
*)
echo 1>&2 "Usage: $whoami {msvc|mingw}"
exit 2
;;
esac
if [ "$mode" = "maint" ]; then
args=("${args[@]}" -DWERROR=1 -DBUILD_STATIC_LIBS=0)
elif [ "$mode" = "ci" ]; then
args=("${args[@]}" -DCI_MODE=1 -DINSTALL_MANUAL=1)
fi
set -x
cmake "${args[@]}" $dir
set +x
if [ "$tool" = "msvc" ]; then
echo ""
echo "*****************************************************************"
echo "*** Remember to pass --config RelWithDebInfo to cmake --build ***"
echo "*** and -C RelWithDebInfo to ctest ***"
echo "*****************************************************************"
echo ""
fi