Skip to content

windows vcpkg support #68

windows vcpkg support

windows vcpkg support #68

Workflow file for this run

name: Builds
on:
push:
branches: ["main"]
paths:
- src/**
- include/**
- examples/**
- client-sdk-rust/**
- CMakeLists.txt
- build.sh
- build.cmd
- vcpkg.json
- CMakePresets.json
- .github/workflows/**
pull_request:
branches: ["main"]
paths:
- src/**
- include/**
- examples/**
- client-sdk-rust/**
- CMakeLists.txt
- build.sh
- build.cmd
- vcpkg.json
- CMakePresets.json
- .github/workflows/**
workflow_dispatch:
env:
CARGO_TERM_COLOR: always
# vcpkg binary caching only needed for Windows
VCPKG_BINARY_SOURCES: "clear;x-gha,readwrite"
jobs:
build:
strategy:
fail-fast: false
matrix:
include:
- os: ubuntu-latest
preset: linux-release-examples
- os: macos-latest
preset: macos-release-examples
- os: windows-latest
preset: windows-release-examples
name: ${{ matrix.os }}
runs-on: ${{ matrix.os }}
steps:
- name: Checkout (with submodules)
uses: actions/checkout@v4
with:
submodules: recursive
fetch-depth: 0
- name: Export GitHub Actions cache environment variables
if: runner.os == 'Windows'
uses: actions/github-script@v7
with:
script: |
core.exportVariable('ACTIONS_CACHE_URL', process.env.ACTIONS_CACHE_URL || '');
core.exportVariable('ACTIONS_RUNTIME_TOKEN', process.env.ACTIONS_RUNTIME_TOKEN || '');
- name: Setup vcpkg (Windows only)
if: runner.os == 'Windows'
uses: lukka/run-vcpkg@v11
with:
vcpkgGitCommitId: 'c82f74667287d3dc386bce81e44964370c91a289'
- name: Install system deps (Ubuntu)
if: runner.os == 'Linux'
run: |
set -eux
sudo apt-get update
sudo apt-get install -y \
build-essential cmake ninja-build pkg-config \
llvm-dev libclang-dev clang \
libva-dev libdrm-dev libgbm-dev libx11-dev libgl1-mesa-dev \
libxext-dev libxcomposite-dev libxdamage-dev libxfixes-dev \
libxrandr-dev libxi-dev libxkbcommon-dev \
libasound2-dev libpulse-dev \
libssl-dev \
libprotobuf-dev protobuf-compiler \
libabsl-dev \
libwayland-dev libdecor-0-dev # For SDL3
- name: Install system deps (macOS)
if: runner.os == 'macOS'
run: |
set -eux
brew update
brew install cmake ninja protobuf abseil
- name: Install Rust (stable)
uses: dtolnay/rust-toolchain@stable
- name: Cache Cargo registry
uses: actions/cache@v4
with:
path: |
~/.cargo/registry
~/.cargo/git
key: ${{ runner.os }}-cargo-reg-${{ hashFiles('**/Cargo.lock') }}
restore-keys: ${{ runner.os }}-cargo-reg-
- name: Cache Cargo target
uses: actions/cache@v4
with:
path: client-sdk-rust/target
key: ${{ runner.os }}-cargo-target-${{ hashFiles('**/Cargo.lock') }}
restore-keys: |
${{ runner.os }}-cargo-target-
- name: Set Linux build environment
if: runner.os == 'Linux'
run: |
echo "CXXFLAGS=-Wno-deprecated-declarations" >> $GITHUB_ENV
echo "CFLAGS=-Wno-deprecated-declarations" >> $GITHUB_ENV
# Find libclang path
LLVM_VERSION=$(llvm-config --version | cut -d. -f1)
echo "LIBCLANG_PATH=/usr/lib/llvm-${LLVM_VERSION}/lib" >> $GITHUB_ENV
- name: Configure CMake
run: cmake --preset ${{ matrix.preset }}
- name: Build
run: cmake --build --preset ${{ matrix.preset }}
- name: Smoke test examples (Unix)
if: runner.os != 'Windows'
shell: bash
run: |
set -x
failed=false
for exe in SimpleRoom SimpleRpc SimpleDataStream; do
exe_path="build/bin/${exe}"
if [[ -x "${exe_path}" ]]; then
echo "Testing ${exe}..."
# Capture output to verify program actually runs
output=$("${exe_path}" --help 2>&1) || true
if [[ -z "${output}" ]]; then
echo "ERROR: ${exe} produced no output - may have failed to start"
failed=true
else
echo "${output}"
echo "${exe} ran successfully"
fi
else
echo "ERROR: ${exe_path} not found or not executable"
failed=true
fi
done
if [[ "$failed" == "true" ]]; then exit 1; fi
- name: Smoke test examples (Windows)
if: runner.os == 'Windows'
shell: pwsh
run: |
$ErrorActionPreference = 'Continue'
$examples = @('SimpleRoom', 'SimpleRpc', 'SimpleDataStream')
$failed = $false
foreach ($exe in $examples) {
$exePath = "build/bin/Release/${exe}.exe"
if (Test-Path $exePath) {
Write-Host "Testing ${exe}..."
# Capture output to verify program actually runs
# Use Start-Process to avoid PowerShell error handling issues
$pinfo = New-Object System.Diagnostics.ProcessStartInfo
$pinfo.FileName = $exePath
$pinfo.Arguments = "--help"
$pinfo.RedirectStandardOutput = $true
$pinfo.RedirectStandardError = $true
$pinfo.UseShellExecute = $false
$p = New-Object System.Diagnostics.Process
$p.StartInfo = $pinfo
$p.Start() | Out-Null
$stdout = $p.StandardOutput.ReadToEnd()
$stderr = $p.StandardError.ReadToEnd()
$p.WaitForExit()
$output = $stdout + $stderr
if ([string]::IsNullOrWhiteSpace($output)) {
Write-Host "ERROR: ${exe} produced no output - may have failed to start"
$failed = $true
} else {
Write-Host $output
Write-Host "${exe} ran successfully"
}
} else {
Write-Host "ERROR: ${exePath} not found"
$failed = $true
}
}
if ($failed) { exit 1 } else { exit 0 }
- name: Upload build artifacts
uses: actions/upload-artifact@v4
with:
name: livekit-sdk-${{ matrix.os }}
path: |
build/lib/
build/include/
build/bin/
retention-days: 7
- name: Clean after build (best-effort)
if: always()
shell: bash
run: |
if [[ "$RUNNER_OS" == "Windows" ]]; then
rm -rf build || true
else
[[ -x build.sh ]] && ./build.sh clean || true
fi