build.sh: get number of CPUs on OSX too

The linux way (reading /proc/cpuinfo) doesn't work on OSX.
This commit is contained in:
Nicolas Hillegeer 2014-09-10 19:49:17 +02:00
parent b9fba8005a
commit 57b09c371a
1 changed files with 7 additions and 1 deletions

View File

@ -87,7 +87,13 @@ else
cmake "${flags[@]}" $root 2>&1 | tee -a $log
fi
make -j "$(grep -w -c processor /proc/cpuinfo)" 2>&1 | tee -a $log
if [[ $(uname -s) == 'Darwin' ]]; then
ncpu=$(sysctl -n hw.ncpu)
else
ncpu=$(grep -w -c processor /proc/cpuinfo)
fi
make -j"$ncpu" 2>&1 | tee -a $log
make install 2>&1 | tee -a $log
exit 0