fix: support multi-platform build script(#866) (#867)

Co-authored-by: Dian Qi <qidian.qd@alibaba-inc.com>
pull/875/head
Dian Qi 1 year ago committed by GitHub
parent 5353e5fa66
commit 51e747119c
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23

@ -54,7 +54,19 @@ fi
cd $OPENIM_ROOT
# CPU core number
cpu_count=$(lscpu | grep -e '^CPU(s):' | awk '{print $2}')
# Check the system type
system_type=$(uname)
if [[ "$system_type" == "Darwin" ]]; then
# macOS (using sysctl)
cpu_count=$(sysctl -n hw.ncpu)
elif [[ "$system_type" == "Linux" ]]; then
# Linux (using lscpu)
cpu_count=$(lscpu --parse | grep -E '^([^#].*,){3}[^#]' | sort -u | wc -l)
else
echo "Unsupported operating system: $system_type"
exit 1
fi
echo -e "${GREEN_PREFIX}======> cpu_count=$cpu_count${COLOR_SUFFIX}"
# Count the number of concurrent compilations (half the number of cpus)

Loading…
Cancel
Save