dora 1.0 runs a node's build command directly rather than through a shell, so the mkdir/cd/&& sequence in dataflow.yml could not work. Move it to scripts/build.sh and invoke that instead. Default CMAKE_BUILD_TYPE to Release so DoraTargets.cmake picks the release cargo profile and the binary does not link debug dora bindings. Pin the dataflow source with tag: — 1.0 replaced git_checkout with the mutually exclusive tag/rev/branch. Co-Authored-By: Claude Opus 5 <noreply@anthropic.com> Claude-Session: https://claude.ai/code/session_01Y7g2cBJ5e3r15ZbJ9WZn8c
73 lines
2.0 KiB
CMake
73 lines
2.0 KiB
CMake
cmake_minimum_required(VERSION 3.21)
|
|
project(dora_zed VERSION 0.1.0 LANGUAGES C CXX)
|
|
|
|
set(CMAKE_CXX_STANDARD 17)
|
|
set(CMAKE_CXX_FLAGS "-fPIC")
|
|
|
|
# DoraTargets.cmake picks the cargo profile from this, so an unset build type
|
|
# would link debug dora bindings into an otherwise unoptimized binary.
|
|
if(NOT CMAKE_BUILD_TYPE AND NOT CMAKE_CONFIGURATION_TYPES)
|
|
set(CMAKE_BUILD_TYPE Release CACHE STRING "Build type" FORCE)
|
|
endif()
|
|
|
|
include(DoraTargets.cmake)
|
|
|
|
set(ZED_DIR "/usr/local/zed" CACHE PATH "Path to the ZED SDK")
|
|
set(ZED_PATH ${ZED_DIR})
|
|
find_package(CUDAToolkit REQUIRED)
|
|
find_package(zed REQUIRED)
|
|
|
|
find_package(OpenCV REQUIRED)
|
|
|
|
find_package(onnxruntime REQUIRED)
|
|
set(ONNXRUNTIME_INCLUDE_DIRS "") # propagated via imported target
|
|
set(ONNXRUNTIME_LIBRARIES onnxruntime::onnxruntime)
|
|
|
|
link_directories(${dora_link_dirs})
|
|
link_directories(${ZED_LIBRARY_DIR})
|
|
|
|
add_executable(dora_zed
|
|
src/main.cc
|
|
src/zed/camera.cc
|
|
src/engines/zed_native.cc
|
|
src/engines/yolo_onnx.cc
|
|
${node_bridge}
|
|
)
|
|
add_dependencies(dora_zed Dora_cxx)
|
|
|
|
target_include_directories(
|
|
dora_zed
|
|
PRIVATE
|
|
${CMAKE_CURRENT_SOURCE_DIR}/src
|
|
${dora_cxx_include_dir}
|
|
${dora_c_include_dir}
|
|
${ZED_INCLUDE_DIRS}
|
|
${OpenCV_INCLUDE_DIRS}
|
|
${CUDAToolkit_INCLUDE_DIRS}
|
|
${ONNXRUNTIME_INCLUDE_DIRS}
|
|
)
|
|
|
|
target_link_libraries(dora_zed dora_node_api_cxx ${ZED_LIBRARIES} ${OpenCV_LIBS} ${ONNXRUNTIME_LIBRARIES})
|
|
|
|
install(TARGETS dora_zed DESTINATION ${CMAKE_CURRENT_SOURCE_DIR}/bin)
|
|
|
|
# Standalone detector tests — no dora, no live camera required
|
|
|
|
add_executable(test_yolo_onnx
|
|
src/test_yolo_onnx.cc
|
|
src/engines/yolo_onnx.cc
|
|
)
|
|
target_include_directories(test_yolo_onnx PRIVATE
|
|
${CMAKE_CURRENT_SOURCE_DIR}/src
|
|
${ZED_INCLUDE_DIRS}
|
|
${OpenCV_INCLUDE_DIRS}
|
|
${CUDAToolkit_INCLUDE_DIRS}
|
|
${ONNXRUNTIME_INCLUDE_DIRS}
|
|
)
|
|
target_link_libraries(test_yolo_onnx PRIVATE
|
|
${ZED_LIBRARIES}
|
|
${OpenCV_LIBS}
|
|
${ONNXRUNTIME_LIBRARIES}
|
|
)
|
|
install(TARGETS test_yolo_onnx DESTINATION ${CMAKE_CURRENT_SOURCE_DIR}/bin)
|