2026-06-26 17:55:15 +08:00

22 lines
1.1 KiB
CMake

# Minimal downstream build: link the prebuilt libstereo_bolt.so via c_api.h only.
# No OpenCV / RKNN headers needed here — the C ABI hides all C++/OpenCV types.
cmake_minimum_required(VERSION 3.16)
project(bolt_demo LANGUAGES C)
# Point at the unpacked delivery dir (contains include/ and lib/).
set(SB_ROOT "${CMAKE_CURRENT_LIST_DIR}/.." CACHE PATH "unpacked libstereo_bolt delivery root")
add_executable(bolt_demo main.c)
target_include_directories(bolt_demo PRIVATE "${SB_ROOT}/include")
target_link_directories(bolt_demo PRIVATE "${SB_ROOT}/lib")
target_link_libraries(bolt_demo PRIVATE stereo_bolt)
# libstereo_bolt.so pulls in OpenCV + librknnrt transitively. You do NOT need
# those at LINK time — defer their resolution to runtime so you can link with
# just -lstereo_bolt. (Without this, ld follows the NEEDED chain and fails with
# "undefined reference to rknn_*/cv::*".)
target_link_options(bolt_demo PRIVATE "LINKER:--allow-shlib-undefined")
# Runtime: LD_LIBRARY_PATH must include the dirs holding
# libstereo_bolt.so + libopencv_*.so (matching ABI_FINGERPRINT.txt) + librknnrt.so