Support to get nproc on macOS in the compilation (#8281)

Signed-off-by: Xiangyu Wang <xiangyu.wang@zilliz.com>
pull/8064/head
Xiangyu Wang 2021-09-22 17:09:53 +08:00 committed by GitHub
parent 3437d37add
commit 43ad33ecea
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23
1 changed files with 11 additions and 1 deletions

View File

@ -2,7 +2,17 @@
# Compile jobs variable; Usage: $ jobs=12 ./core_build.sh ...
if [[ ! ${jobs+1} ]]; then
jobs=$(nproc)
if command -v nproc &> /dev/null
# For linux
then
jobs=$(nproc)
elif command -v sysctl &> /dev/null
# For macOS
then
jobs=$(sysctl -n hw.logicalcpu)
else
jobs=4
fi
fi
SOURCE="${BASH_SOURCE[0]}"