Skip to content

Commit ae4b2de

Browse files
update CMake to work with newest rust hash
1 parent b444275 commit ae4b2de

1 file changed

Lines changed: 8 additions & 2 deletions

File tree

‎CMakeLists.txt‎

Lines changed: 8 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -268,6 +268,10 @@ execute_process(
268268
if(rv)
269269
message(FATAL_ERROR \"cargo build failed with code: \${rv}\")
270270
endif()
271+
272+
if(DEFINED EXPECTED_OUTPUT AND NOT EXPECTED_OUTPUT STREQUAL \"\" AND NOT EXISTS \"\${EXPECTED_OUTPUT}\")
273+
message(FATAL_ERROR \"cargo build completed but did not produce expected Rust FFI artifact: \${EXPECTED_OUTPUT}\")
274+
endif()
271275
")
272276

273277
# Use SHARED library (DLL) on Windows to isolate /MT CRT from consuming /MD apps
@@ -335,23 +339,25 @@ file(GLOB_RECURSE RUST_SOURCES
335339
)
336340

337341
add_custom_command(
338-
OUTPUT "${RUST_LIB_DEBUG}" "${RUST_LIB_RELEASE}"
342+
OUTPUT "${LIVEKIT_BINARY_DIR}/rust_ffi_$<CONFIG>.stamp"
339343
COMMAND "${CMAKE_COMMAND}"
340344
-DCFG=$<CONFIG>
341345
-DRUST_ROOT=${RUST_ROOT}
342346
-DCARGO=${CARGO_EXECUTABLE}
343347
-DPROTOC_PATH=${Protobuf_PROTOC_EXECUTABLE}
344348
-DRUST_TARGET=${RUST_TARGET_TRIPLE}
345349
-DGCC_LIB_DIR=${GCC_LIB_DIR}
350+
-DEXPECTED_OUTPUT=$<IF:$<CONFIG:Debug>,${RUST_LIB_DEBUG},${RUST_LIB_RELEASE}>
346351
-P "${RUN_CARGO_SCRIPT}"
352+
COMMAND "${CMAKE_COMMAND}" -E touch "${LIVEKIT_BINARY_DIR}/rust_ffi_$<CONFIG>.stamp"
347353
WORKING_DIRECTORY "${RUST_ROOT}"
348354
DEPENDS ${RUST_SOURCES}
349355
COMMENT "Building Rust FFI via cargo"
350356
VERBATIM
351357
)
352358

353359
add_custom_target(build_rust_ffi
354-
DEPENDS "${RUST_LIB_DEBUG}" "${RUST_LIB_RELEASE}"
360+
DEPENDS "${LIVEKIT_BINARY_DIR}/rust_ffi_$<CONFIG>.stamp"
355361
)
356362

357363
# Note: protozero_plugin.o removal is no longer needed since we use dynamic libraries on Unix

0 commit comments

Comments
 (0)