@@ -36,6 +36,14 @@ To change compiler to clang, add `--cxx=clang++ --cc=clang`.
To not link debugging symbols, add `--nodebugsymbols` and compiled binaries will be much smaller.
### Compile brpc with cmake
```
$ mkdir build && cd build && cmake .. && make
```
To change compiler to clang, overwrite environment variable CC and CXX to clang and clang++.
Use `cmake -DWITH_DEBUG_SYMBOLS=ON ..` to link debugging symbols.
### Run example
```
...
...
@@ -48,6 +56,15 @@ Examples link brpc statically, if you need to link the shared version, `make cle
To run examples with cpu/heap profilers, install `libgoogle-perftools-dev` and re-run `config_brpc.sh` before compiling.
### Run example with cmake
```
$ cd example/echo_c++
$ mkdir build && cd build && cmake .. && make
$ ./echo_server &
$ ./echo_client
```
Examples link brpc statically, if you need to link the shared version, use `cmake -DEXAMPLE_LINK_SO=ON ..`
### Run tests
Install and compile libgtest-dev (which is not compiled yet):
...
...
@@ -59,6 +76,15 @@ The directory of gtest source code may be changed, try `/usr/src/googletest/goog
Rerun `config_brpc.sh`, `make` in test/, and `sh run_tests.sh`
### Run tests with cmake
Install gtest like just written above.
```
$ mkdir build && cd build && cmake -DBUILD_UNIT_TESTS=ON .. && make
$ cd test && sh run_tests.sh
```
## Fedora/CentOS
### Prepare deps
...
...
@@ -89,6 +115,14 @@ To change compiler to clang, add `--cxx=clang++ --cc=clang`.
To not link debugging symbols, add `--nodebugsymbols` and compiled binaries will be much smaller.
### Compile brpc with cmake
```
$ mkdir build && cd build && cmake .. && make
```
To change compiler to clang, overwrite environment variable CC and CXX to clang and clang++.
Use `cmake -DWITH_DEBUG_SYMBOLS=ON ..` to link debugging symbols.
### Run example
```
...
...
@@ -101,12 +135,28 @@ Examples link brpc statically, if you need to link the shared version, `make cle
To run examples with cpu/heap profilers, install `gperftools-devel` and re-run `config_brpc.sh` before compiling.
### Run example with cmake
```
$ cd example/echo_c++
$ mkdir build && cd build && cmake .. && make
$ ./echo_server &
$ ./echo_client
```
Examples link brpc statically, if you need to link the shared version, use `cmake -DEXAMPLE_LINK_SO=ON ..`
### Run tests
Install gtest-devel.
Rerun `config_brpc.sh`, `make` in test/, and `sh run_tests.sh`
### Run tests with cmake
```
$ mkdir build && cd build && cmake -DBUILD_UNIT_TESTS=ON .. && make
$ cd test && sh run_tests.sh
```
## Linux with self-built deps
### Prepare deps
...
...
@@ -144,6 +194,18 @@ $ sh config_brpc.sh --headers=.. --libs=..
$ make
```
### Compile brpc with cmake
git clone brpc. cd into the repo and run
```
$ mkdir build && cd build && cmake -DCMAKE_INCLUDE_PATH="/path/to/dep1/include;/path/to/dep2/include" -DCMAKE_LIBRARY_PATH="/path/to/dep1/lib;/path/to/dep2/lib" .. && make
```
To change compiler to clang, overwrite environment variable CC and CXX to clang and clang++.
Add `-DWITH_DEBUG_SYMBOLS=ON` to link debugging symbols.
# Supported deps
## GCC: 4.8-7.1
...
...
@@ -200,11 +262,11 @@ When you remove tcmalloc, not only remove the linkage with tcmalloc but also the
## glog: 3.3+
brpc implementes a default [logging utility](../../src/butil/logging.h) which conflicts with glog. To replace this with glog, add *--with-glog* to config_brpc.sh
brpc implementes a default [logging utility](../../src/butil/logging.h) which conflicts with glog. To replace this with glog, add *--with-glog* to config_brpc.sh or add `-DWITH_GLOG=ON` to cmake.
## valgrind: 3.8+
brpc detects valgrind automatically (and registers stacks of bthread). Older valgrind(say 3.2) is not supported.
brpc detects valgrind automatically (and registers stacks of bthread). Older valgrind(say 3.2) is not supported.