You are viewing a plain text version of this content. The canonical link for it is here.
Posted to commits@rocketmq.apache.org by di...@apache.org on 2020/02/28 03:33:51 UTC
[rocketmq-client-cpp] branch master updated: refactor(build): use
dynamic cpu cores to compile code. (#265)
This is an automated email from the ASF dual-hosted git repository.
dinglei pushed a commit to branch master
in repository https://gitbox.apache.org/repos/asf/rocketmq-client-cpp.git
The following commit(s) were added to refs/heads/master by this push:
new a90b074 refactor(build): use dynamic cpu cores to compile code. (#265)
a90b074 is described below
commit a90b074ed8c5c051333c5ef0fa03020b09c1cddf
Author: yizhe.wcm <42...@users.noreply.github.com>
AuthorDate: Fri Feb 28 11:33:44 2020 +0800
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.
---
build.sh | 6 +++++-
1 file changed, 5 insertions(+), 1 deletion(-)
diff --git a/build.sh b/build.sh
index 37fe0ea..06530a7 100755
--- a/build.sh
+++ b/build.sh
@@ -39,6 +39,11 @@ PrintParams() {
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_asan=0
declare enable_lsan=0
declare verbose=1
declare codecov=0
-declare cpu_num=4
declare test=0
pasres_arguments() {