diff --git a/.github/workflows/builds.yml b/.github/workflows/builds.yml index efdf7431..f3fda0da 100644 --- a/.github/workflows/builds.yml +++ b/.github/workflows/builds.yml @@ -34,32 +34,32 @@ jobs: include: - os: ubuntu-22.04 name: ubuntu-22.04-x64 - build_cmd: ./build.sh release-examples + build_cmd: ./build.sh release-examples --bundle --prefix sdk-out/livekit-sdk-ubuntu-22.04-x64 build_dir: build-release - os: ubuntu-22.04-arm name: ubuntu-22.04-arm64 - build_cmd: ./build.sh release-examples + build_cmd: ./build.sh release-examples --bundle --prefix sdk-out/livekit-sdk-ubuntu-22.04-arm64 build_dir: build-release - os: ubuntu-24.04 name: ubuntu-24.04-x64 - build_cmd: ./build.sh release-examples + build_cmd: ./build.sh release-examples --bundle --prefix sdk-out/livekit-sdk-ubuntu-24.04-x64 build_dir: build-release - os: ubuntu-24.04-arm name: ubuntu-24.04-arm64 - build_cmd: ./build.sh release-examples + build_cmd: ./build.sh release-examples --bundle --prefix sdk-out/livekit-sdk-ubuntu-24.04-arm64 build_dir: build-release - os: macos-26-xlarge name: macos-arm64 - build_cmd: ./build.sh release-examples + build_cmd: ./build.sh release-examples --bundle --prefix sdk-out/livekit-sdk-macos-arm64 build_dir: build-release - os: macos-26-large name: macos-x64 - build_cmd: ./build.sh release-examples --macos-arch x86_64 + build_cmd: ./build.sh release-examples --bundle --prefix sdk-out/livekit-sdk-macos-x64 --macos-arch x86_64 build_dir: build-release # Pinned to Windows 2022 for current VS 17 implementation - os: windows-2022 name: windows-x64 - build_cmd: .\build.cmd release-examples + build_cmd: .\build.cmd release-examples --bundle --prefix sdk-out\livekit-sdk-windows-x64 build_dir: build-release name: Build (${{ matrix.name }}) @@ -325,15 +325,23 @@ jobs: } if ($failed) { exit 1 } else { exit 0 } + - name: Verify SDK bundle + shell: bash + run: | + set -euo pipefail + bundle="sdk-out/livekit-sdk-${{ matrix.name }}" + test -f "${bundle}/include/livekit/livekit.h" + test -f "${bundle}/share/livekit/build-info.json" + test -f "${bundle}/lib/cmake/LiveKit/LiveKitConfig.cmake" + test -f "${bundle}/lib/cmake/LiveKit/LiveKitConfigVersion.cmake" + test -f "${bundle}/lib/cmake/LiveKit/LiveKitTargets.cmake" + # ---------- Upload artifacts ---------- - - name: Upload build artifacts + - name: Upload SDK bundle uses: actions/upload-artifact@043fb46d1a93c77aae656e7c1c64a875d1fc6a0a # v7.0.1 with: name: livekit-sdk-${{ matrix.name }} - path: | - ${{ matrix.build_dir }}/lib/ - ${{ matrix.build_dir }}/include/ - ${{ matrix.build_dir }}/bin/ + path: sdk-out/livekit-sdk-${{ matrix.name }} retention-days: 7 - name: Upload deprecated linux-x64 alias artifact diff --git a/.github/workflows/make-release.yml b/.github/workflows/make-release.yml index 8acf8aaf..f3243434 100644 --- a/.github/workflows/make-release.yml +++ b/.github/workflows/make-release.yml @@ -248,11 +248,7 @@ jobs: $bundleDir = "sdk-out/livekit-sdk-${{ matrix.name }}-$version" if ([string]::IsNullOrWhiteSpace($version)) { throw "version is empty" } - .\build.cmd release-examples --version "$version" - - # There is the missing step that generates LiveKitTargets.cmake in the install tree - # TODO(sxian): fix it after getting access to a windows machine - cmake --install "build-release" --config Release --prefix "$bundleDir" + .\build.cmd release-examples --version "$version" --bundle --prefix "$bundleDir" Write-Host "Bundle contents:" Get-ChildItem -Recurse -File $bundleDir | Select-Object -First 200 | ForEach-Object { $_.FullName } diff --git a/AGENTS.md b/AGENTS.md index b45973ae..77d3585f 100644 --- a/AGENTS.md +++ b/AGENTS.md @@ -108,7 +108,7 @@ Be sure to update the directory layout in this file if the directory layout chan ## Build for building, use the build.sh script for Linux and macOS, and the build.cmd script for Windows. Do not invoke CMake directly to build the SDK. -Updates to ./build.sh and ./build.cmd should be accompanied by updates to this file and the README.md file. +Updates to ./build.sh and ./build.cmd should be accompanied by updates to this file and docs/building.md. ``` ./build.sh debug # Debug build @@ -122,6 +122,11 @@ Updates to ./build.sh and ./build.cmd should be accompanied by updates to this f ./build.sh clean-all # Full clean (C++ + local-install + Rust targets) ``` +To create an installable SDK bundle, use the same build command with +`--bundle --prefix ` (for example, +`./build.sh release --bundle --prefix sdk-out/livekit-sdk`). On Windows, use +`build.cmd release --bundle --prefix C:\path\to\livekit-sdk`. + The build scripts pass an explicit job count to `cmake --build --parallel`. Set `CMAKE_BUILD_PARALLEL_LEVEL` to override the default detected logical CPU count. diff --git a/build.cmd b/build.cmd index 76c1ac57..4869ebe7 100644 --- a/build.cmd +++ b/build.cmd @@ -9,6 +9,8 @@ set "PRESET=windows-release" set "LIVEKIT_VERSION=" set "CMAKE_EXTRA_ARGS=" set "BUILD_PARALLEL_JOBS=" +set "DO_BUNDLE=" +set "PREFIX=" REM ============================================================ REM Auto-detect LIBCLANG_PATH if not already set @@ -87,7 +89,20 @@ if /I "%~1"=="--version" ( goto :get_version_value ) -:: 3. Handle unknown arguments +:: 3. Install the SDK bundle after a successful build. +if /I "%~1"=="--bundle" ( + set "DO_BUNDLE=1" + shift + goto parse_all +) + +:: 4. Set the install prefix for --bundle. +if /I "%~1"=="--prefix" ( + shift + goto :get_prefix_value +) + +:: 5. Handle unknown arguments echo ERROR: Unknown option: %~1 exit /b 1 @@ -97,6 +112,15 @@ set "LIVEKIT_VERSION=%~1" shift goto parse_all +:get_prefix_value +if "%~1"=="" ( + echo ERROR: --prefix requires a value + exit /b 1 +) +set "PREFIX=%~1" +shift +goto parse_all + :after_parse if not defined CMD ( echo ERROR: No command specified @@ -190,10 +214,15 @@ echo clean Clean both Debug and Release build directories + local- echo clean-all Full clean (build dirs + local-install + Rust targets) echo help Show this help echo. +echo Options (for debug / release): +echo --bundle Install the SDK bundle using cmake --install +echo --prefix ^ Install prefix for --bundle ^(default: .\sdk-out\livekit-sdk^) +echo. echo Examples: echo build.cmd debug echo build.cmd release echo build.cmd release-examples +echo build.cmd release --bundle --prefix C:\path\to\livekit-sdk echo build.cmd debug-tests echo build.cmd release-tests echo build.cmd release-all @@ -232,8 +261,37 @@ if errorlevel 1 ( exit /b 1 ) echo ==^> Build complete! +if defined DO_BUNDLE ( + call :install_bundle + if errorlevel 1 exit /b 1 +) goto :eof +:install_bundle +if not defined PREFIX set "PREFIX=%PROJECT_ROOT%\sdk-out\livekit-sdk" + +if not "%PREFIX:~1,1%"==":" set "PREFIX=%PROJECT_ROOT%\%PREFIX%" + +REM cmd's mkdir/rmdir reject forward slashes; normalize to backslashes. +set "PREFIX=%PREFIX:/=\%" + +echo ==^> Installing SDK bundle to: %PREFIX% +if exist "%PREFIX%" rmdir /s /q "%PREFIX%" +if exist "%PREFIX%" ( + echo Failed to remove existing bundle directory: %PREFIX% + exit /b 1 +) +mkdir "%PREFIX%" +if errorlevel 1 exit /b 1 + +cmake --install "%BUILD_DIR%" --config %BUILD_TYPE% --prefix "%PREFIX%" +if errorlevel 1 ( + echo SDK bundle install failed! + exit /b 1 +) +echo ==^> SDK bundle installed. +exit /b 0 + :clean echo ==^> Cleaning build directories... set "BUILD_DIR_DEBUG=%PROJECT_ROOT%\build-debug" diff --git a/docs/building.md b/docs/building.md index b09c6148..8112d019 100644 --- a/docs/building.md +++ b/docs/building.md @@ -115,6 +115,23 @@ wrap the right CMake preset for your platform and pick sensible defaults. # ... same suffixes as build.sh ``` +### Create an SDK bundle + +To create an installable SDK bundle with public headers, runtime libraries, and +CMake package files, add `--bundle --prefix ` to a build command: + +**Linux/Mac:** + +```bash +./build.sh release --bundle --prefix sdk-out/livekit-sdk +``` + +**Windows:** + +```powershell +.\build.cmd release --bundle --prefix C:\path\to\livekit-sdk +``` + The build scripts pass an explicit job count to `cmake --build --parallel`. Set `CMAKE_BUILD_PARALLEL_LEVEL` to override the auto-detected logical CPU count.