Skip to content

Commit 2498719

Browse files
committed
Add capture protos and LIVEKIT_ENABLE_CAPTURE option
1 parent 5f34d8c commit 2498719

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)
@@ -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
)
8991
set(PROTO_BINARY_DIR ${LIVEKIT_BINARY_DIR}/generated)
9092
file(MAKE_DIRECTORY ${PROTO_BINARY_DIR})
@@ -166,6 +168,12 @@ set(GENERATED_BUILD_H "${LIVEKIT_ROOT_DIR}/include/livekit/build.h")
166168
set(GENERATED_BUILD_INFO_JSON "${LIVEKIT_BINARY_DIR}/build-info.json")
167169
set(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+
169177
set(GIT_COMMIT "unknown")
170178
set(RUST_GIT_COMMIT "unknown")
171179
find_package(Git QUIET)
@@ -261,6 +269,11 @@ if(NOT CFG STREQUAL \"Debug\")
261269
list(APPEND ARGS --release)
262270
endif()
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+
264277
if(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

Comments
 (0)