Commit 3a902ad20afd385955e0d094d00bf7f385b1c3f0
Committed by
Jay Berkenbilt
1 parent
aacf48a2
CMake wrapper for Windows
Showing
2 changed files
with
39 additions
and
0 deletions
README-maintainer
| ... | ... | @@ -27,6 +27,10 @@ CFLAGS="-fsanitize=address -fsanitize=undefined" \ |
| 27 | 27 | CC=clang CXX=clang++ \ |
| 28 | 28 | cmake -DMAINTAINER_MODE=1 -DBUILD_SHARED_LIBS=0 -DCMAKE_BUILD_TYPE=Debug .. |
| 29 | 29 | |
| 30 | +Windows: | |
| 31 | + | |
| 32 | +../cmake-win {mingw|msvc} maint | |
| 33 | + | |
| 30 | 34 | VERSIONS |
| 31 | 35 | |
| 32 | 36 | * The version number on the main branch is whatever the version would | ... | ... |
cmake-win
0 → 100755
| 1 | +#!/bin/bash | |
| 2 | +set -e | |
| 3 | +whoami=$(basename $0) | |
| 4 | +tool=$1 | |
| 5 | +mode=$2 | |
| 6 | + | |
| 7 | +dir=$(realpath --relative-to . $(dirname $0)) | |
| 8 | +if [ "$dir" = "." ]; then | |
| 9 | + echo 1>&2 "$whoami: run from other than the source directory." | |
| 10 | + exit 2 | |
| 11 | +fi | |
| 12 | +declare -a args | |
| 13 | +case $tool in | |
| 14 | + msvc) | |
| 15 | + args=(-DCMAKE_BUILD_TYPE=RelWithDebInfo) | |
| 16 | + if cl 2>&1 | grep -q 'for x86'; then | |
| 17 | + args=("${args[@]}" -A win32) | |
| 18 | + fi | |
| 19 | + ;; | |
| 20 | + mingw) | |
| 21 | + args=(-G 'MSYS Makefiles' -DCMAKE_BUILD_TYPE=RelWithDebInfo) | |
| 22 | + ;; | |
| 23 | + *) | |
| 24 | + echo 1>&2 "Usage: $whoami {msvc|mingw}" | |
| 25 | + exit 2 | |
| 26 | + ;; | |
| 27 | +esac | |
| 28 | +if [ "$mode" = "maint" ]; then | |
| 29 | + args=("${args[@]}" -DMAINTAINER_MODE=1 -DBUILD_DOC=0 -DBUILD_STATIC_LIBS=0) | |
| 30 | +elif [ "$mode" = "ci" ]; then | |
| 31 | + args=("${args[@]}" -DCI_MODE=1 -DINSTALL_MANUAL=1) | |
| 32 | +fi | |
| 33 | + | |
| 34 | +set -x | |
| 35 | +cmake "${args[@]}" $dir | ... | ... |