Skip to content

Commit 85a938a

Browse files
ladvocstephen-derosa
authored andcommitted
Add capture protos and LIVEKIT_ENABLE_CAPTURE option
1 parent 8ab7dfe commit 85a938a

1 file changed

Lines changed: 14 additions & 0 deletions

File tree

‎CMakeLists.txt‎

Lines changed: 14 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -18,6 +18,7 @@ include(warnings)
1818

1919
option(LIVEKIT_BUILD_EXAMPLES "Build LiveKit examples" OFF)
2020
option(LIVEKIT_BUILD_TESTS "Build LiveKit tests" OFF)
21+
option(LIVEKIT_ENABLE_CAPTURE "Build the Rust FFI with the capture feature (livekit-capture sources; links system GStreamer)" OFF)
2122

2223
# vcpkg is only used on Windows; Linux/macOS use system package managers
2324
if(WIN32)
@@ -86,6 +87,7 @@ set(FFI_PROTO_FILES
8687
${FFI_PROTO_DIR}/data_track.proto
8788
${FFI_PROTO_DIR}/rpc.proto
8889
${FFI_PROTO_DIR}/track_publication.proto
90+
${FFI_PROTO_DIR}/capture.proto
8991
)
9092
set(PROTO_BINARY_DIR ${LIVEKIT_BINARY_DIR}/generated)
9193
file(MAKE_DIRECTORY ${PROTO_BINARY_DIR})
@@ -167,6 +169,12 @@ set(GENERATED_BUILD_H "${LIVEKIT_ROOT_DIR}/include/livekit/build.h")
167169
set(GENERATED_BUILD_INFO_JSON "${LIVEKIT_BINARY_DIR}/build-info.json")
168170
set(RUST_ROOT ${LIVEKIT_ROOT_DIR}/client-sdk-rust)
169171

172+
# Cargo features for the Rust FFI build.
173+
set(LIVEKIT_CARGO_FEATURES "")
174+
if(LIVEKIT_ENABLE_CAPTURE)
175+
set(LIVEKIT_CARGO_FEATURES "capture")
176+
endif()
177+
170178
set(GIT_COMMIT "unknown")
171179
set(RUST_GIT_COMMIT "unknown")
172180
find_package(Git QUIET)
@@ -262,6 +270,11 @@ if(NOT CFG STREQUAL \"Debug\")
262270
list(APPEND ARGS --release)
263271
endif()
264272
273+
if(DEFINED CARGO_FEATURES AND NOT CARGO_FEATURES STREQUAL \"\")
274+
list(APPEND ARGS --features \"\${CARGO_FEATURES}\")
275+
message(STATUS \"[run_cargo.cmake] Cargo features: \${CARGO_FEATURES}\")
276+
endif()
277+
265278
if(DEFINED RUST_TARGET AND NOT RUST_TARGET STREQUAL \"\")
266279
list(APPEND ARGS --target \"\${RUST_TARGET}\")
267280
message(STATUS \"[run_cargo.cmake] Cross-compiling for target: \${RUST_TARGET}\")
@@ -378,6 +391,7 @@ add_custom_command(
378391
-DPROTOC_PATH=${Protobuf_PROTOC_EXECUTABLE}
379392
-DRUST_TARGET=${RUST_TARGET_TRIPLE}
380393
-DGCC_LIB_DIR=${GCC_LIB_DIR}
394+
-DCARGO_FEATURES=${LIVEKIT_CARGO_FEATURES}
381395
-P "${RUN_CARGO_SCRIPT}"
382396
WORKING_DIRECTORY "${RUST_ROOT}"
383397
DEPENDS ${RUST_SOURCES}

0 commit comments

Comments
 (0)