@@ -18,6 +18,7 @@ include(warnings)
1818
1919option (LIVEKIT_BUILD_EXAMPLES "Build LiveKit examples" OFF )
2020option (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
2324if (WIN32 )
@@ -85,6 +86,7 @@ set(FFI_PROTO_FILES
8586 ${FFI_PROTO_DIR} /data_track.proto
8687 ${FFI_PROTO_DIR} /rpc.proto
8788 ${FFI_PROTO_DIR} /track_publication.proto
89+ ${FFI_PROTO_DIR} /capture.proto
8890)
8991set (PROTO_BINARY_DIR ${LIVEKIT_BINARY_DIR } /generated)
9092file (MAKE_DIRECTORY ${PROTO_BINARY_DIR } )
@@ -166,6 +168,12 @@ set(GENERATED_BUILD_H "${LIVEKIT_ROOT_DIR}/include/livekit/build.h")
166168set (GENERATED_BUILD_INFO_JSON "${LIVEKIT_BINARY_DIR } /build-info.json" )
167169set (RUST_ROOT ${LIVEKIT_ROOT_DIR} /client-sdk-rust)
168170
171+ # Cargo features for the Rust FFI build.
172+ set (LIVEKIT_CARGO_FEATURES "" )
173+ if (LIVEKIT_ENABLE_CAPTURE)
174+ set (LIVEKIT_CARGO_FEATURES "capture" )
175+ endif ()
176+
169177set (GIT_COMMIT "unknown" )
170178set (RUST_GIT_COMMIT "unknown" )
171179find_package (Git QUIET )
@@ -261,6 +269,11 @@ if(NOT CFG STREQUAL \"Debug\")
261269 list(APPEND ARGS --release)
262270endif()
263271
272+ if(DEFINED CARGO_FEATURES AND NOT CARGO_FEATURES STREQUAL \"\" )
273+ list(APPEND ARGS --features \"\$ {CARGO_FEATURES}\" )
274+ message(STATUS \" [run_cargo.cmake] Cargo features: \$ {CARGO_FEATURES}\" )
275+ endif()
276+
264277if(DEFINED RUST_TARGET AND NOT RUST_TARGET STREQUAL \"\" )
265278 list(APPEND ARGS --target \"\$ {RUST_TARGET}\" )
266279 message(STATUS \" [run_cargo.cmake] Cross-compiling for target: \$ {RUST_TARGET}\" )
@@ -357,6 +370,7 @@ add_custom_command(
357370 -DPROTOC_PATH=${Protobuf_PROTOC_EXECUTABLE}
358371 -DRUST_TARGET=${RUST_TARGET_TRIPLE}
359372 -DGCC_LIB_DIR=${GCC_LIB_DIR}
373+ -DCARGO_FEATURES=${LIVEKIT_CARGO_FEATURES}
360374 -P "${RUN_CARGO_SCRIPT} "
361375 WORKING_DIRECTORY "${RUST_ROOT} "
362376 DEPENDS ${RUST_SOURCES}
0 commit comments