|author||yizhe.wcm <42297186+WoodsCumming@users.noreply.github.com>||Fri Feb 28 11:33:44 2020 +0800|
|committer||GitHub <email@example.com>||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.
RocketMQ-Client-CPP is the C/C++ client of Apache RocketMQ, a distributed messaging and streaming platform with low latency, high performance and reliability, trillion-level capacity and flexible scalability.
note: make sure the following compile tools or libraries have been installed before running the build script build.sh.
The build.sh script will automatically download and build the dependency libraries including libevent, json and boost. It will save libraries under rocketmq-client-cpp folder, and then build both static and shared libraries for rocketmq-client. If the dependent libraries are built failed, you could try to build it manually with sources libevent 2.0.22, jsoncpp 0.10.7, boost 1.58.0
If your host is not available to internet to download the three library source files, you can copy the three library source files (release-2.0.22-stable.zip 0.10.7.zip and boost_1_58_0.tar.gz) to rocketmq-client-cpp root dir, then the build.sh will automatically use the three library source files to build rocketmq-client-cpp:
Finally, both librocketmq.a and librocketmq.so are saved in rocketmq-client-cpp/bin. when using them to build application or library, besides rocketmq you should also link with following libraries -lpthread -lz -ldl -lrt. Here is an example:
g++ -o consumer_example consumer_example.cpp -lrocketmq -lpthread -lz -ldl -lrt
note: make sure the following compile tools or libraries have been installed before running the build script win32_build.bat:
The build script will automatically download dependent libraries including libevent json and boost to build shared library:
If your host is not available to internet to download the four library source files by build script, you can copy the four library source files
zlib-1.2.3-src Extract to $(rocketmq-client-cpp root dir)/thirdparty/zlib-1.2.3-src
libevent-release-2.0.22 Extract to $(rocketmq-client-cpp root dir)/thirdparty/libevent-release-2.0.22
boost_1_58_0 Extract to $(rocketmq-client-cpp root dir)/thirdparty/boost_1_58_0
jsoncpp-0.10.6 Extract to $(rocketmq-client-cpp root dir)/thirdparty/jsoncpp-0.10.6
And then run following command to build x86 rocketmq-client:
to build x64 rocketmq-client: