-
Notifications
You must be signed in to change notification settings - Fork 40
UniFFI C++ Bindgen Initial Integration #249
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Merged
Merged
Changes from all commits
Commits
Show all changes
14 commits
Select commit
Hold shift + click to select a range
46a4fab
Better uniffi
alan-george-lk f916cf2
Build order
alan-george-lk 96d64da
maybe fix CI builds
alan-george-lk d088131
Merge branch 'main' of github.com:livekit/client-sdk-cpp into alan/fe…
alan-george-lk 65cb23b
Move to adapter model
alan-george-lk c7250a7
Devin.ai suggestions
alan-george-lk fdad12a
Use official fork for bindgen
alan-george-lk 2ce640a
Fix clang-tidy
alan-george-lk 8ba7486
Use new fork layout
alan-george-lk ed1adf6
Maybe fix tidy
alan-george-lk 15b9bd4
Merge branch 'main' of github.com:livekit/client-sdk-cpp into alan/fe…
alan-george-lk 6f2a377
Various minor fixes/cleanups
alan-george-lk 2559350
Fix broken link
alan-george-lk a60e836
FFI release
alan-george-lk File filter
Filter by extension
Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
There are no files selected for viewing
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| Original file line number | Diff line number | Diff line change |
|---|---|---|
| @@ -1 +1,2 @@ | ||
| data/welcome.wav filter=lfs diff=lfs merge=lfs -text | ||
| build.cmd whitespace=cr-at-eol |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Submodule client-sdk-rust
updated
from bae4df to 5a656c
|
alan-george-lk marked this conversation as resolved.
|
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| Original file line number | Diff line number | Diff line change |
|---|---|---|
| @@ -0,0 +1,129 @@ | ||
| # Copyright 2026 LiveKit, Inc. | ||
| # | ||
| # Licensed under the Apache License, Version 2.0 (the "License"); | ||
| # you may not use this file except in compliance with the License. | ||
| # You may obtain a copy of the License at | ||
| # | ||
| # http://www.apache.org/licenses/LICENSE-2.0 | ||
| # | ||
| # Unless required by applicable law or agreed to in writing, software | ||
| # distributed under the License is distributed on an "AS IS" BASIS, | ||
| # WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. | ||
| # See the License for the specific language governing permissions and | ||
| # limitations under the License. | ||
|
|
||
| set(LIVEKIT_UNIFFI_CPP_GENERATED_DIR "${LIVEKIT_BINARY_DIR}/generated/uniffi") | ||
| set(LIVEKIT_UNIFFI_CPP_SOURCE | ||
| "${LIVEKIT_UNIFFI_CPP_GENERATED_DIR}/livekit_ffi.cpp") | ||
| set(LIVEKIT_UNIFFI_CPP_HEADER | ||
| "${LIVEKIT_UNIFFI_CPP_GENERATED_DIR}/livekit_ffi.hpp") | ||
| set(LIVEKIT_UNIFFI_CPP_SCAFFOLDING_HEADER | ||
| "${LIVEKIT_UNIFFI_CPP_GENERATED_DIR}/livekit_ffi_scaffolding.hpp") | ||
|
|
||
| # Release Linux builds strip the UniFFI metadata symbols, so generate from a | ||
| # separate unstripped Debug library there. PE and Mach-O retain the metadata, | ||
| # allowing Windows and macOS to reuse the livekit-ffi library already built for | ||
| # the selected CMake configuration. | ||
| if(UNIX AND NOT APPLE) | ||
| set(LIVEKIT_UNIFFI_METADATA_TARGET_DIR | ||
| "${RUST_ROOT}/target/uniffi-cpp-metadata") | ||
| set(LIVEKIT_UNIFFI_METADATA_LIBRARY | ||
| "${LIVEKIT_UNIFFI_METADATA_TARGET_DIR}/debug/liblivekit_ffi.so") | ||
| endif() | ||
|
|
||
| file(GLOB_RECURSE LIVEKIT_UNIFFI_RUST_SOURCES CONFIGURE_DEPENDS | ||
| "${RUST_ROOT}/livekit-ffi/src/*.rs" | ||
| "${RUST_ROOT}/livekit-ffi/protocol/*.proto" | ||
| "${RUST_ROOT}/livekit-ffi/build.rs" | ||
| "${RUST_ROOT}/livekit-ffi/Cargo.toml" | ||
| ) | ||
| list(APPEND LIVEKIT_UNIFFI_RUST_SOURCES | ||
| "${RUST_ROOT}/Cargo.toml" | ||
| "${RUST_ROOT}/Cargo.lock" | ||
| "${RUST_ROOT}/rust-toolchain.toml" | ||
| ) | ||
|
|
||
| file(GLOB_RECURSE LIVEKIT_UNIFFI_BINDGEN_SOURCES CONFIGURE_DEPENDS | ||
| "${RUST_ROOT}/tools/bindgens/src/*.rs" | ||
| "${RUST_ROOT}/tools/bindgens/Cargo.toml" | ||
| ) | ||
|
|
||
| if(UNIX AND NOT APPLE) | ||
| add_custom_command( | ||
| OUTPUT "${LIVEKIT_UNIFFI_METADATA_LIBRARY}" | ||
| COMMAND "${CMAKE_COMMAND}" | ||
| -DCFG=Debug | ||
| -DRUST_ROOT=${RUST_ROOT} | ||
| -DCARGO=${CARGO_EXECUTABLE} | ||
| -DPROTOC_PATH=${Protobuf_PROTOC_EXECUTABLE} | ||
| -DGCC_LIB_DIR=${GCC_LIB_DIR} | ||
| -DCARGO_TARGET_DIR=${LIVEKIT_UNIFFI_METADATA_TARGET_DIR} | ||
| -P "${RUN_CARGO_SCRIPT}" | ||
| WORKING_DIRECTORY "${RUST_ROOT}" | ||
| DEPENDS ${LIVEKIT_UNIFFI_RUST_SOURCES} | ||
| COMMENT "Building unstripped livekit-ffi metadata library" | ||
| VERBATIM | ||
| ) | ||
| add_custom_target(build_livekit_ffi_metadata | ||
| DEPENDS "${LIVEKIT_UNIFFI_METADATA_LIBRARY}") | ||
| else() | ||
| set(LIVEKIT_UNIFFI_METADATA_LIBRARY "$<TARGET_FILE:livekit_ffi>") | ||
| add_custom_target(build_livekit_ffi_metadata) | ||
| endif() | ||
|
|
||
| # Keep Cargo invocations serialized on fresh runners, and ensure the selected | ||
| # livekit-ffi library exists before it is inspected on Windows and macOS. | ||
| add_dependencies(build_livekit_ffi_metadata build_rust_ffi) | ||
|
|
||
| add_custom_command( | ||
| OUTPUT | ||
| "${LIVEKIT_UNIFFI_CPP_SOURCE}" | ||
| "${LIVEKIT_UNIFFI_CPP_HEADER}" | ||
| "${LIVEKIT_UNIFFI_CPP_SCAFFOLDING_HEADER}" | ||
| COMMAND "${CMAKE_COMMAND}" -E make_directory | ||
| "${LIVEKIT_UNIFFI_CPP_GENERATED_DIR}" | ||
| COMMAND "${CMAKE_COMMAND}" -E env | ||
| "CARGO_TARGET_DIR=${RUST_ROOT}/target/bindgens" | ||
| "CARGO_ENCODED_RUSTFLAGS=" | ||
| "RUSTFLAGS=" | ||
|
devin-ai-integration[bot] marked this conversation as resolved.
|
||
| "${CARGO_EXECUTABLE}" run --locked | ||
| --package bindgens | ||
| --bin uniffi-bindgen-cpp | ||
| -- | ||
| --library "${LIVEKIT_UNIFFI_METADATA_LIBRARY}" | ||
| --out-dir "${LIVEKIT_UNIFFI_CPP_GENERATED_DIR}" | ||
| WORKING_DIRECTORY "${RUST_ROOT}" | ||
| DEPENDS | ||
| build_livekit_ffi_metadata | ||
| ${LIVEKIT_UNIFFI_RUST_SOURCES} | ||
| ${LIVEKIT_UNIFFI_BINDGEN_SOURCES} | ||
| COMMENT "Generating UniFFI C++ bindings" | ||
| VERBATIM | ||
| ) | ||
| add_custom_target(generate_livekit_ffi_uniffi_cpp | ||
| DEPENDS | ||
| "${LIVEKIT_UNIFFI_CPP_SOURCE}" | ||
| "${LIVEKIT_UNIFFI_CPP_HEADER}" | ||
| "${LIVEKIT_UNIFFI_CPP_SCAFFOLDING_HEADER}" | ||
| ) | ||
|
|
||
| set_source_files_properties( | ||
| "${LIVEKIT_UNIFFI_CPP_SOURCE}" | ||
| "${LIVEKIT_UNIFFI_CPP_HEADER}" | ||
| "${LIVEKIT_UNIFFI_CPP_SCAFFOLDING_HEADER}" | ||
| PROPERTIES GENERATED TRUE | ||
| ) | ||
|
|
||
| add_library(livekit_uniffi_cpp OBJECT | ||
| "${LIVEKIT_UNIFFI_CPP_SOURCE}" | ||
| ) | ||
|
devin-ai-integration[bot] marked this conversation as resolved.
|
||
| set_target_properties(livekit_uniffi_cpp PROPERTIES | ||
| CXX_VISIBILITY_PRESET hidden | ||
| C_VISIBILITY_PRESET hidden | ||
| VISIBILITY_INLINES_HIDDEN ON | ||
| ) | ||
| add_dependencies(livekit_uniffi_cpp generate_livekit_ffi_uniffi_cpp) | ||
| target_include_directories(livekit_uniffi_cpp | ||
| PUBLIC "${LIVEKIT_UNIFFI_CPP_GENERATED_DIR}" | ||
| ) | ||
| target_link_libraries(livekit_uniffi_cpp PRIVATE livekit_ffi) | ||
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Oops, something went wrong.
Oops, something went wrong.
Add this suggestion to a batch that can be applied as a single commit.
This suggestion is invalid because no changes were made to the code.
Suggestions cannot be applied while the pull request is closed.
Suggestions cannot be applied while viewing a subset of changes.
Only one suggestion per line can be applied in a batch.
Add this suggestion to a batch that can be applied as a single commit.
Applying suggestions on deleted lines is not supported.
You must change the existing code in this line in order to create a valid suggestion.
Outdated suggestions cannot be applied.
This suggestion has been applied or marked resolved.
Suggestions cannot be applied from pending reviews.
Suggestions cannot be applied on multi-line comments.
Suggestions cannot be applied while the pull request is queued to merge.
Suggestion cannot be applied right now. Please check back later.
Uh oh!
There was an error while loading. Please reload this page.