-
Notifications
You must be signed in to change notification settings - Fork 9
/
Copy pathcmakeall
executable file
·56 lines (44 loc) · 992 Bytes
/
cmakeall
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
#!/bin/sh
# Defaults.
SCRIPT_NAME="$(basename "$0")"
SCRIPT_DIR="$(readlink -f $(dirname "$0"))"
BUILD_TYPE="Release"
INSTALL_PREFIX="${SCRIPT_DIR}"
# Parse options.
usage () {
echo "Usage: ${SCRIPT_NAME} [Release | Debug] [install-prefix]"
}
if test $# -ge 1; then
if test "$1" = "Release"; then
BUILD_TYPE="Release"
shift
elif test "$1" = "Debug"; then
BUILD_TYPE="Debug"
shift
else
echo "Bad build type: \"$1\""
usage
exit 1
fi
fi
if test $# -ge 1; then
INSTALL_PREFIX="$(readlink -f $1)"
if test -z ${INSTALL_PREFIX}; then
echo "Wrong install-prefix: \"$1\""
usage
exit 1
fi
shift
fi
# Do the actual work.
echo "Build type: $BUILD_TYPE"
echo "Install prefix: $INSTALL_PREFIX"
echo
cd "${SCRIPT_DIR}"
mkdir -p "build/${BUILD_TYPE}"
cd "build/${BUILD_TYPE}"
cmake -D "CMAKE_BUILD_TYPE=${BUILD_TYPE}" \
-D "CMAKE_INSTALL_PREFIX=${INSTALL_PREFIX}" \
"${SCRIPT_DIR}/source" \
$@ &&
make -j2 all install