Skip to content

Commit 1945603

Browse files
group examples, build.sh
1 parent dd5e5d8 commit 1945603

37 files changed

Lines changed: 72 additions & 11 deletions

CMakeLists.txt

Lines changed: 8 additions & 8 deletions
Original file line numberDiff line numberDiff line change
@@ -62,11 +62,11 @@ add_subdirectory(basic_room)
6262
add_subdirectory(simple_room)
6363
add_subdirectory(simple_rpc)
6464
add_subdirectory(simple_data_stream)
65-
add_subdirectory(logging_levels_basic_usage)
66-
add_subdirectory(logging_levels_custom_sinks)
67-
add_subdirectory(hello_livekit_sender)
68-
add_subdirectory(hello_livekit_receiver)
69-
add_subdirectory(simple_joystick_sender)
70-
add_subdirectory(simple_joystick_receiver)
71-
add_subdirectory(ping_pong_ping)
72-
add_subdirectory(ping_pong_pong)
65+
add_subdirectory(logging_levels/basic_usage)
66+
add_subdirectory(logging_levels/custom_sinks)
67+
add_subdirectory(hello_livekit/sender)
68+
add_subdirectory(hello_livekit/receiver)
69+
add_subdirectory(simple_joystick/sender)
70+
add_subdirectory(simple_joystick/receiver)
71+
add_subdirectory(ping_pong/ping)
72+
add_subdirectory(ping_pong/pong)

README.md

Lines changed: 13 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -6,6 +6,10 @@ The goal of these examples is to demonstrate common usage patterns of the
66
LiveKit C++ SDK (connecting to a room, publishing tracks, RPC, data streams,
77
etc.) without requiring users to build the SDK from source.
88

9+
Related examples are grouped under shared folders. For example, the ping-pong
10+
examples now live under `ping_pong/`, and paired sender/receiver examples are
11+
grouped together similarly.
12+
913

1014
## How the SDK is provided
1115

@@ -63,21 +67,27 @@ The Livekit Release SDK is downloaded into **build/_deps/livekit-sdk/**
6367

6468
### Running the examples
6569

66-
After building, example binaries are located under:
70+
After building, example binaries are located under their corresponding build
71+
subdirectories:
6772
```bash
68-
build/<example-name>/
73+
build/<example-path>/
6974
```
7075

7176
For example:
7277
```bash
7378
./build/basic_room/basic_room --url <ws-url> --token <token>
7479
```
7580

81+
Grouped examples follow the same pattern, for example:
82+
```bash
83+
./build/ping_pong/ping/PingPongPing --url <ws-url> --token <token>
84+
```
85+
7686
### Supported platforms
7787

7888
Prebuilt SDKs are downloaded automatically for:
7989
* Windows: x64
8090
* macOS: x64, arm64 (Apple Silicon)
8191
* Linux: x64
8292

83-
If no matching SDK is available for your platform, CMake configuration will fail with a clear error.
93+
If no matching SDK is available for your platform, CMake configuration will fail with a clear error.

build.sh

Lines changed: 51 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,51 @@
1+
#!/usr/bin/env bash
2+
# Copyright 2026 LiveKit
3+
#
4+
# Licensed under the Apache License, Version 2.0 (the "License");
5+
# you may not use this file except in compliance with the License.
6+
# You may obtain a copy of the License at
7+
#
8+
# http://www.apache.org/licenses/LICENSE-2.0
9+
#
10+
# Unless required by applicable law or agreed to in writing, software
11+
# distributed under the License is distributed on an "AS IS" BASIS,
12+
# WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
13+
# See the License for the specific language governing permissions and
14+
# limitations under the License.
15+
16+
set -euo pipefail
17+
18+
usage() {
19+
cat <<EOF
20+
Usage: ./build.sh [clean] [--help] [CMAKE_ARGS...]
21+
22+
Options:
23+
clean Remove the build directory before building
24+
--help, -h Show this help message and exit
25+
26+
Extra arguments are forwarded to cmake, e.g.:
27+
./build.sh -DLIVEKIT_SDK_VERSION=0.3.0
28+
./build.sh clean -DCMAKE_BUILD_TYPE=Release
29+
./build.sh -DLIVEKIT_LOCAL_SDK_DIR=<path-to-local-sdk-install-prefix>
30+
EOF
31+
}
32+
33+
SCRIPT_DIR="$(cd "$(dirname "${BASH_SOURCE[0]}")" && pwd)"
34+
BUILD_DIR="${SCRIPT_DIR}/build"
35+
36+
if [[ "${1:-}" == "--help" || "${1:-}" == "-h" ]]; then
37+
usage
38+
exit 0
39+
fi
40+
41+
if [[ "${1:-}" == "clean" ]]; then
42+
echo "Removing ${BUILD_DIR} ..."
43+
rm -rf "${BUILD_DIR}"
44+
shift
45+
fi
46+
47+
mkdir -p "${BUILD_DIR}"
48+
cd "${BUILD_DIR}"
49+
50+
cmake "${SCRIPT_DIR}" "$@"
51+
cmake --build . --parallel
File renamed without changes.

0 commit comments

Comments
 (0)