You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
- Adopt a "submodule-first, FetchContent-fallback" approach for third‑party deps.
- Add and pin submodules under 3rdparty: spdlog, fmt, httplib, skywalking-data-collect-protocol, grpc (pinned tags included).
- Move auto-detection and conflict validation into each dependency module (cmake/*.cmake) and simplify top-level CMakeLists.txt.
- Update CI (main.yml) to checkout submodules and to build gRPC from grpc.
- Add skywalking.cmake and wire proto2cpp to use SKYWALKING_PROTOCOL_PATH.
- Update README.md with submodule workflow, build instructions and bump procedure.
Rationale: improves reproducibility, makes dependency handling explicit and easier to maintain.
Signed-off-by: Matthieu MOREL <matthieu.morel35@gmail.com>
This repository pins several third-party dependencies under `3rdparty/` (example: `spdlog`, `fmt`, `httplib`, `skywalking-data-collect-protocol`). The top-level CMake will auto-detect these submodules and use them via `add_subdirectory()`.
46
+
47
+
- FetchContent fallback (automatic clone at configure time):
48
+
49
+
If a submodule is not present, CMake can automatically download the dependency at configure time using FetchContent. This is controlled by CMake options of the form `-D<LIB>_FETCHCONTENT=ON` (these are `ON` by default for some deps). For SkyWalking you can enable FetchContent with:
50
+
51
+
```bash
52
+
cmake -DSKYWALKING_FETCHCONTENT=ON -S . -B build
53
+
cmake --build build
43
54
```
44
55
56
+
- Explicit path (developer workflow):
57
+
58
+
If you already have a local checkout of `skywalking-data-collect-protocol`, point CMake to it:
Most third-party dependencies follow the same pattern: prefer the pinned submodule under `3rdparty/` (submodule-first) and fall back to `FetchContent` at configure time when the submodule is not present. See the top-level `CMakeLists.txt` and the modules in `cmake/` for details.
68
+
69
+
There are two cases worth calling out because their consumption/build steps differ slightly:
70
+
71
+
- gRPC
72
+
73
+
gRPC is not header-only and typically needs configuration and a build step (or its targets must be available via `find_package`). This repository includes a pinned copy of gRPC at `3rdparty/grpc` (tag `v1.74.1`) so builds are reproducible. CI is configured to build gRPC from that submodule.
74
+
75
+
To build gRPC locally from the submodule and install it for the rest of the project:
If you prefer not to use the submodule you can still clone and build gRPC separately and make its CMake targets available to the project, but using the pinned submodule is recommended for reproducibility.
95
+
96
+
- skywalking-data-collect-protocol (protobufs)
97
+
98
+
The SkyWalking protocol repository contains the protobuf definitions used to generate code for the project. The `cmake/skywalking.cmake` module sets `SKYWALKING_PROTOCOL_PATH` when the `3rdparty/skywalking-data-collect-protocol` submodule is present so the proto generation step can locate the `.proto` files.
99
+
100
+
You can override that behavior by supplying an explicit path:
Alternatively, enable FetchContent for SkyWalking with `-DSKYWALKING_FETCHCONTENT=ON` to let CMake fetch the proto repo at configure time.
108
+
109
+
How to bump a submodule (example for skywalking-data-collect-protocol):
110
+
```bash
111
+
cd 3rdparty/skywalking-data-collect-protocol
112
+
git fetch --tags
113
+
git checkout tags/v10.4.0 # or a specific commit
114
+
cd ../..
115
+
git add 3rdparty/skywalking-data-collect-protocol
116
+
git commit -m "Pin skywalking-data-collect-protocol to v10.4.0"
117
+
git push
118
+
```
119
+
120
+
If you prefer CI to always fetch the latest submodules, ensure the workflow initializes submodules (this repo's CI uses `actions/checkout` with `submodules: 'recursive'`).
121
+
45
122
You can also use find_package to get target libary in your project. Like this:
0 commit comments