-
Notifications
You must be signed in to change notification settings - Fork 3
/
Copy pathbuild.sh
executable file
·72 lines (64 loc) · 1.59 KB
/
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
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
#!/bin/bash
function usage() {
echo "Usage: ${0##*/} [ -h|--help ] [ --cli|--no-cli ] [ --gui|--no-gui] [ -t|--type Debug|Release|RelWithDebInfo|MinSizeRel ] [ --libeosio=<path> ] [ --pkg-type nsis|deb|zip|tgz ] [ --disable-threads ] [ --force-ansi ]"
exit 1
}
options=$(getopt -n "${0##*/}" -o "lht:" -l "help,cli,no-cli,gui,no-gui,type:,libeosio:,pkg-type:,disable-threads,force-ansi" -- "$@")
[ $? -eq 0 ] || usage
eval set -- "$options"
TARGET="all"
ONLY_CONFIG=0
ARGS=""
BUILD_ARGS="--clean-first"
while true; do
case $1 in
-t|--type)
shift
[[ ! "$1" =~ ^(Debug|Release|RelWithDebInfo|MinSizeRel)$ ]] && {
echo "Incorrect type '$1' provided"
usage
}
ARGS="${ARGS} -DCMAKE_BUILD_TYPE=${1}"
BUILD_ARGS="${BUILD_ARGS} --config ${1}"
;;
--pkg-type)
shift
[[ ! "$1" =~ ^(nsis|deb|rpm|zip|tgz)$ ]] && {
echo "Incorrect package type '$1' provided"
usage
}
TARGET="package"
ARGS="${ARGS} -DCPACK_GENERATOR=${1^^}"
;;
--libeosio)
shift
ARGS="${ARGS} -DLIBEOSIO_SOURCE_DIR=${1}"
;;
--cli)
ARGS="${ARGS} -DCOMPONENT_CLI=ON" ;;
--no-cli)
ARGS="${ARGS} -DCOMPONENT_CLI=OFF" ;;
--gui)
ARGS="${ARGS} -DCOMPONENT_GUI=ON" ;;
--no-gui)
ARGS="${ARGS} -DCOMPONENT_GUI=OFF" ;;
--disable-threads)
ARGS="${ARGS} -DUSE_THREADS=OFF" ;;
--force-ansi)
ARGS="${ARGS} -DFORCE_ANSI=ON" ;;
-l)
ARGS="${ARGS} -LH"
ONLY_CONFIG=1 ;;
-h|--help) usage ;;
--) shift
break
;;
esac
shift
done
# Remove cache first
rm build/CMakeCache.txt 2> /dev/null
cmake -B build $ARGS .
if [ ${ONLY_CONFIG} -eq 0 ]; then
cmake --build build ${BUILD_ARGS} --target ${TARGET}
fi