Skip to content

Commit a6ee159

Browse files
committed
feat: use vcpkg only on Windows, system packages on Linux/macOS
1 parent 0d324e4 commit a6ee159

File tree

6 files changed

+135
-65
lines changed

6 files changed

+135
-65
lines changed

.github/workflows/builds.yml

Lines changed: 10 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -10,7 +10,7 @@ on:
1010
- client-sdk-rust/**
1111
- CMakeLists.txt
1212
- build.sh
13-
- build.bat
13+
- build.cmd
1414
- vcpkg.json
1515
- CMakePresets.json
1616
- .github/workflows/**
@@ -23,14 +23,15 @@ on:
2323
- client-sdk-rust/**
2424
- CMakeLists.txt
2525
- build.sh
26-
- build.bat
26+
- build.cmd
2727
- vcpkg.json
2828
- CMakePresets.json
2929
- .github/workflows/**
3030
workflow_dispatch:
3131

3232
env:
3333
CARGO_TERM_COLOR: always
34+
# vcpkg binary caching only needed for Windows
3435
VCPKG_BINARY_SOURCES: "clear;x-gha,readwrite"
3536

3637
jobs:
@@ -56,13 +57,15 @@ jobs:
5657
fetch-depth: 0
5758

5859
- name: Export GitHub Actions cache environment variables
60+
if: runner.os == 'Windows'
5961
uses: actions/github-script@v7
6062
with:
6163
script: |
6264
core.exportVariable('ACTIONS_CACHE_URL', process.env.ACTIONS_CACHE_URL || '');
6365
core.exportVariable('ACTIONS_RUNTIME_TOKEN', process.env.ACTIONS_RUNTIME_TOKEN || '');
6466
65-
- name: Setup vcpkg
67+
- name: Setup vcpkg (Windows only)
68+
if: runner.os == 'Windows'
6669
uses: lukka/run-vcpkg@v11
6770
with:
6871
vcpkgGitCommitId: 'c82f74667287d3dc386bce81e44964370c91a289'
@@ -79,14 +82,16 @@ jobs:
7982
libxext-dev libxcomposite-dev libxdamage-dev libxfixes-dev \
8083
libxrandr-dev libxi-dev libxkbcommon-dev \
8184
libasound2-dev libpulse-dev \
82-
libssl-dev
85+
libssl-dev \
86+
libprotobuf-dev protobuf-compiler \
87+
libabsl-dev
8388
8489
- name: Install system deps (macOS)
8590
if: runner.os == 'macOS'
8691
run: |
8792
set -eux
8893
brew update
89-
brew install cmake ninja
94+
brew install cmake ninja protobuf abseil
9095
9196
- name: Install Rust (stable)
9297
uses: dtolnay/rust-toolchain@stable

CMakeLists.txt

Lines changed: 7 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -10,7 +10,13 @@ set(LIVEKIT_ROOT_DIR ${CMAKE_CURRENT_SOURCE_DIR})
1010
set(LIVEKIT_BINARY_DIR ${CMAKE_CURRENT_BINARY_DIR})
1111

1212
option(LIVEKIT_BUILD_EXAMPLES "Build LiveKit examples" OFF)
13-
option(LIVEKIT_USE_VCPKG "Use vcpkg for dependency management" ON)
13+
14+
# vcpkg is only used on Windows; Linux/macOS use system package managers
15+
if(WIN32)
16+
option(LIVEKIT_USE_VCPKG "Use vcpkg for dependency management (Windows only)" ON)
17+
else()
18+
option(LIVEKIT_USE_VCPKG "Use vcpkg for dependency management" OFF)
19+
endif()
1420

1521
set(CMAKE_CXX_STANDARD 17)
1622
set(CMAKE_CXX_STANDARD_REQUIRED ON)

CMakePresets.json

Lines changed: 42 additions & 11 deletions
Original file line numberDiff line numberDiff line change
@@ -14,7 +14,8 @@
1414
"type": "FILEPATH",
1515
"value": "$env{VCPKG_ROOT}/scripts/buildsystems/vcpkg.cmake"
1616
},
17-
"VCPKG_INSTALLED_DIR": "${sourceDir}/vcpkg_installed"
17+
"VCPKG_INSTALLED_DIR": "${sourceDir}/vcpkg_installed",
18+
"LIVEKIT_USE_VCPKG": "ON"
1819
}
1920
},
2021
{
@@ -33,8 +34,10 @@
3334
{
3435
"name": "linux-base",
3536
"hidden": true,
36-
"inherits": "vcpkg",
3737
"generator": "Ninja",
38+
"cacheVariables": {
39+
"LIVEKIT_USE_VCPKG": "OFF"
40+
},
3841
"condition": {
3942
"type": "equals",
4043
"lhs": "${hostSystemName}",
@@ -44,8 +47,10 @@
4447
{
4548
"name": "macos-base",
4649
"hidden": true,
47-
"inherits": "vcpkg",
4850
"generator": "Ninja",
51+
"cacheVariables": {
52+
"LIVEKIT_USE_VCPKG": "OFF"
53+
},
4954
"condition": {
5055
"type": "equals",
5156
"lhs": "${hostSystemName}",
@@ -55,14 +60,14 @@
5560
{
5661
"name": "windows-release",
5762
"displayName": "Windows x64 Release",
58-
"description": "Build for Windows x64 Release",
63+
"description": "Build for Windows x64 Release (vcpkg)",
5964
"inherits": "windows-base",
6065
"binaryDir": "${sourceDir}/build"
6166
},
6267
{
6368
"name": "windows-debug",
6469
"displayName": "Windows x64 Debug",
65-
"description": "Build for Windows x64 Debug",
70+
"description": "Build for Windows x64 Debug (vcpkg)",
6671
"inherits": "windows-base",
6772
"binaryDir": "${sourceDir}/build"
6873
},
@@ -80,13 +85,23 @@
8085
{
8186
"name": "linux-release",
8287
"displayName": "Linux Release",
83-
"description": "Build for Linux Release",
88+
"description": "Build for Linux Release (system packages)",
8489
"inherits": "linux-base",
8590
"binaryDir": "${sourceDir}/build",
8691
"cacheVariables": {
8792
"CMAKE_BUILD_TYPE": "Release"
8893
}
8994
},
95+
{
96+
"name": "linux-debug",
97+
"displayName": "Linux Debug",
98+
"description": "Build for Linux Debug (system packages)",
99+
"inherits": "linux-base",
100+
"binaryDir": "${sourceDir}/build",
101+
"cacheVariables": {
102+
"CMAKE_BUILD_TYPE": "Debug"
103+
}
104+
},
90105
{
91106
"name": "linux-release-examples",
92107
"displayName": "Linux Release with Examples",
@@ -95,20 +110,29 @@
95110
"binaryDir": "${sourceDir}/build",
96111
"cacheVariables": {
97112
"CMAKE_BUILD_TYPE": "Release",
98-
"LIVEKIT_BUILD_EXAMPLES": "ON",
99-
"VCPKG_MANIFEST_FEATURES": "examples"
113+
"LIVEKIT_BUILD_EXAMPLES": "ON"
100114
}
101115
},
102116
{
103117
"name": "macos-release",
104118
"displayName": "macOS Release",
105-
"description": "Build for macOS Release",
119+
"description": "Build for macOS Release (Homebrew packages)",
106120
"inherits": "macos-base",
107121
"binaryDir": "${sourceDir}/build",
108122
"cacheVariables": {
109123
"CMAKE_BUILD_TYPE": "Release"
110124
}
111125
},
126+
{
127+
"name": "macos-debug",
128+
"displayName": "macOS Debug",
129+
"description": "Build for macOS Debug (Homebrew packages)",
130+
"inherits": "macos-base",
131+
"binaryDir": "${sourceDir}/build",
132+
"cacheVariables": {
133+
"CMAKE_BUILD_TYPE": "Debug"
134+
}
135+
},
112136
{
113137
"name": "macos-release-examples",
114138
"displayName": "macOS Release with Examples",
@@ -117,8 +141,7 @@
117141
"binaryDir": "${sourceDir}/build",
118142
"cacheVariables": {
119143
"CMAKE_BUILD_TYPE": "Release",
120-
"LIVEKIT_BUILD_EXAMPLES": "ON",
121-
"VCPKG_MANIFEST_FEATURES": "examples"
144+
"LIVEKIT_BUILD_EXAMPLES": "ON"
122145
}
123146
}
124147
],
@@ -142,6 +165,10 @@
142165
"name": "linux-release",
143166
"configurePreset": "linux-release"
144167
},
168+
{
169+
"name": "linux-debug",
170+
"configurePreset": "linux-debug"
171+
},
145172
{
146173
"name": "linux-release-examples",
147174
"configurePreset": "linux-release-examples"
@@ -150,6 +177,10 @@
150177
"name": "macos-release",
151178
"configurePreset": "macos-release"
152179
},
180+
{
181+
"name": "macos-debug",
182+
"configurePreset": "macos-debug"
183+
},
153184
{
154185
"name": "macos-release-examples",
155186
"configurePreset": "macos-release-examples"

DEPENDENCIES.md

Lines changed: 26 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -8,7 +8,9 @@ The LiveKit SDK consists of two static libraries:
88
- `livekit.lib` (or `liblivekit.a` on Unix)
99
- `livekit_ffi.lib` (or `liblivekit_ffi.a` on Unix)
1010

11-
**IMPORTANT**: Static libraries do NOT include system dependencies. You must link these system libraries in your final executable.
11+
**IMPORTANT**:
12+
- **Windows**: All dependencies (protobuf, abseil) are included as DLLs in the distribution. You just need to copy them alongside your executable.
13+
- **Linux/macOS**: You must install protobuf and abseil via your system package manager (apt/brew). The SDK links dynamically against these libraries.
1214

1315
---
1416

@@ -122,16 +124,37 @@ Also add `-ObjC` to **Other Linker Flags**.
122124

123125
## Linux Dependencies
124126

125-
When linking on Linux, you must add OpenSSL:
127+
### Required System Packages
128+
129+
First, install the required development packages:
130+
131+
```bash
132+
# Ubuntu/Debian
133+
sudo apt install libprotobuf-dev protobuf-compiler libabsl-dev libssl-dev
134+
135+
# Fedora/RHEL
136+
sudo dnf install protobuf-devel abseil-cpp-devel openssl-devel
137+
```
138+
139+
### CMake Configuration
126140

127141
```cmake
142+
find_package(Protobuf REQUIRED)
143+
find_package(absl REQUIRED)
128144
find_package(OpenSSL REQUIRED)
129145
130146
target_link_libraries(your_app PRIVATE
131147
# LiveKit static libraries
132148
livekit
133149
livekit_ffi
134150
151+
# Protobuf and Abseil (REQUIRED)
152+
protobuf::libprotobuf
153+
absl::log
154+
absl::check
155+
absl::strings
156+
absl::base
157+
135158
# Linux system libraries (REQUIRED)
136159
OpenSSL::SSL
137160
OpenSSL::Crypto
@@ -146,6 +169,7 @@ g++ your_app.cpp \
146169
-I/path/to/livekit/include \
147170
-L/path/to/livekit/lib \
148171
-llivekit -llivekit_ffi \
172+
-lprotobuf -labsl_log -labsl_strings -labsl_base \
149173
-lssl -lcrypto -lpthread -ldl
150174
```
151175

README.md

Lines changed: 13 additions & 14 deletions
Original file line numberDiff line numberDiff line change
@@ -7,15 +7,14 @@ This SDK enables native C++ applications to connect to LiveKit servers for real-
77
## 📦 Requirements
88
- **CMake** ≥ 3.20
99
- **Rust / Cargo** (latest stable toolchain)
10-
- **vcpkg** (for dependency management)
1110
- **Git LFS** (required for examples)
1211
Some example data files (e.g., audio assets) are stored using Git LFS.
1312
You must install Git LFS before cloning or pulling the repo if you want to run the examples.
1413

1514
**Platform-Specific Requirements:**
16-
- **Windows:** Visual Studio 2019 or later
17-
- **macOS:** System frameworks (CoreAudio, AudioToolbox, etc.) are automatically linked
18-
- **Linux:** See [README_BUILD.md](README_BUILD.md) for system dependencies
15+
- **Windows:** Visual Studio 2019+, vcpkg (dependencies bundled in distribution)
16+
- **Linux:** `sudo apt install libprotobuf-dev libabsl-dev libssl-dev`
17+
- **macOS:** `brew install protobuf abseil`
1918

2019
## 🧩 Clone the Repository
2120

@@ -46,28 +45,28 @@ git submodule update --init --recursive
4645

4746
**Windows:**
4847
```powershell
49-
.\build.bat clean # Clean CMake build artifacts
50-
.\build.bat clean-all # Deep clean (C++ + Rust + generated files)
51-
.\build.bat debug # Build Debug version
52-
.\build.bat release # Build Release version
53-
.\build.bat verbose # Verbose build output
48+
.\build.cmd clean # Clean CMake build artifacts
49+
.\build.cmd clean-all # Deep clean (C++ + Rust + generated files)
50+
.\build.cmd debug # Build Debug version
51+
.\build.cmd release # Build Release version
52+
.\build.cmd verbose # Verbose build output
5453
```
5554

5655
### Advanced Build (Using CMake Presets)
5756

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

60-
**Prerequisites:**
59+
**Prerequisites (Windows only):**
6160
- Set `VCPKG_ROOT` environment variable pointing to your vcpkg installation
6261

63-
```bash
64-
# Linux/macOS
65-
export VCPKG_ROOT=/path/to/vcpkg
66-
62+
```powershell
6763
# Windows PowerShell
6864
$env:VCPKG_ROOT = "C:\path\to\vcpkg"
6965
```
7066

67+
**Prerequisites (Linux/macOS):**
68+
- Install system dependencies (see above)
69+
7170
**Quick start:**
7271
```bash
7372
# Windows

0 commit comments

Comments
 (0)