Commit 3905cbe2bdd1a79003ee5e21c3b79bacec905c0e
1 parent
1f84a1ef
Add simple build script
Showing
2 changed files
with
26 additions
and
0 deletions
build.sh
0 → 100755
| 1 | +#!/bin/bash | ||
| 2 | + | ||
| 3 | +thisfile=$(readlink --canonicalize "$0") | ||
| 4 | +thisdir=$(dirname "$thisfile") | ||
| 5 | + | ||
| 6 | +BUILD_TYPE="Release" | ||
| 7 | +if [[ "$1" == "Debug" ]]; then | ||
| 8 | + BUILD_TYPE="Debug" | ||
| 9 | +fi | ||
| 10 | + | ||
| 11 | +BUILD_DIR="FlashMQBuild$BUILD_TYPE" | ||
| 12 | + | ||
| 13 | +if [[ -e "$BUILD_DIR" ]]; then | ||
| 14 | + echo "$BUILD_DIR already exists. Not doing anything. You can run 'make' in it, if you want." | ||
| 15 | + exit 1 | ||
| 16 | +fi | ||
| 17 | + | ||
| 18 | +set -e | ||
| 19 | +set -u | ||
| 20 | + | ||
| 21 | +mkdir "$BUILD_DIR" | ||
| 22 | +cd "$BUILD_DIR" | ||
| 23 | + | ||
| 24 | +cmake -DCMAKE_BUILD_TYPE="$BUILD_TYPE" "$thisdir" | ||
| 25 | +make |