From 57b09c371aa4921c92053914f1605581d17bd6d1 Mon Sep 17 00:00:00 2001 From: Nicolas Hillegeer Date: Wed, 10 Sep 2014 19:49:17 +0200 Subject: [PATCH] build.sh: get number of CPUs on OSX too The linux way (reading /proc/cpuinfo) doesn't work on OSX. --- build.sh | 8 +++++++- 1 file changed, 7 insertions(+), 1 deletion(-) diff --git a/build.sh b/build.sh index 201a905ad6..3003530f8e 100755 --- a/build.sh +++ b/build.sh @@ -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