CMake
In order to configure CMake to find our two dependencies, OpenCV and DepthAI, we need to leverage find_package. If you installed DepthAI to a non-standard location, you need to set depthai_DIR to where it was built or where it was installed. Here, as an example, we set it to the install folder inside where it was built.
Then, we'll add_executable with the source files, which are covered in detail in the Header and Implementation sections.
Finally, we'll link the dependencies with target_link_libraries and include_directories.
All together, the CMakeLists.txt should look something like this.
cmake_minimum_required(VERSION 3.14)
project(smartcapture-cpp-luxonis DESCRIPTION "Scale Smart Capture Luxonis Example")
set(depthai_DIR /home/scale/scale_ws/depthai-core/build/install/lib/cmake/depthai)
find_package(OpenCV 4.5.0 REQUIRED)
find_package(depthai CONFIG REQUIRED)
set(SOURCES
src/luxonis_orin.cpp
src/main.cpp
include/luxonis_orin.hpp
)
add_executable(smartcapture-cpp-luxonis ${SOURCES})
target_link_libraries(smartcapture-cpp-luxonis PUBLIC smartcapture-cpp ${OpenCV_LIBRARIES} depthai::opencv)
include_directories(include/ ${OpenCV_INCLUDE_DIRS})
Updated 10 months ago
Did this page help you?