build(streamer): make ZED SDK optional

This commit is contained in:
2026-03-20 17:34:30 +08:00
parent 1691274e85
commit 1ef318bde4
2 changed files with 143 additions and 117 deletions
+22 -15
View File
@@ -56,12 +56,11 @@ find_package(ZeroMQ QUIET)
find_package(spdlog REQUIRED)
find_package(Protobuf REQUIRED)
find_package(PkgConfig REQUIRED)
if (CVMMAP_BUILD_ZED_SVO_GRID_TO_MP4)
find_package(OpenCV REQUIRED COMPONENTS core imgproc)
endif()
find_package(rvl CONFIG QUIET)
set(ZED_DIR "/usr/local/zed" CACHE PATH "Path to the local ZED SDK")
find_package(ZED REQUIRED)
find_package(ZED QUIET)
set(CVMMAP_HAS_ZED_SDK OFF)
if (ZED_FOUND)
find_package(CUDA ${ZED_CUDA_VERSION} REQUIRED)
find_library(CVMMAP_STREAMER_LIBUSB_LIBRARY NAMES usb-1.0 libusb-1.0)
if (CVMMAP_STREAMER_LIBUSB_LIBRARY)
@@ -75,6 +74,17 @@ if (CVMMAP_STREAMER_LIBUSB_LIBRARY)
endforeach()
set(ZED_LIBRARIES "${_CVMMAP_STREAMER_ZED_LIBRARIES}")
endif()
set(CVMMAP_HAS_ZED_SDK ON)
message(STATUS "ZED SDK found: enabling zed_svo_to_mcap and zed_svo_to_mp4")
else()
message(STATUS "ZED SDK not found: skipping ZED conversion tools")
endif()
if (CVMMAP_BUILD_ZED_SVO_GRID_TO_MP4 AND CVMMAP_HAS_ZED_SDK)
find_package(OpenCV REQUIRED COMPONENTS core imgproc)
elseif (CVMMAP_BUILD_ZED_SVO_GRID_TO_MP4)
message(STATUS "CVMMAP_BUILD_ZED_SVO_GRID_TO_MP4=ON but ZED SDK is unavailable; zed_svo_grid_to_mp4 will not be built")
endif()
add_subdirectory(third_party)
@@ -343,6 +353,9 @@ set_target_properties(mcap_replay_tester PROPERTIES
OUTPUT_NAME "mcap_replay_tester"
RUNTIME_OUTPUT_DIRECTORY "${CMAKE_CURRENT_BINARY_DIR}/bin")
set(CVMMAP_STREAMER_INSTALL_TARGETS cvmmap_streamer)
if (CVMMAP_HAS_ZED_SDK)
add_executable(
zed_svo_to_mcap
src/tools/zed_svo_to_mcap.cpp
@@ -373,6 +386,7 @@ endif()
set_target_properties(zed_svo_to_mcap PROPERTIES
OUTPUT_NAME "zed_svo_to_mcap"
RUNTIME_OUTPUT_DIRECTORY "${CMAKE_CURRENT_BINARY_DIR}/bin")
list(APPEND CVMMAP_STREAMER_INSTALL_TARGETS zed_svo_to_mcap)
add_library(
cvmmap_streamer_zed_svo_mp4_support
@@ -419,6 +433,7 @@ endif()
set_target_properties(zed_svo_to_mp4 PROPERTIES
OUTPUT_NAME "zed_svo_to_mp4"
RUNTIME_OUTPUT_DIRECTORY "${CMAKE_CURRENT_BINARY_DIR}/bin")
list(APPEND CVMMAP_STREAMER_INSTALL_TARGETS zed_svo_to_mp4)
if (CVMMAP_BUILD_ZED_SVO_GRID_TO_MP4)
add_executable(
@@ -451,18 +466,10 @@ if (CVMMAP_BUILD_ZED_SVO_GRID_TO_MP4)
set_target_properties(zed_svo_grid_to_mp4 PROPERTIES
OUTPUT_NAME "zed_svo_grid_to_mp4"
RUNTIME_OUTPUT_DIRECTORY "${CMAKE_CURRENT_BINARY_DIR}/bin")
list(APPEND CVMMAP_STREAMER_INSTALL_TARGETS zed_svo_grid_to_mp4)
endif()
endif()
install(
TARGETS
cvmmap_streamer
zed_svo_to_mcap
zed_svo_to_mp4
TARGETS ${CVMMAP_STREAMER_INSTALL_TARGETS}
RUNTIME DESTINATION "${CMAKE_INSTALL_BINDIR}")
if (CVMMAP_BUILD_ZED_SVO_GRID_TO_MP4)
install(
TARGETS
zed_svo_grid_to_mp4
RUNTIME DESTINATION "${CMAKE_INSTALL_BINDIR}")
endif()
+19
View File
@@ -45,6 +45,17 @@ cmake -B build -S .
cmake --build build
```
When the ZED SDK is available, the build also enables `zed_svo_to_mcap` and
`zed_svo_to_mp4` automatically. When the SDK is absent, those tools are skipped
and the main streamer plus non-ZED testers still build normally.
`zed_svo_grid_to_mp4` remains optional and additionally requires OpenCV. Disable
it explicitly with:
```bash
cmake -B build -S . -DCVMMAP_BUILD_ZED_SVO_GRID_TO_MP4=OFF
```
```bash
# Use a local cv-mmap build tree
cmake -B build -S . \
@@ -60,6 +71,8 @@ ls -la build/{cvmmap_streamer,rtp_receiver_tester,rtmp_stub_tester}
### ZED SVO/SVO2 To MP4
This tool is only built when the ZED SDK is detected during CMake configure.
The repo also includes an offline conversion tool for the left ZED color stream:
```bash
@@ -130,6 +143,9 @@ The batch tool mirrors the common encoder options from `zed_svo_to_mp4`, skips e
### ZED SVO Grid To MP4
This tool is only built when the ZED SDK is detected and
`CVMMAP_BUILD_ZED_SVO_GRID_TO_MP4=ON`.
Use the grid converter to merge four synced ZED recordings into a 2x2 CCTV-style MP4 with a Unix timestamp overlay in the top-left corner:
```bash
@@ -213,6 +229,9 @@ timestamp,activity,group_path,segment_dir,camera,relative_path
### Batch ZED Segments To MCAP
This workflow depends on the `zed_svo_to_mcap` binary, which is only built when
the ZED SDK is detected during CMake configure.
Use the wrapper to recurse through a dataset root, run `zed_svo_to_mcap --segment-dir` on every matched multi-camera segment, and show one aggregate tqdm progress bar:
```bash