From 862cd641e944a4a813509dc1a841494e126f4fe7 Mon Sep 17 00:00:00 2001 From: Branden Archer Date: Sat, 31 Mar 2018 11:05:42 -0400 Subject: [PATCH] support macOS and linux for getting CPU count --- settings.sh | 14 +++++++++++++- 1 file changed, 13 insertions(+), 1 deletion(-) diff --git a/settings.sh b/settings.sh index 84b71f0..5c30ac5 100755 --- a/settings.sh +++ b/settings.sh @@ -9,7 +9,19 @@ fi ANDROID_API_VERSION=9 NDK_TOOLCHAIN_ABI_VERSION=4.8 -NUMBER_OF_CORES=$(sysctl -n hw.ncpu) +NUMBER_OF_CORES=1 +which nproc >/dev/null +if [ $? -eq 0 ]; then + NUMBER_OF_CORES=$(nproc) +fi +if [ $NUMBER_OF_CORES -eq 1 ]; then + # Attempt to determine cores if running on macOS + which sysctl >/dev/null + if [ $? -eq 0 ]; then + NUMBER_OF_CORES=$(sysctl -n hw.ncpu) + fi +fi + HOST_UNAME=$(uname -m) TARGET_OS=linux