blob: 69041c0f53cec4c12661a9b1a3911d70f0be6136 (
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
|
#!/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)
if [[ ! -f "$DIR"/"$SRCDIR"/CMakeLists.txt ]]
then
echo "$SRCDIR/CMakeLists.txt not found" >&2
SCRIPTNAME=$(basename "$0" 2>/dev/null || echo "$0")
echo "please run '$SCRIPTNAME' from its containing directory" >&2
exit 1
fi
# 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 "$DIR"/"$SRCDIR"/ && make clean && make -j $NCORES
cd "$DIR"
|