mirror of
https://github.com/azaion/autopilot.git
synced 2026-04-22 21:56:35 +00:00
62 lines
1.7 KiB
CMake
62 lines
1.7 KiB
CMake
cmake_minimum_required(VERSION 3.10)
|
|
|
|
# Set the project name in a variable
|
|
set(project_name yolov10_cpp)
|
|
project(${project_name})
|
|
set(CMAKE_CXX_STANDARD 17)
|
|
|
|
find_package(OpenCV REQUIRED)
|
|
|
|
# Find ONNX Runtime package
|
|
find_path(ONNXRUNTIME_INCLUDE_DIR onnxruntime_c_api.h
|
|
HINTS /opt/onnxruntime-linux-x64-rocm-1.18.0/include
|
|
)
|
|
find_library(ONNXRUNTIME_LIBRARY onnxruntime
|
|
HINTS /opt/onnxruntime-linux-x64-rocm-1.18.0/lib
|
|
)
|
|
|
|
if(NOT ONNXRUNTIME_INCLUDE_DIR)
|
|
message(FATAL_ERROR "ONNX Runtime include directory not found")
|
|
endif()
|
|
if(NOT ONNXRUNTIME_LIBRARY)
|
|
message(FATAL_ERROR "ONNX Runtime library not found")
|
|
endif()
|
|
|
|
add_library(${project_name}-lib
|
|
src/placeholder.cpp
|
|
src/ia/inference.cpp
|
|
src/ia/inference.h
|
|
)
|
|
|
|
target_include_directories(${project_name}-lib PUBLIC src)
|
|
target_include_directories(${project_name}-lib PUBLIC ${ONNXRUNTIME_INCLUDE_DIR})
|
|
|
|
target_link_libraries(${project_name}-lib
|
|
PUBLIC ${OpenCV_LIBS}
|
|
PUBLIC ${ONNXRUNTIME_LIBRARY}
|
|
)
|
|
|
|
# Add the main executable
|
|
add_executable(${project_name}
|
|
./src/main.cpp
|
|
)
|
|
target_include_directories(${project_name} PUBLIC ${ONNXRUNTIME_INCLUDE_DIR})
|
|
target_link_libraries(${project_name} ${project_name}-lib)
|
|
|
|
# Add the video executable
|
|
add_executable(${project_name}_video
|
|
./src/video.cpp
|
|
)
|
|
|
|
# Add the video executable
|
|
add_executable(${project_name}_video_rtsp
|
|
./src/video_rtsp.cpp
|
|
)
|
|
|
|
target_include_directories(${project_name}_video PUBLIC ${ONNXRUNTIME_INCLUDE_DIR})
|
|
target_link_libraries(${project_name}_video ${project_name}-lib)
|
|
|
|
target_include_directories(${project_name}_video_rtsp PUBLIC ${ONNXRUNTIME_INCLUDE_DIR})
|
|
target_link_libraries(${project_name}_video_rtsp ${project_name}-lib)
|
|
|