forked from lvgl/lv_port_stm32f769_disco
-
Notifications
You must be signed in to change notification settings - Fork 0
/
Copy pathbuild.sh
executable file
·33 lines (26 loc) · 831 Bytes
/
build.sh
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
#!/bin/bash
set -o errexit
set -o nounset
USAGE="Usage: $(basename $0) [-v | --verbose] [ reset | clean | debug | release ]"
CMAKE=cmake
BUILD=./build
TYPE=DEBUG
BUILD_DIR=$BUILD/debug
CLEAN=
RESET=
VERBOSE=
for arg; do
case "$arg" in
--help|-h) echo $USAGE; exit 0;;
-v|--verbose) VERBOSE='VERBOSE=1' ;;
debug) TYPE=DEBUG; BUILD_DIR=$BUILD/debug ;;
release) TYPE=RELEASE; BUILD_DIR=$BUILD/release ;;
clean) CLEAN=1 ;;
reset) RESET=1 ;;
*) echo -e "unknown option $arg\n$USAGE" >&2; exit 1 ;;
esac
done
[[ -n $RESET && -d $BUILD_DIR ]] && rm -rf $BUILD_DIR
$CMAKE -S . -B $BUILD_DIR --warn-uninitialized -Wno-dev -DCMAKE_BUILD_TYPE=$TYPE -GNinja
[[ -n $CLEAN ]] && $CMAKE --build $BUILD_DIR --target clean
$CMAKE --build $BUILD_DIR -- $VERBOSE