wxwidgets/build/tools/proc_count.sh
Vadim Zeitlin c29955775a Avoid using a bashism in script returning CPU count
While ((var++)) works in bash, it results in an error message (and
doesn't increment the variable) in dash, so use a POSIX-compatible
construction which works for both of them.
2022-12-04 01:04:01 +01:00

17 lines
300 B
Bash
Executable file

# This script outputs the number of available processors/cores plus one.
case `uname` in
Linux|MSYS*|MINGW*)
wxPROC_COUNT=`nproc`
;;
Darwin|FreeBSD)
wxPROC_COUNT=`sysctl -n hw.ncpu`
;;
*)
wxPROC_COUNT=0
;;
esac
echo $((wxPROC_COUNT+1))