-
Notifications
You must be signed in to change notification settings - Fork 18
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
add compile_commands support to simplify development
Signed-off-by: wangbaiping <[email protected]>
- Loading branch information
Showing
5 changed files
with
47 additions
and
2 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,13 @@ | ||
load("@hedron_compile_commands//:refresh_compile_commands.bzl", "refresh_compile_commands") | ||
|
||
refresh_compile_commands( | ||
name = "refresh_compile_commands", | ||
|
||
# Specify the targets of interest. | ||
# For example, specify a dict of targets and any flags required to build. | ||
targets = { | ||
"//cpp2sky/...": "", | ||
"//source/...": "", | ||
"//test/...": "", | ||
}, | ||
) |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
|
@@ -31,7 +31,9 @@ cc_binary( | |
], | ||
) | ||
``` | ||
|
||
#### Cmake | ||
|
||
You can compile this project, according to the following steps: | ||
``` | ||
step 01: git clone [email protected]:SkyAPM/cpp2sky.git | ||
|
@@ -41,7 +43,7 @@ step 04: cmake -S ./grpc -B ./grpc/build && cmake --build ./grpc/build --paralle | |
step 05: cmake -S . -B ./build && cmake --build ./build | ||
``` | ||
|
||
You can also use find_package to get target libary in your project. Like this: | ||
You can also use find_package to get target libary in your project. Like this: | ||
``` | ||
find_package(cpp2sky CONFIG REQUIRED) | ||
target_link_libraries(${PROJECT_NAME} cpp2sky::cpp2sky proto_lib) | ||
|
@@ -52,9 +54,14 @@ find_package(PkgConfig REQUIRED) | |
pkg_check_modules(CPP2SKY_PKG REQUIRED cpp2sky) | ||
``` | ||
|
||
Note: | ||
Note: | ||
- If you want to build this project over c11, you must update grpc version(current version:v1.46.6). | ||
- Only test cmake using Centos and Ubuntu. | ||
|
||
#### Develop | ||
|
||
Generate `compile_commands.json` for this repo by `bazel run :refresh_compile_commands`. Thank https://github.com/hedronvision/bazel-compile-commands-extractor for it provide the great script/tool to make this so easy! | ||
|
||
#### Docs | ||
|
||
cpp2sky configration is based on protobuf, and docs are generated by [protodoc](https://github.com/etcd-io/protodoc). If you have any API change, you should run below. | ||
|
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters