Skip to content
Draft
Show file tree
Hide file tree
Changes from 3 commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
10 changes: 0 additions & 10 deletions .clang-format

This file was deleted.

1 change: 1 addition & 0 deletions .clang-format
45 changes: 0 additions & 45 deletions .clang-tidy

This file was deleted.

1 change: 1 addition & 0 deletions .clang-tidy
26 changes: 24 additions & 2 deletions .github/workflows/ci.yml
Original file line number Diff line number Diff line change
Expand Up @@ -78,12 +78,15 @@ jobs:
- cmake/**
- CMakeLists.txt
- CMakePresets.json
- cpp-tools
- cpp-tools/**
- scripts/clang-format.sh
- scripts/clang-tidy.sh
- scripts/install-pre-commit.sh
- .clang-format
- .clang-tidy
- .gitmodules
- .github/workflows/ci.yml
- .github/workflows/cpp-checks.yml
rust_release_check:
- client-sdk-rust

Expand Down Expand Up @@ -111,7 +114,26 @@ jobs:
name: C++ Checks
needs: changes
if: ${{ needs.changes.outputs.cpp_checks == 'true' || github.event_name == 'workflow_dispatch' }}
uses: ./.github/workflows/cpp-checks.yml
uses: livekit/cpp-tools/.github/workflows/cpp-tools.yml@alan/bootstrap-cpp-tools
with:
clang_format: true
clang_tidy: true
doxygen: false
checkout_submodules: recursive
clang_format_paths: src include benchmarks
clang_tidy_install_rust: true
clang_tidy_setup_command: |
echo "CXXFLAGS=-Wno-deprecated-declarations" >> "$GITHUB_ENV"
echo "CFLAGS=-Wno-deprecated-declarations" >> "$GITHUB_ENV"
LLVM_VERSION=$(llvm-config --version | cut -d. -f1)
echo "LIBCLANG_PATH=/usr/lib/llvm-${LLVM_VERSION}/lib" >> "$GITHUB_ENV"
clang_tidy_configure_command: cmake --preset linux-release
clang_tidy_generate_command: cmake --build build-release --target livekit_proto
clang_tidy_build_dir: build-release
clang_tidy_file_regex: '^(?!.*/(_deps|build-[^/]*|client-sdk-rust|cpp-example-collection|vcpkg_installed|docker|docs|data)/).*/src/(?!tests/).*\.(c|cpp|cc|cxx)$'
clang_tidy_header_filter: '.*/(include/livekit|src)/.*\.(h|hpp)$'
clang_tidy_exclude_header_filter: '(.*/src/tests/.*)|(.*/_deps/.*)|(.*/build-[^/]*/.*)'
clang_tidy_require_generated_protobuf: build-release/generated

generate-docs:
name: Generate Docs
Expand Down
111 changes: 0 additions & 111 deletions .github/workflows/cpp-checks.yml

This file was deleted.

3 changes: 3 additions & 0 deletions .gitmodules
Original file line number Diff line number Diff line change
Expand Up @@ -4,3 +4,6 @@
[submodule "cpp-example-collection"]
path = cpp-example-collection
url = https://github.com/livekit-examples/cpp-example-collection.git
[submodule "cpp-tools"]
path = cpp-tools
url = https://github.com/livekit/cpp-tools.git
15 changes: 9 additions & 6 deletions AGENTS.md
Original file line number Diff line number Diff line change
Expand Up @@ -76,10 +76,11 @@ Be sure to update the directory layout in this file if the directory layout chan
| `src/tests/` | Google Test integration and stress tests |
| `examples/` | In-tree example applications |
| `client-sdk-rust/` | Git submodule holding the Rust core of the SDK|
| `cpp-tools/` | Git submodule holding shared LiveKit C++ clang-format / clang-tidy configs, scripts, and docs |
| `client-sdk-rust/livekit-ffi/protocol/*.proto` | FFI contract (protobuf definitions, read-only reference) |
| `cmake/` | Build helpers (`protobuf.cmake`, `spdlog.cmake`, `LiveKitConfig.cmake.in`) |
| `docker/` | Dockerfile for CI and SDK distribution images |
| `scripts/` | Developer / CI helper scripts (e.g. `clang-tidy.sh`) |
| `scripts/` | Local helper scripts and transition wrappers that delegate shared clang tooling to `cpp-tools/` |
| `docs/` | Documentation root. `docs/` holds hand-written long-form Markdown intended to also read well on GitHub. |
| `docs/doxygen/` | Doxygen tool config, theme assets, and Doxygen-only content (`Doxyfile`, `index.md` mainpage, `customization/*.css`, `customization/header.html`, `customization/favicon.ico`). Files here use Doxygen-only syntax (`@ref`, `@brief`, …) and are not intended for human reading on their own. |
| `.github/workflows/` | GitHub Actions CI workflows |
Expand Down Expand Up @@ -326,11 +327,11 @@ malformed table, missing `@param` on a documented function, …) fails the build

Code should be easy to read and understand. If a sacrifice is made for performance or readability, it should be documented.

Adhere to clang-format checks configured in `.clang-format`. Run `./scripts/clang-format.sh` if needed to confirm code styling, and `./scripts/clang-format.sh --fix` to auto-format generated code created.
Adhere to clang-format checks configured in `.clang-format`, which is a symlink to `cpp-tools/configs/.clang-format`. Run `./cpp-tools/scripts/clang-format.sh --path src --path include --path benchmarks` if needed to confirm code styling. During the transition, `./scripts/clang-format.sh` and `./scripts/clang-format.sh --fix` remain compatibility wrappers.

### Static Analysis

Adhere to clang-tidy checks configured in `.clang-tidy`. Run `./scripts/clang-tidy.sh` if needed to confirm code quality.
Adhere to clang-tidy checks configured in `.clang-tidy`, which is a symlink to `cpp-tools/configs/.clang-tidy`. Run `./scripts/clang-tidy.sh` if needed to confirm code quality; the wrapper supplies this repo's build directory, file regex, and header filters to the shared `cpp-tools` script.

## Dependencies

Expand All @@ -339,6 +340,7 @@ Adhere to clang-tidy checks configured in `.clang-tidy`. Run `./scripts/clang-ti
| protobuf | Private (built-in) | Vendored via FetchContent (Unix) or vcpkg (Windows) |
| spdlog | **Private** | FetchContent or system package; must NOT leak into public API |
| client-sdk-rust | Build-time | Git submodule, built via cargo during CMake build |
| cpp-tools | Developer / CI | Git submodule containing shared LiveKit C++ formatting and static-analysis tooling |
| Google Test | Test only | FetchContent in `src/tests/CMakeLists.txt` |

When adding a new private/vendored dependency to this table, also add a
Expand Down Expand Up @@ -387,8 +389,8 @@ all filtered stages; normal pull requests and pushes use the path filters.
- `.github/workflows/builds.yml` — Reusable SDK and example-collection build
matrix.
- `.github/workflows/tests.yml` — Reusable unit/integration test matrix.
- `.github/workflows/cpp-checks.yml` — Reusable `clang-format` and
`clang-tidy` checks.
- `livekit/cpp-tools/.github/workflows/cpp-tools.yml` — Shared reusable
workflow called directly by `ci.yml` for `clang-format` and `clang-tidy`.
- `.github/workflows/generate-docs.yml` — Reusable Doxygen docs validation.
- `.github/workflows/rust-release-check.yml` — Reusable check that the pinned
`client-sdk-rust` submodule commit maps to a published release. Gated by the
Expand All @@ -407,7 +409,8 @@ When adding or renaming files that affect a CI stage, update the matching
`ci.yml` `changes` filter in the same PR. For example, new build scripts,
CMake files, package manifests, or reusable build workflows should be added to
the `builds` filter; test-only helpers to `tests`; formatting/static-analysis
configuration to `cpp_checks`; and docs generation inputs to `docs`.
configuration (including `cpp-tools` submodule bumps) to `cpp_checks`; and docs
generation inputs to `docs`.

Keep broad agent guidance files such as `AGENTS.md` out of the expensive
`builds`, `tests`, `cpp_checks`, and `docs` filters unless they start affecting
Expand Down
9 changes: 5 additions & 4 deletions README.md
Original file line number Diff line number Diff line change
Expand Up @@ -221,12 +221,13 @@ local `livekit-server --dev`, and run via `ctest` or directly. See

## Developer tools

`clang-tidy`, `clang-format`, `valgrind`, and Doxygen are all wired up via
scripts under `scripts/`. Set up the pre-commit auto-formatter
with:
`clang-tidy` and `clang-format` are provided by the `cpp-tools` submodule, with
transition wrappers kept under `scripts/`. `valgrind` and Doxygen remain
documented with the rest of the local developer tools. Set up the pre-commit
auto-formatter with:

```bash
./scripts/install-pre-commit.sh
./cpp-tools/scripts/install-pre-commit.sh
```

See [docs/tools.md](docs/tools.md).
Expand Down
1 change: 1 addition & 0 deletions cpp-tools
Submodule cpp-tools added at 9f3067
50 changes: 39 additions & 11 deletions docs/tools.md
Original file line number Diff line number Diff line change
Expand Up @@ -5,10 +5,21 @@ are also enforced in CI on PRs.

## Clang tools

- **`clang-tidy`** — static analysis. See [.clang-tidy](https://github.com/livekit/client-sdk-cpp/blob/main/.clang-tidy) for the
enabled checks. Enforced in CI on PR.
`clang-tidy` and `clang-format` are owned by the
[`livekit/cpp-tools`](https://github.com/livekit/cpp-tools) submodule. The
root `.clang-tidy` and `.clang-format` files are symlinks into that submodule
so editor integrations can still discover them automatically.
The shared CI workflow source of truth is
`cpp-tools/.github/workflows/cpp-tools.yml`; this repo's `ci.yml` calls it
directly with repo-specific inputs such as `clang_tidy: true` and
`doxygen: false`.

- **`clang-tidy`** — static analysis. See
[`.clang-tidy`](https://github.com/livekit/client-sdk-cpp/blob/main/.clang-tidy)
for the enabled checks. Enforced in CI on PR.
- **`clang-format`** — code formatting and style consistency. See
[.clang-format](https://github.com/livekit/client-sdk-cpp/blob/main/.clang-format) for the rules. Enforced in CI on PR.
[`.clang-format`](https://github.com/livekit/client-sdk-cpp/blob/main/.clang-format)
for the rules. Enforced in CI on PR.

> **Note (Windows):** `clang-tidy` is not currently driven by our scripts on
> Windows. The MSBuild CMake generator doesn't emit
Expand Down Expand Up @@ -42,9 +53,20 @@ sudo apt-get install clang-format clang-tidy clang-tools
./build.sh release
```

2. Run the wrapper, which uses the same file set, regex filters, and
2. Run the shared wrapper, which uses the same file set, regex filters, and
`.clang-tidy` config as CI:

```bash
./cpp-tools/scripts/clang-tidy.sh \
--build-dir build-release \
--file-regex '^(?!.*/(_deps|build-[^/]*|client-sdk-rust|cpp-example-collection|vcpkg_installed|docker|docs|data)/).*/src/(?!tests/).*\.(c|cpp|cc|cxx)$' \
--header-filter '.*/(include/livekit|src)/.*\.(h|hpp)$' \
--exclude-header-filter '(.*/src/tests/.*)|(.*/_deps/.*)|(.*/build-[^/]*/.*)' \
--require-generated-protobuf build-release/generated
```

During the transition, the compatibility wrapper is equivalent:

```bash
./scripts/clang-tidy.sh
```
Expand All @@ -54,7 +76,7 @@ The wrapper forwards extra arguments to `run-clang-tidy`:
```bash
./scripts/clang-tidy.sh -j 4 # Number of cores
./scripts/clang-tidy.sh -checks='-*,misc-const-correctness' # Only specific checks
./scripts/clang-tidy.sh -fix # Apply fixes
./scripts/clang-tidy.sh --fix # Apply fixes
```

Output is captured to `clang-tidy.log` at the repo root, since the terminal
Expand All @@ -63,13 +85,18 @@ buffer often can't hold all of it.
### Run `clang-format`

```bash
./scripts/clang-format.sh
./cpp-tools/scripts/clang-format.sh --path src --path include --path benchmarks
```

With no arguments, runs against every relevant file in the repository against
the rules in `.clang-format`.
The compatibility wrapper supplies this repo's default paths, so the shorter
transition command is:

```bash
./scripts/clang-format.sh
```

```bash
./cpp-tools/scripts/clang-format.sh --path src --path include --path benchmarks --fix
./scripts/clang-format.sh --fix # Rewrite files in place
./scripts/clang-format.sh src/room.cpp include/livekit/room.h # Check just these files
./scripts/clang-format.sh --fix src/room.cpp # Fix just this file
Expand All @@ -85,11 +112,12 @@ A simple pre-commit hook that auto-formats staged C/C++ files using the
project's `.clang-format` rules:

```bash
./scripts/install-pre-commit.sh
./cpp-tools/scripts/install-pre-commit.sh
```

This installs `.git/hooks/pre-commit`. Re-run after `git clone` on a fresh
checkout.
During the transition, `./scripts/install-pre-commit.sh` delegates to the
shared installer. This installs `.git/hooks/pre-commit`. Re-run after
`git clone` on a fresh checkout.

---

Expand Down
Loading
Loading