refactor(build): use dynamic cpu cores to compile code. (#265)
* Modify the default number of threads used for compilation to be the number of CPU logical cores instead of hardcode.
* Modify the default number of threads used for compilation on Linux and MAC platforms to be the number of CPU logical cores, rather than hardcode.
diff --git a/build.sh b/build.sh
index 37fe0ea..06530a7 100755
--- a/build.sh
+++ b/build.sh
@@ -39,6 +39,11 @@
echo ""
}
+if test "$(uname)" = "Linux"; then
+ declare cpu_num=$(cat /proc/cpuinfo | grep "processor" | wc -l)
+elif test "$(uname)" = "Darwin" ; then
+ declare cpu_num=$(sysctl -n machdep.cpu.thread_count)
+fi
declare need_build_jsoncpp=1
declare need_build_libevent=1
declare need_build_boost=1
@@ -46,7 +51,6 @@
declare enable_lsan=0
declare verbose=1
declare codecov=0
-declare cpu_num=4
declare test=0
pasres_arguments() {