blob: fdd8b44832d382005b811dedbb3c49fa84d33b93 (
plain) (
blame)
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
|
#!/bin/bash
# relative path to the cmake source tree directory (contains "CMakeLists.txt")
SRCDIR="."
# relative path to the cmake build tree directory
BUILDDIR="build"
DIR=$(pwd)
SCRIPTNAME=$(basename "$0" 2>/dev/null || echo "$0")
if [[ ! -f "$DIR"/"$SRCDIR"/CMakeLists.txt ]]
then
echo "$SRCDIR/CMakeLists.txt not found" >&2
echo "please run '$SCRIPTNAME' from its containing directory" >&2
exit 1
fi
for OPTION in "$@"
do
if [[ "$OPTION" == "--clean" ]]
then
rm -r "$BUILDDIR"
elif [[ "$OPTION" == "--update-translations" ]]
then
CMAKE_ARGS="$CMAKE_ARGS -DUPDATE_TRANSLATIONS:BOOL=ON"
else
echo "usage: $SCRIPTNAME [--clean] [--update-translations]" >&2
exit 1
fi
done
# note: NCORES may be too large on systems with hyperthreading
NCORES=$(grep -c "^processor" /proc/cpuinfo 2>/dev/null)
if [[ ! $NCORES -ge 1 ]]
then
NCORES=1
fi
mkdir -p "$BUILDDIR"
cd "$BUILDDIR"
cmake $CMAKE_ARGS "$DIR"/"$SRCDIR"/ && make -j $NCORES
cd "$DIR"
|