Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Update build script to automatically detect number of CPUs #1226

Merged
merged 12 commits into from
Jun 7, 2018
11 changes: 9 additions & 2 deletions scripts/installErizo.sh
Original file line number Diff line number Diff line change
Expand Up @@ -13,6 +13,12 @@ PREFIX_DIR=$LIB_DIR/build/
NVM_CHECK="$PATHNAME"/checkNvm.sh
FAST_MAKE=''

NUM_CORES=1;
if [ "$(uname)" == "Darwin" ]; then
NUM_CORES=$(sysctl -n hw.ncpu);
elif [ "$(expr substr $(uname -s) 1 5)" == "Linux" ]; then
NUM_CORES=$(grep -c ^processor /proc/cpuinfo);
fi

export ERIZO_HOME=$ROOT/erizo

Expand Down Expand Up @@ -128,8 +134,9 @@ else
execute_tests
;;
f)
FAST_MAKE='-j4'
FAST_BUILD='env JOBS=4'
FAST_MAKE="-j$NUM_CORES"
FAST_BUILD="env JOBS=$NUM_CORES"
echo "Compiling using $NUM_CORES threads"
;;
d)
DELETE_OBJECT_FILES='true'
Expand Down