aboutsummaryrefslogtreecommitdiffstats
path: root/cmake-win
diff options
context:
space:
mode:
authorJay Berkenbilt <ejb@ql.org>2022-03-12 02:54:07 +0100
committerJay Berkenbilt <jberkenbilt@users.noreply.github.com>2022-03-19 00:53:18 +0100
commit3a902ad20afd385955e0d094d00bf7f385b1c3f0 (patch)
tree215b013d346b5fcc4f3e9cdf65d8476998aa1522 /cmake-win
parentaacf48a2e08ea7ac576d4b4ebf81b91fbd8d1c05 (diff)
downloadqpdf-3a902ad20afd385955e0d094d00bf7f385b1c3f0.tar.zst
CMake wrapper for Windows
Diffstat (limited to 'cmake-win')
-rwxr-xr-xcmake-win35
1 files changed, 35 insertions, 0 deletions
diff --git a/cmake-win b/cmake-win
new file mode 100755
index 00000000..3a5278ef
--- /dev/null
+++ b/cmake-win
@@ -0,0 +1,35 @@
+#!/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[@]}" -DMAINTAINER_MODE=1 -DBUILD_DOC=0 -DBUILD_STATIC_LIBS=0)
+elif [ "$mode" = "ci" ]; then
+ args=("${args[@]}" -DCI_MODE=1 -DINSTALL_MANUAL=1)
+fi
+
+set -x
+cmake "${args[@]}" $dir