Skip to content

Commit 9a2506b

Browse files
committed
use parallel build for script
1 parent 1625de5 commit 9a2506b

File tree

1 file changed

+13
-1
lines changed

1 file changed

+13
-1
lines changed

cppbuild/cppbuild

Lines changed: 13 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -3,11 +3,23 @@
33
SOURCE_DIR="`pwd`"
44
BUILD_DIR="`pwd`/cppbuild/Release"
55

6+
ncpus=1
7+
case "`uname`" in
8+
Darwin* )
9+
ncpus=`sysctl -n hw.ncpu`
10+
;;
11+
Linux*)
12+
ncpus=$(lscpu -p | egrep -v '^#' | wc -l)
13+
;;
14+
esac
15+
16+
echo "Will make with \"-j $ncpus\"."
17+
618
if [ -d "$BUILD_DIR" ] ; then
719
echo "Build directory ($BUILD_DIR) exists, removing."
820
rm -rf $BUILD_DIR
921
fi
1022

1123
mkdir -p $BUILD_DIR
1224

13-
(cd $BUILD_DIR && cmake -G "Unix Makefiles" $SOURCE_DIR && make clean && make all && ctest -C Release)
25+
(cd $BUILD_DIR && cmake -G "Unix Makefiles" $SOURCE_DIR && make clean && make -j "$ncpus" all && ctest -C Release)

0 commit comments

Comments
 (0)