Skip to content

Commit 407058b

Browse files
Docker build FROM ubuntu 22.04
1 parent 0dfbcec commit 407058b

File tree

3 files changed

+200
-43
lines changed

3 files changed

+200
-43
lines changed

.github/workflows/builds.yml

Lines changed: 26 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -7,25 +7,29 @@ on:
77
- src/**
88
- include/**
99
- examples/**
10+
- bridge/**
1011
- client-sdk-rust/**
1112
- CMakeLists.txt
1213
- build.sh
1314
- build.cmd
1415
- vcpkg.json
1516
- CMakePresets.json
17+
- docker/Dockerfile
1618
- .github/workflows/**
1719
pull_request:
1820
branches: ["main"]
1921
paths:
2022
- src/**
2123
- include/**
2224
- examples/**
25+
- bridge/**
2326
- client-sdk-rust/**
2427
- CMakeLists.txt
2528
- build.sh
2629
- build.cmd
2730
- vcpkg.json
2831
- CMakePresets.json
32+
- docker/Dockerfile
2933
- .github/workflows/**
3034
workflow_dispatch:
3135

@@ -238,3 +242,25 @@ jobs:
238242
else
239243
./build.sh clean-all || true
240244
fi
245+
246+
docker-build:
247+
name: Build (docker-linux-x64)
248+
runs-on: ubuntu-latest
249+
250+
steps:
251+
- name: Checkout (with submodules)
252+
uses: actions/checkout@v4
253+
with:
254+
submodules: recursive
255+
fetch-depth: 0
256+
257+
- name: Set up Docker Buildx
258+
uses: docker/setup-buildx-action@v3
259+
260+
- name: Build Docker image
261+
run: docker build -t livekit-cpp-sdk:${{ github.sha }} . -f docker/Dockerfile
262+
263+
- name: Build SDK inside Docker
264+
run: |
265+
docker run --rm livekit-cpp-sdk:${{ github.sha }} bash -c \
266+
'cd /client-sdk-cpp && chmod +x build.sh && ./build.sh release-examples'

README.md

Lines changed: 46 additions & 43 deletions
Original file line numberDiff line numberDiff line change
@@ -7,13 +7,7 @@
77
Official native C++ client SDK for LiveKit: build real-time audio, video, and data applications using LiveKit.
88
<!--END_DESCRIPTION-->
99

10-
## Build & Installation Guide
11-
12-
This page covers how to build and install the LiveKit C++ Client SDK for real-time audio/video communication.
13-
14-
---
15-
16-
### 📦 Requirements
10+
## 📦 Requirements
1711
- **CMake** ≥ 3.20
1812
- **Rust / Cargo** (latest stable toolchain)
1913
- **Git LFS** (required for examples)
@@ -24,19 +18,19 @@ This page covers how to build and install the LiveKit C++ Client SDK for real-ti
2418

2519
**Platform-Specific Requirements:**
2620

27-
#### For Building the SDK:
21+
### For Building the SDK:
2822
- **Windows:** Visual Studio 2019+, vcpkg
2923
- **Linux:** `sudo apt install libprotobuf-dev libssl-dev` (protobuf 3.x)
3024
- **macOS:** `brew install protobuf` (protobuf 3.x)
3125

32-
#### For Using the Pre-built SDK:
26+
### For Using the Pre-built SDK:
3327
- **Windows:** ✅ All dependencies included (DLLs bundled) - ready to use
3428
- **Linux:** ⚠️ Requires `libprotobuf` and `libssl-dev`; deploy `liblivekit_ffi.so` with your executable
3529
- **macOS:** ⚠️ Requires `protobuf`; deploy `liblivekit_ffi.dylib` with your executable
3630

3731
> **Note**: If the SDK was built with Protobuf 6.0+, you also need `libabsl-dev` (Linux) or `abseil` (macOS).
3832
39-
### 🧩 Clone the Repository
33+
## 🧩 Clone the Repository
4034

4135
Make sure to initialize the Rust submodule (`client-sdk-rust`):
4236

@@ -50,9 +44,9 @@ cd client-sdk-cpp
5044
git submodule update --init --recursive
5145
```
5246

53-
### ⚙️ BUILD
47+
## ⚙️ BUILD
5448

55-
#### Quick Build (Using Build Scripts)
49+
### Quick Build (Using Build Scripts)
5650

5751
**Linux/macOS:**
5852
```bash
@@ -64,6 +58,17 @@ git submodule update --init --recursive
6458
./build.sh release-tests # Build Release with tests
6559
```
6660
**Windows**
61+
Using build scripts:
62+
```powershell
63+
.\build.cmd clean # Clean CMake build artifacts
64+
.\build.cmd clean-all # Deep clean (C++ + Rust + generated files)
65+
.\build.cmd debug # Build Debug version
66+
.\build.cmd release # Build Release version
67+
.\build.cmd debug-tests # Build Debug with tests
68+
.\build.cmd release-tests # Build Release with tests
69+
```
70+
71+
### Windows build using cmake/vcpkg
6772
```bash
6873
cmake -S . -B build -DCMAKE_TOOLCHAIN_FILE="$PWD/vcpkg/scripts/buildsystems/vcpkg.cmake" # Generate Makefiles in build folder
6974
# Build (Release or Debug)
@@ -79,17 +84,7 @@ You must install protobuf via vcpkg (so CMake can find ProtobufConfig.cmake and
7984
.\vcpkg\vcpkg install protobuf:x64-windows
8085
```
8186

82-
**Windows:**
83-
```powershell
84-
.\build.cmd clean # Clean CMake build artifacts
85-
.\build.cmd clean-all # Deep clean (C++ + Rust + generated files)
86-
.\build.cmd debug # Build Debug version
87-
.\build.cmd release # Build Release version
88-
.\build.cmd debug-tests # Build Debug with tests
89-
.\build.cmd release-tests # Build Release with tests
90-
```
91-
92-
#### Advanced Build (Using CMake Presets)
87+
### Advanced Build (Using CMake Presets)
9388

9489
For more control and platform-specific builds, see the detailed instructions in [README_BUILD.md](README_BUILD.md).
9590

@@ -121,15 +116,23 @@ cmake --build --preset macos-release
121116

122117
📖 **For complete build instructions, troubleshooting, and platform-specific notes, see [README_BUILD.md](README_BUILD.md)**
123118

124-
### 🧪 Run Example
119+
### Building with Docker
120+
The Dockerfile COPYs folders/files required to build the CPP SDK into the image.
121+
**NOTE:** this has only been tested on Linux
122+
```bash
123+
docker build -t livekit-cpp-sdk . -f docker/Dockerfile
124+
docker run -it --network host livekit-cpp-sdk:latest bash
125+
```
126+
127+
## 🧪 Run Example
125128

126129
### Generate Tokens
127130
Before running any participant, create JWT tokens with the proper identity and room name, example
128131
```bash
129132
lk token create -r test -i your_own_identity --join --valid-for 99999h --dev --room=your_own_room
130133
```
131134

132-
#### SimpleRoom
135+
### SimpleRoom
133136

134137
```bash
135138
./build/examples/SimpleRoom --url $URL --token <jwt-token>
@@ -157,23 +160,23 @@ If the E2EE keys do not match between participants:
157160

158161
Press Ctrl-C to exit the example.
159162

160-
#### SimpleRpc
163+
### SimpleRpc
161164
The SimpleRpc example demonstrates how to:
162165
- Connect multiple participants to the same LiveKit room
163166
- Register RPC handlers (e.g., arrival, square-root, divide, long-calculation)
164167
- Send RPC requests from one participant to another
165168
- Handle success, application errors, unsupported methods, and timeouts
166169
- Observe round-trip times (RTT) for each RPC call
167170

168-
##### 🔑 Generate Tokens
171+
#### 🔑 Generate Tokens
169172
Before running any participant, create JWT tokens with **caller**, **greeter** and **math-genius** identities and room name.
170173
```bash
171174
lk token create -r test -i caller --join --valid-for 99999h --dev --room=your_own_room
172175
lk token create -r test -i greeter --join --valid-for 99999h --dev --room=your_own_room
173176
lk token create -r test -i math-genius --join --valid-for 99999h --dev --room=your_own_room
174177
```
175178

176-
##### ▶ Start Participants
179+
#### ▶ Start Participants
177180
Every participant is run as a separate terminal process, note --role needs to match the token identity.
178181
```bash
179182
./build/examples/SimpleRpc --url $URL --token <jwt-token> --role=math-genius
@@ -184,7 +187,7 @@ The caller will automatically:
184187
- Print round-trip times
185188
- Annotate expected successes or expected failures
186189

187-
#### SimpleDataStream
190+
### SimpleDataStream
188191
- The SimpleDataStream example demonstrates how to:
189192
- Connect multiple participants to the same LiveKit room
190193
- Register text stream and byte stream handlers by topic (e.g. "chat", "files")
@@ -194,14 +197,14 @@ The caller will automatically:
194197
- Measure and print one-way latency on the receiver using sender timestamps
195198
- Receive streamed chunks and reconstruct the full payload on the receiver
196199

197-
##### 🔑 Generate Tokens
200+
#### 🔑 Generate Tokens
198201
Before running any participant, create JWT tokens with caller and greeter identities and your room name.
199202
```bash
200203
lk token create -r test -i caller --join --valid-for 99999h --dev --room=your_own_room
201204
lk token create -r test -i greeter --join --valid-for 99999h --dev --room=your_own_room
202205
```
203206

204-
##### ▶ Start Participants
207+
#### ▶ Start Participants
205208
Start the receiver first (so it registers stream handlers before messages arrive):
206209
```bash
207210
./build/examples/SimpleDataStream --url $URL --token <jwt-token>
@@ -305,7 +308,7 @@ and a **ROS2 bridge** that maps `LogLevel` to `RCLCPP_*` macros.
305308

306309
---
307310

308-
### 🧪 Integration & Stress Tests
311+
## 🧪 Integration & Stress Tests
309312

310313
The SDK includes integration and stress tests using Google Test (gtest).
311314

@@ -323,7 +326,7 @@ The SDK includes integration and stress tests using Google Test (gtest).
323326
.\build.cmd release-tests
324327
```
325328

326-
#### Run Tests
329+
### Run Tests
327330

328331
After building, run tests using ctest or directly:
329332

@@ -341,7 +344,7 @@ ctest --output-on-failure
341344
./build-debug/bin/livekit_stress_tests --gtest_filter="*MaxPayloadStress*"
342345
```
343346

344-
#### Test Types
347+
### Test Types
345348

346349
| Executable | Description |
347350
|------------|-------------|
@@ -369,29 +372,29 @@ lk token create -r test -i rpc-caller --join --valid-for 99999h --dev --room=rpc
369372
lk token create -r test -i rpc-receiver --join --valid-for 99999h --dev --room=rpc-test-room
370373
```
371374

372-
#### Test Coverage
375+
### Test Coverage
373376

374377
- **SDK Initialization**: Initialize/shutdown lifecycle
375378
- **Room**: Room creation, options, connection
376379
- **Audio Frame**: Frame creation, manipulation, edge cases
377380
- **RPC**: Round-trip calls, max payload (15KB), timeouts, errors, concurrent calls
378381
- **Stress Tests**: High throughput, bidirectional RPC, memory pressure
379382

380-
### 🧰 Recommended Setup
381-
#### macOS
383+
## 🧰 Recommended Setup
384+
### macOS
382385
```bash
383386
brew install cmake protobuf rust
384387
```
385388

386-
#### Ubuntu / Debian
389+
### Ubuntu / Debian
387390
```bash
388391
sudo apt update
389392
sudo apt install -y cmake protobuf-compiler build-essential
390393
curl https://sh.rustup.rs -sSf | sh
391394
```
392395

393-
### 🛠️ Development Tips
394-
#### Update Rust version
396+
## 🛠️ Development Tips
397+
### Update Rust version
395398
```bash
396399
cd client-sdk-cpp
397400
git fetch origin
@@ -410,19 +413,19 @@ git -C client-sdk-rust/yuv-sys submodule update --init --recursive --checkout
410413
git submodule status --recursive
411414
```
412415

413-
#### If yuv-sys fails to build
416+
### If yuv-sys fails to build
414417
```bash
415418
cargo clean -p yuv-sys
416419
cargo build -p yuv-sys -vv
417420
```
418421

419-
#### Full clean (Rust + C++ build folders)
422+
### Full clean (Rust + C++ build folders)
420423
In some cases, you may need to perform a full clean that deletes all build artifacts from both the Rust and C++ folders:
421424
```bash
422425
./build.sh clean-all
423426
```
424427

425-
#### Clang format
428+
### Clang format
426429
CPP SDK is using clang C++ format
427430
```bash
428431
brew install clang-format

0 commit comments

Comments
 (0)