Skip to content
Draft
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
1 change: 1 addition & 0 deletions .build-info.json.in
Original file line number Diff line number Diff line change
Expand Up @@ -4,5 +4,6 @@
"cpp_git_commit": "@GIT_COMMIT@",
"rust_submodule_commit": "@RUST_GIT_COMMIT@",
"livekit_ffi_version": "@LIVEKIT_FFI_VERSION@",
"livekit_uniffi_version": "@LIVEKIT_UNIFFI_VERSION@",
"build_date": "@BUILD_DATE@"
}
29 changes: 29 additions & 0 deletions .github/workflows/make-release.yml
Original file line number Diff line number Diff line change
Expand Up @@ -238,6 +238,13 @@ jobs:
grep -F "\"sdk_version\": \"${version}\"" "$buildInfo"
grep -Eq '"rust_submodule_commit": "[0-9a-f]{7,}"' "$buildInfo"
grep -Eq '"livekit_ffi_version": "[0-9]+\.[0-9]+\.[0-9]+' "$buildInfo"
grep -Eq '"livekit_uniffi_version": "[0-9]+\.[0-9]+\.[0-9]+' "$buildInfo"
test -f "${bundleDir}/include/livekit/uniffi/livekit_uniffi.hpp"
if [[ "$RUNNER_OS" == "macOS" ]]; then
test -f "${bundleDir}/lib/liblivekit_uniffi.dylib"
else
test -f "${bundleDir}/lib/liblivekit_uniffi.so"
fi

# ---------- Build + Bundle (Windows) ----------
- name: Build and Bundle (Windows)
Expand Down Expand Up @@ -277,6 +284,12 @@ jobs:
fi
fi
python3 .github/scripts/check_no_private_symbols.py "${lib}"
if [[ "$RUNNER_OS" == "macOS" ]]; then
uniffi_lib="${libdir}/liblivekit_uniffi.dylib"
else
uniffi_lib="${libdir}/liblivekit_uniffi.so"
fi
python3 .github/scripts/check_no_private_symbols.py "${uniffi_lib}"

- name: Symbol leak check (Windows)
if: runner.os == 'Windows'
Expand All @@ -295,6 +308,15 @@ jobs:
exit 1
}
python .github/scripts/check_no_private_symbols.py "$lib"
$uniffiLib = "build-release/bin/livekit_uniffi.dll"
if (!(Test-Path -LiteralPath $uniffiLib)) {
$uniffiLib = "build-release/lib/livekit_uniffi.dll"
}
if (!(Test-Path -LiteralPath $uniffiLib)) {
Write-Error "livekit_uniffi.dll not found"
exit 1
}
python .github/scripts/check_no_private_symbols.py "$uniffiLib"

- name: Validate bundle version metadata (Windows)
if: runner.os == 'Windows'
Expand Down Expand Up @@ -328,6 +350,13 @@ jobs:
if ($buildInfoText -match '"livekit_ffi_version": "unknown"') {
throw "Build info is missing livekit-ffi version"
}
if ($buildInfoText -match '"livekit_uniffi_version": "unknown"') {
throw "Build info is missing livekit-uniffi version"
}
$uniffiHeader = Join-Path $bundleDir "include/livekit/uniffi/livekit_uniffi.hpp"
if (!(Test-Path $uniffiHeader)) { throw "Missing $uniffiHeader" }
$uniffiRuntime = Join-Path $bundleDir "bin/livekit_uniffi.dll"
if (!(Test-Path $uniffiRuntime)) { throw "Missing $uniffiRuntime" }

# ---------- Upload artifact (raw directory, no pre-compression) ----------
- name: Upload build artifact
Expand Down
5 changes: 3 additions & 2 deletions AGENTS.md
Original file line number Diff line number Diff line change
Expand Up @@ -85,12 +85,13 @@ Be sure to update the directory layout in this file if the directory layout chan
|------|-------------|
| `include/livekit/` | Public API headers (what SDK consumers include) |
| `src/` | Implementation files and internal-only headers (`ffi_client.h`, `lk_log.h`, etc.) |
| `src/tests/` | Google Test integration and stress tests |
| `src/tests/` | Google Test unit, integration, and stress tests |
| `examples/` | In-tree example applications |
| `client-sdk-rust/` | Git submodule holding the Rust core of the SDK|
| `cpp-tools/` | Git submodule holding shared LiveKit C++ engineering guidance, clang-format / clang-tidy configs, scripts, docs, and CI workflow |
| `client-sdk-rust/livekit-ffi/protocol/*.proto` | FFI contract (protobuf definitions, read-only reference) |
| `cmake/` | Build helpers (`protobuf.cmake`, `spdlog.cmake`, `nlohmann_json.cmake`, `LiveKitConfig.cmake.in`) |
| `client-sdk-rust/livekit-uniffi/` | UniFFI Rust crate, built and bundled alongside the protobuf FFI |
| `cmake/` | Build helpers (`protobuf.cmake`, `uniffi.cmake`, `spdlog.cmake`, `nlohmann_json.cmake`, `LiveKitConfig.cmake.in`) |
| `scripts/` | Local helper scripts for SDK-specific development tasks |
| `docs/` | Documentation root. `docs/` holds hand-written long-form Markdown intended to also read well on GitHub. |
| `docs/doxygen/` | Doxygen tool config, theme assets, and Doxygen-only content (`Doxyfile`, `index.md` mainpage, `customization/*.css`, `customization/header.html`, `customization/favicon.ico`). Files here use Doxygen-only syntax (`@ref`, `@brief`, …) and are not intended for human reading on their own. |
Expand Down
38 changes: 35 additions & 3 deletions CMakeLists.txt
Original file line number Diff line number Diff line change
Expand Up @@ -198,6 +198,17 @@ if(EXISTS "${LIVEKIT_FFI_CARGO_TOML}")
endif()
endif()

set(LIVEKIT_UNIFFI_VERSION "unknown")
set(LIVEKIT_UNIFFI_CARGO_TOML "${RUST_ROOT}/livekit-uniffi/Cargo.toml")
if(EXISTS "${LIVEKIT_UNIFFI_CARGO_TOML}")
file(READ "${LIVEKIT_UNIFFI_CARGO_TOML}" LIVEKIT_UNIFFI_CARGO_TOML_CONTENTS)
string(REGEX MATCH "version[ \t]*=[ \t]*\"([^\"]+)\"" _LIVEKIT_UNIFFI_VERSION_MATCH
"${LIVEKIT_UNIFFI_CARGO_TOML_CONTENTS}")
if(_LIVEKIT_UNIFFI_VERSION_MATCH)
set(LIVEKIT_UNIFFI_VERSION "${CMAKE_MATCH_1}")
endif()
endif()

string(TIMESTAMP BUILD_DATE "%Y-%m-%dT%H:%M:%SZ" UTC)
set(GENERATED_COMMENT "This file was auto-generated by CMake on ${BUILD_DATE}. Do NOT edit manually.")

Expand Down Expand Up @@ -256,7 +267,11 @@ if(NOT DEFINED CARGO)
message(FATAL_ERROR \"CARGO not set\")
endif()

set(ARGS build --package livekit-ffi)
if(NOT DEFINED PACKAGE OR PACKAGE STREQUAL \"\")
set(PACKAGE livekit-ffi)
endif()

set(ARGS build --package \"\${PACKAGE}\")
if(NOT CFG STREQUAL \"Debug\")
list(APPEND ARGS --release)
endif()
Expand Down Expand Up @@ -357,6 +372,7 @@ add_custom_command(
-DPROTOC_PATH=${Protobuf_PROTOC_EXECUTABLE}
-DRUST_TARGET=${RUST_TARGET_TRIPLE}
-DGCC_LIB_DIR=${GCC_LIB_DIR}
-DPACKAGE=livekit-ffi
-P "${RUN_CARGO_SCRIPT}"
WORKING_DIRECTORY "${RUST_ROOT}"
DEPENDS ${RUST_SOURCES}
Expand Down Expand Up @@ -643,6 +659,9 @@ endif()
# -------------------- Install / Package (SDK bundle) --------------------
include(GNUInstallDirs)
include(CMakePackageConfigHelpers)
include(uniffi)
add_dependencies(livekit livekit_uniffi_cpp)
target_link_libraries(livekit PRIVATE livekit_uniffi_cpp livekit_uniffi)

set(LIVEKIT_PACKAGE_NAME "LiveKit")
set(LIVEKIT_EXPORT_NAMESPACE "LiveKit::")
Expand Down Expand Up @@ -695,6 +714,7 @@ if(APPLE)

set(_livekit "${_libdir}/liblivekit.dylib")
set(_ffi "${_libdir}/liblivekit_ffi.dylib")
set(_uniffi "${_libdir}/liblivekit_uniffi.dylib")

message(STATUS "macOS fixup: prefix=${_prefix}")
message(STATUS "macOS fixup: libdir=${_libdir}")
Expand All @@ -707,6 +727,9 @@ if(APPLE)
if(NOT EXISTS "${_livekit}")
message(FATAL_ERROR "Expected ${_livekit} to exist at install time")
endif()
if(NOT EXISTS "${_uniffi}")
message(FATAL_ERROR "Expected ${_uniffi} to exist at install time")
endif()

# Make the dylib's "id" relocatable
execute_process(
Expand All @@ -717,6 +740,14 @@ if(APPLE)
message(FATAL_ERROR "install_name_tool -id failed for ${_ffi}")
endif()

execute_process(
COMMAND /usr/bin/install_name_tool -id "@rpath/liblivekit_uniffi.dylib" "${_uniffi}"
RESULT_VARIABLE _rv
)
if(NOT _rv EQUAL 0)
message(FATAL_ERROR "install_name_tool -id failed for ${_uniffi}")
endif()

# Make liblivekit depend on @rpath/liblivekit_ffi.dylib (replace any absolute build path)
execute_process(
COMMAND /usr/bin/install_name_tool
Expand Down Expand Up @@ -792,8 +823,9 @@ if(LIVEKIT_BUILD_TESTS)
endif()

add_custom_target(clean_generated
COMMAND ${CMAKE_COMMAND} -E rm -rf "${PROTO_BINARY_DIR}"
COMMENT "Clean generated protobuf files"
COMMAND ${CMAKE_COMMAND} -E rm -rf
"${PROTO_BINARY_DIR}" "${LIVEKIT_UNIFFI_CPP_GENERATED_DIR}"
COMMENT "Clean generated protobuf and UniFFI files"
VERBATIM
)

Expand Down
2 changes: 1 addition & 1 deletion client-sdk-rust
31 changes: 31 additions & 0 deletions cmake/LiveKitConfig.cmake.in
Original file line number Diff line number Diff line change
Expand Up @@ -2,3 +2,34 @@

include("${CMAKE_CURRENT_LIST_DIR}/LiveKitTargets.cmake")

if(NOT TARGET LiveKit::uniffi_runtime)
if(WIN32)
set(_livekit_uniffi_runtime "${PACKAGE_PREFIX_DIR}/bin/livekit_uniffi.dll")
set(_livekit_uniffi_implib "${PACKAGE_PREFIX_DIR}/lib/livekit_uniffi.dll.lib")
elseif(APPLE)
set(_livekit_uniffi_runtime "${PACKAGE_PREFIX_DIR}/lib/liblivekit_uniffi.dylib")
else()
set(_livekit_uniffi_runtime "${PACKAGE_PREFIX_DIR}/lib/liblivekit_uniffi.so")
endif()

set_and_check(_livekit_uniffi_runtime "${_livekit_uniffi_runtime}")
add_library(LiveKit::uniffi_runtime SHARED IMPORTED GLOBAL)
set_target_properties(LiveKit::uniffi_runtime PROPERTIES
IMPORTED_LOCATION "${_livekit_uniffi_runtime}"
)
if(WIN32)
set_and_check(_livekit_uniffi_implib "${_livekit_uniffi_implib}")
set_target_properties(LiveKit::uniffi_runtime PROPERTIES
IMPORTED_IMPLIB "${_livekit_uniffi_implib}"
)
elseif(UNIX AND NOT APPLE)
set_target_properties(LiveKit::uniffi_runtime PROPERTIES IMPORTED_NO_SONAME TRUE)
endif()
endif()

if(TARGET LiveKit::uniffi)
set_property(TARGET LiveKit::uniffi APPEND PROPERTY
INTERFACE_LINK_LIBRARIES LiveKit::uniffi_runtime
)
endif()

Loading
Loading