Skip to content

Commit 977ae2a

Browse files
private dep on spdlog
* CI docker build arm image, docker build example collection on linux arm/x64 * examples: LK_LOG -> std::cout/cerr
1 parent 905cca7 commit 977ae2a

37 files changed

Lines changed: 344 additions & 219 deletions

.github/workflows/builds.yml

Lines changed: 113 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -33,6 +33,9 @@ on:
3333
- .github/workflows/**
3434
workflow_dispatch:
3535

36+
permissions:
37+
contents: read
38+
3639
env:
3740
CARGO_TERM_COLOR: always
3841
# vcpkg binary caching for Windows
@@ -252,7 +255,7 @@ jobs:
252255
./build.sh clean-all || true
253256
fi
254257
255-
docker-build:
258+
docker-build-x64:
256259
name: Build (docker-linux-x64)
257260
runs-on: ubuntu-latest
258261

@@ -267,9 +270,115 @@ jobs:
267270
uses: docker/setup-buildx-action@v3
268271

269272
- name: Build Docker image
270-
run: docker build -t livekit-cpp-sdk:${{ github.sha }} . -f docker/Dockerfile
273+
run: |
274+
docker buildx build \
275+
--platform linux/amd64 \
276+
--load \
277+
-t livekit-cpp-sdk-x64:${{ github.sha }} \
278+
. \
279+
-f docker/Dockerfile
280+
281+
- name: Verify installed SDK inside image
282+
run: |
283+
docker run --rm livekit-cpp-sdk-x64:${{ github.sha }} bash -c \
284+
'test -f /opt/livekit-sdk/lib/cmake/LiveKit/LiveKitConfig.cmake'
271285
272-
- name: Build SDK inside Docker
286+
- name: Save Docker image artifact
287+
run: |
288+
docker save livekit-cpp-sdk-x64:${{ github.sha }} | gzip > livekit-cpp-sdk-x64-docker.tar.gz
289+
290+
- name: Upload Docker image artifact
291+
uses: actions/upload-artifact@v4
292+
with:
293+
name: livekit-cpp-sdk-docker-x64
294+
path: livekit-cpp-sdk-x64-docker.tar.gz
295+
retention-days: 7
296+
297+
docker-build-linux-arm64:
298+
name: Build (docker-linux-arm64)
299+
runs-on: ubuntu-24.04-arm
300+
301+
steps:
302+
- name: Checkout (with submodules)
303+
uses: actions/checkout@v4
304+
with:
305+
submodules: recursive
306+
fetch-depth: 0
307+
308+
- name: Set up Docker Buildx
309+
uses: docker/setup-buildx-action@v3
310+
311+
- name: Build Docker image
312+
run: |
313+
docker buildx build \
314+
--platform linux/arm64 \
315+
--load \
316+
-t livekit-cpp-sdk:${{ github.sha }} \
317+
. \
318+
-f docker/Dockerfile
319+
320+
- name: Verify installed SDK inside image
273321
run: |
274322
docker run --rm livekit-cpp-sdk:${{ github.sha }} bash -c \
275-
'cd /client-sdk-cpp && chmod +x build.sh && ./build.sh release-examples'
323+
'test -f /opt/livekit-sdk/lib/cmake/LiveKit/LiveKitConfig.cmake'
324+
325+
- name: Save Docker image artifact
326+
run: |
327+
docker save livekit-cpp-sdk:${{ github.sha }} | gzip > livekit-cpp-sdk-arm64-docker.tar.gz
328+
329+
- name: Upload Docker image artifact
330+
uses: actions/upload-artifact@v4
331+
with:
332+
name: livekit-cpp-sdk-docker-arm64
333+
path: livekit-cpp-sdk-arm64-docker.tar.gz
334+
retention-days: 7
335+
336+
build-collections-linux-arm64:
337+
name: Build (cpp-example-collection-linux-arm64)
338+
runs-on: ubuntu-24.04-arm
339+
needs: docker-build-linux-arm64
340+
341+
steps:
342+
- name: Download Docker image artifact
343+
uses: actions/download-artifact@v4
344+
with:
345+
name: livekit-cpp-sdk-docker-arm64
346+
347+
- name: Load Docker image
348+
run: gzip -dc livekit-cpp-sdk-arm64-docker.tar.gz | docker load
349+
350+
- name: Build cpp-example-collection against installed SDK
351+
run: |
352+
docker run --rm livekit-cpp-sdk:${{ github.sha }} bash -lc '
353+
set -euxo pipefail
354+
git clone https://github.com/livekit-examples/cpp-example-collection.git /tmp/cpp-example-collection
355+
cd /tmp/cpp-example-collection
356+
git checkout sderosa/examples-migration
357+
cmake -S . -B build -DLIVEKIT_LOCAL_SDK_DIR=/opt/livekit-sdk
358+
cmake --build build --parallel
359+
'
360+
361+
build-collections-x64:
362+
name: Build (cpp-example-collection-x64)
363+
runs-on: ubuntu-latest
364+
needs: docker-build-x64
365+
366+
steps:
367+
- name: Download Docker image artifact
368+
uses: actions/download-artifact@v4
369+
with:
370+
name: livekit-cpp-sdk-docker-x64
371+
372+
- name: Load Docker image
373+
run: gzip -dc livekit-cpp-sdk-x64-docker.tar.gz | docker load
374+
375+
- name: Build cpp-example-collection against installed SDK
376+
run: |
377+
docker run --rm livekit-cpp-sdk-x64:${{ github.sha }} bash -lc '
378+
set -euxo pipefail
379+
git clone https://github.com/livekit-examples/cpp-example-collection.git /tmp/cpp-example-collection
380+
cd /tmp/cpp-example-collection
381+
git checkout sderosa/examples-migration
382+
cmake -S . -B build -DLIVEKIT_LOCAL_SDK_DIR=/opt/livekit-sdk
383+
cmake --build build --parallel
384+
'

CMakeLists.txt

Lines changed: 1 addition & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -378,9 +378,8 @@ target_include_directories(livekit
378378
)
379379

380380
target_link_libraries(livekit
381-
PUBLIC
382-
$<BUILD_INTERFACE:spdlog::spdlog>
383381
PRIVATE
382+
spdlog::spdlog
384383
livekit_ffi
385384
${LIVEKIT_PROTOBUF_TARGET}
386385
)

bridge/CMakeLists.txt

Lines changed: 0 additions & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -32,13 +32,6 @@ target_include_directories(livekit_bridge
3232
target_link_libraries(livekit_bridge
3333
PUBLIC
3434
livekit
35-
PRIVATE
36-
spdlog::spdlog
37-
)
38-
39-
target_compile_definitions(livekit_bridge
40-
PRIVATE
41-
SPDLOG_ACTIVE_LEVEL=${_SPDLOG_ACTIVE_LEVEL}
4235
)
4336

4437
if(MSVC)

bridge/include/livekit_bridge/livekit_bridge.h

Lines changed: 0 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -23,7 +23,6 @@
2323
#include "livekit_bridge/bridge_video_track.h"
2424
#include "livekit_bridge/rpc_constants.h"
2525

26-
#include "livekit/lk_log.h"
2726
#include "livekit/local_participant.h"
2827
#include "livekit/room.h"
2928
#include "livekit/rpc_error.h"

bridge/src/bridge_audio_track.cpp

Lines changed: 5 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -24,10 +24,9 @@
2424
#include "livekit/local_audio_track.h"
2525
#include "livekit/local_participant.h"
2626

27+
#include <iostream>
2728
#include <stdexcept>
2829

29-
#include "livekit/lk_log.h"
30-
3130
namespace livekit_bridge {
3231

3332
BridgeAudioTrack::BridgeAudioTrack(
@@ -56,7 +55,7 @@ bool BridgeAudioTrack::pushFrame(const std::vector<std::int16_t> &data,
5655
try {
5756
source_->captureFrame(frame, timeout_ms);
5857
} catch (const std::exception &e) {
59-
LK_LOG_ERROR("BridgeAudioTrack captureFrame error: {}", e.what());
58+
std::cerr << "[error] BridgeAudioTrack captureFrame error: " << e.what() << "\n";
6059
return false;
6160
}
6261
return true;
@@ -77,7 +76,7 @@ bool BridgeAudioTrack::pushFrame(const std::int16_t *data,
7776
try {
7877
source_->captureFrame(frame, timeout_ms);
7978
} catch (const std::exception &e) {
80-
LK_LOG_ERROR("BridgeAudioTrack captureFrame error: {}", e.what());
79+
std::cerr << "[error] BridgeAudioTrack captureFrame error: " << e.what() << "\n";
8180
return false;
8281
}
8382
return true;
@@ -115,8 +114,8 @@ void BridgeAudioTrack::release() {
115114
participant_->unpublishTrack(track_->publication()->sid());
116115
} catch (...) {
117116
// Best-effort cleanup; ignore errors during teardown
118-
LK_LOG_WARN("BridgeAudioTrack unpublishTrack error, continuing with "
119-
"cleanup");
117+
std::cerr << "[warn] BridgeAudioTrack unpublishTrack error, continuing "
118+
"with cleanup\n";
120119
}
121120
}
122121

bridge/src/bridge_video_track.cpp

Lines changed: 5 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -24,10 +24,9 @@
2424
#include "livekit/video_frame.h"
2525
#include "livekit/video_source.h"
2626

27+
#include <iostream>
2728
#include <stdexcept>
2829

29-
#include "livekit/lk_log.h"
30-
3130
namespace livekit_bridge {
3231

3332
BridgeVideoTrack::BridgeVideoTrack(
@@ -56,7 +55,7 @@ bool BridgeVideoTrack::pushFrame(const std::vector<std::uint8_t> &rgba,
5655
try {
5756
source_->captureFrame(frame, timestamp_us);
5857
} catch (const std::exception &e) {
59-
LK_LOG_ERROR("BridgeVideoTrack captureFrame error: {}", e.what());
58+
std::cerr << "[error] BridgeVideoTrack captureFrame error: " << e.what() << "\n";
6059
return false;
6160
}
6261
return true;
@@ -76,7 +75,7 @@ bool BridgeVideoTrack::pushFrame(const std::uint8_t *rgba,
7675
try {
7776
source_->captureFrame(frame, timestamp_us);
7877
} catch (const std::exception &e) {
79-
LK_LOG_ERROR("BridgeVideoTrack captureFrame error: {}", e.what());
78+
std::cerr << "[error] BridgeVideoTrack captureFrame error: " << e.what() << "\n";
8079
return false;
8180
}
8281
return true;
@@ -114,8 +113,8 @@ void BridgeVideoTrack::release() {
114113
participant_->unpublishTrack(track_->publication()->sid());
115114
} catch (...) {
116115
// Best-effort cleanup; ignore errors during teardown
117-
LK_LOG_WARN("BridgeVideoTrack unpublishTrack error, continuing with "
118-
"cleanup");
116+
std::cerr << "[warn] BridgeVideoTrack unpublishTrack error, continuing "
117+
"with cleanup\n";
119118
}
120119
}
121120

bridge/src/livekit_bridge.cpp

Lines changed: 7 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -34,6 +34,7 @@
3434
#include "livekit/video_source.h"
3535

3636
#include <cassert>
37+
#include <iostream>
3738
#include <stdexcept>
3839

3940
namespace livekit_bridge {
@@ -122,8 +123,8 @@ void LiveKitBridge::disconnect() {
122123
std::lock_guard<std::mutex> lock(mutex_);
123124

124125
if (!connected_) {
125-
LK_LOG_WARN("Attempting to disconnect an already disconnected bridge. "
126-
"Things may not disconnect properly.");
126+
std::cerr << "[warn] Attempting to disconnect an already disconnected "
127+
"bridge. Things may not disconnect properly.\n";
127128
}
128129

129130
connected_ = false;
@@ -241,7 +242,8 @@ void LiveKitBridge::setOnAudioFrameCallback(
241242
AudioFrameCallback callback) {
242243
std::lock_guard<std::mutex> lock(mutex_);
243244
if (!room_) {
244-
LK_LOG_WARN("setOnAudioFrameCallback called before connect(); ignored");
245+
std::cerr << "[warn] setOnAudioFrameCallback called before connect(); "
246+
"ignored\n";
245247
return;
246248
}
247249
room_->setOnAudioFrameCallback(participant_identity, source,
@@ -253,7 +255,8 @@ void LiveKitBridge::setOnVideoFrameCallback(
253255
VideoFrameCallback callback) {
254256
std::lock_guard<std::mutex> lock(mutex_);
255257
if (!room_) {
256-
LK_LOG_WARN("setOnVideoFrameCallback called before connect(); ignored");
258+
std::cerr << "[warn] setOnVideoFrameCallback called before connect(); "
259+
"ignored\n";
257260
return;
258261
}
259262
room_->setOnVideoFrameCallback(participant_identity, source,

cmake/LiveKitConfig.cmake.in

Lines changed: 0 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -1,7 +1,4 @@
11
@PACKAGE_INIT@
22

3-
include(CMakeFindDependencyMacro)
4-
find_dependency(spdlog)
5-
63
include("${CMAKE_CURRENT_LIST_DIR}/LiveKitTargets.cmake")
74

docker/Dockerfile

Lines changed: 18 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -22,25 +22,33 @@ FROM ubuntu:22.04
2222

2323
ENV DEBIAN_FRONTEND=noninteractive
2424
ENV HOME=/root
25+
ENV SDK_INSTALL_PREFIX=/opt/livekit-sdk
2526

2627
# Install make, pkg-config, and base build deps (pkg-config + libglib2.0-dev for Rust glib-sys, libasound2-dev for alsa-sys)
2728
RUN apt-get update && apt-get install -y --no-install-recommends \
2829
ca-certificates \
2930
curl \
3031
git \
3132
libasound2-dev \
33+
libabsl-dev \
3234
libclang-dev \
3335
libdrm-dev \
3436
libglib2.0-dev \
37+
libprotobuf-dev \
38+
libdecor-0-dev \
3539
libspdlog-dev \
3640
libssl-dev \
3741
libunwind-dev \
3842
libusb-1.0-0-dev \
3943
libva-dev \
44+
libwayland-dev \
4045
make \
4146
ninja-build \
4247
pkg-config \
48+
protobuf-compiler \
4349
wget \
50+
llvm-dev \
51+
clang \
4452
xz-utils \
4553
&& rm -rf /var/lib/apt/lists/*
4654

@@ -122,3 +130,13 @@ RUN mkdir -p /client-sdk-cpp/client-sdk-rust/.cargo \
122130
&& printf '%s\n' '[target.x86_64-unknown-linux-gnu]' 'linker = "/root/gcc-14/bin/g++"' \
123131
'[target.aarch64-unknown-linux-gnu]' 'linker = "/root/gcc-14/bin/g++"' > /client-sdk-cpp/client-sdk-rust/.cargo/config.toml
124132

133+
# Build and install the SDK into a fixed prefix so downstream projects can
134+
# consume the image as a prebuilt LiveKit SDK environment.
135+
RUN LLVM_VERSION="$(llvm-config --version | cut -d. -f1)" \
136+
&& export LIBCLANG_PATH="/usr/lib/llvm-${LLVM_VERSION}/lib" \
137+
&& export CXXFLAGS="-Wno-deprecated-declarations" \
138+
&& export CFLAGS="-Wno-deprecated-declarations" \
139+
&& chmod +x /client-sdk-cpp/build.sh \
140+
&& cd /client-sdk-cpp \
141+
&& ./build.sh release --bundle --prefix "${SDK_INSTALL_PREFIX}" \
142+
&& test -f "${SDK_INSTALL_PREFIX}/lib/cmake/LiveKit/LiveKitConfig.cmake"

0 commit comments

Comments
 (0)