In this article we are going to show how to use cross compile from CMake. In order to do that we should follow carefully the Cross Compile guide to make sure the environmnet is properly set.
Additional Dependencies
There are few dependencies should be installed on your local system before running CMake:
sudo apt install \
gcc-aarch64-linux-gnu \
g++-aarch64-linux-gnu \
libvideostream:arm64 \
libvaal:arm64
At this point our libraries are ready to be used.
CC=aarch64-linux-gnu-gcc CXX=aarch64-linux-gnu-g++ cmake -B build_imx
The build_imx folder will be created and the project will use the respective compiler assigned to CC or CXX. After this step, we are ready to build our executable by calling:
cmake --build build_imx
CMakeLists.txt
cmake_minimum_required(VERSION 3.20)
project(detect C)
include(GNUInstallDirs)
include(CMakeToolsHelpers OPTIONAL)
find_package(Threads REQUIRED)
find_package(VideoStream REQUIRED)
find_package(VAAL REQUIRED)
find_package(DeepViewRT REQUIRED)
include_directories(${CMAKE_CURRENT_BINARY_DIR})
add_executable(detect detect.c)
target_link_libraries(detect videostream vaal deepview-rt)
install(TARGETS detect RUNTIME DESTINATION bin)
Comments
0 comments
Please sign in to leave a comment.