154 lines
7.7 KiB
CMake
154 lines
7.7 KiB
CMake
cmake_minimum_required(VERSION 3.16.3)
|
|
|
|
project(mr_vision)
|
|
|
|
set(CMAKE_CXX_STANDARD 17)
|
|
set(CMAKE_BUILD_TYPE Release)
|
|
message(STATUS "--------------------CMAKE_BUILD_TYPE: ${CMAKE_BUILD_TYPE}--------------------")
|
|
|
|
find_package(OpenCV REQUIRED)
|
|
find_package(fmt REQUIRED)
|
|
find_package(Eigen3 REQUIRED)
|
|
find_package(spdlog REQUIRED)
|
|
find_package(yaml-cpp REQUIRED)
|
|
find_package(nlohmann_json REQUIRED)
|
|
set(OpenVINO_DIR "/opt/intel/openvino_2024.6.0/runtime/cmake/")
|
|
find_package(OpenVINO REQUIRED)
|
|
|
|
# 尝试查找ROS2
|
|
find_package(ament_cmake QUIET)
|
|
find_package(rclcpp QUIET)
|
|
|
|
if(ament_cmake_FOUND AND rclcpp_FOUND)
|
|
message(STATUS "ROS2 found, enabling ROS2 support")
|
|
set(USE_ROS2 ON)
|
|
add_definitions(-DUSE_ROS2)
|
|
|
|
# 查找rm_msgs包
|
|
find_package(rm_msgs REQUIRED)
|
|
else()
|
|
message(STATUS "ROS2 not found, building without ROS2 support")
|
|
set(USE_ROS2 OFF)
|
|
endif()
|
|
|
|
include_directories(${EIGEN3_INCLUDE_DIR})
|
|
include_directories(${OpenCV_INCLUDE_DIRS})
|
|
include_directories(${PROJECT_SOURCE_DIR})
|
|
|
|
|
|
add_subdirectory(src/component)
|
|
add_subdirectory(src/device)
|
|
add_subdirectory(src/module/auto_aim)
|
|
add_subdirectory(src/module/auto_buff)
|
|
add_subdirectory(src/module/omniperception)
|
|
|
|
|
|
|
|
##################calibration################
|
|
add_executable(capture calibration/capture.cpp)
|
|
add_executable(calibrate_camera calibration/calibrate_camera.cpp)
|
|
add_executable(calibrate_handeye calibration/calibrate_handeye.cpp)
|
|
add_executable(calibrate_robotworld_handeye calibration/calibrate_robotworld_handeye.cpp)
|
|
add_executable(split_video calibration/split_video.cpp)
|
|
|
|
target_link_libraries(capture ${OpenCV_LIBS} fmt::fmt yaml-cpp component device)
|
|
target_link_libraries(calibrate_camera ${OpenCV_LIBS} fmt::fmt yaml-cpp component)
|
|
target_link_libraries(calibrate_handeye ${OpenCV_LIBS} fmt::fmt yaml-cpp component)
|
|
target_link_libraries(calibrate_robotworld_handeye ${OpenCV_LIBS} fmt::fmt yaml-cpp component)
|
|
target_link_libraries(split_video ${OpenCV_LIBS} fmt::fmt component)
|
|
|
|
# ROS2版本的capture
|
|
if(USE_ROS2)
|
|
add_executable(capture_ros calibration/capture_ros.cpp)
|
|
target_link_libraries(capture_ros ${OpenCV_LIBS} fmt::fmt yaml-cpp component device rclcpp::rclcpp ${rm_msgs_TARGETS})
|
|
ament_target_dependencies(capture_ros rclcpp rm_msgs)
|
|
endif()
|
|
|
|
##################tests##################
|
|
add_executable(auto_aim_test src/task/test/auto_aim_test.cpp)
|
|
add_executable(auto_buff_test src/task/test/auto_buff_test.cpp)
|
|
add_executable(camera_detect_test src/task/test/camera_detect_test.cpp)
|
|
add_executable(camera_test src/task/test/camera_test.cpp)
|
|
add_executable(camera_thread_test src/task/test/camera_thread_test.cpp)
|
|
add_executable(cboard_test src/task/test/cboard_test.cpp)
|
|
add_executable(fire_test src/task/test/fire_test.cpp)
|
|
add_executable(detector_video_test src/task/test/detector_video_test.cpp)
|
|
add_executable(gimbal_response_test src/task/test/gimbal_response_test.cpp)
|
|
add_executable(multi_usbcamera_test src/task/test/multi_usbcamera_test.cpp)
|
|
add_executable(usbcamera_detect_test src/task/test/usbcamera_detect_test.cpp)
|
|
add_executable(usbcamera_test src/task/test/usbcamera_test.cpp)
|
|
add_executable(handeye_test src/task/test/handeye_test.cpp)
|
|
add_executable(dm_test src/task/test/dm_test.cpp)
|
|
add_executable(minimum_vision_system src/task/test/minimum_vision_system.cpp)
|
|
|
|
target_link_libraries(auto_aim_test ${OpenCV_LIBS} fmt::fmt yaml-cpp component device auto_aim)
|
|
target_link_libraries(auto_buff_test ${OpenCV_LIBS} fmt::fmt yaml-cpp auto_buff component device)
|
|
target_link_libraries(camera_detect_test ${OpenCV_LIBS} fmt::fmt yaml-cpp component auto_aim device)
|
|
target_link_libraries(camera_test ${OpenCV_LIBS} fmt::fmt component device)
|
|
target_link_libraries(camera_thread_test ${OpenCV_LIBS} fmt::fmt auto_aim component device)
|
|
target_link_libraries(cboard_test ${OpenCV_LIBS} fmt::fmt component device)
|
|
target_link_libraries(fire_test ${OpenCV_LIBS} fmt::fmt component device)
|
|
target_link_libraries(detector_video_test ${OpenCV_LIBS} fmt::fmt yaml-cpp component auto_aim)
|
|
target_link_libraries(gimbal_response_test ${OpenCV_LIBS} fmt::fmt yaml-cpp component device)
|
|
target_link_libraries(multi_usbcamera_test ${OpenCV_LIBS} fmt::fmt component device)
|
|
target_link_libraries(usbcamera_detect_test ${OpenCV_LIBS} fmt::fmt yaml-cpp component device auto_aim)
|
|
target_link_libraries(usbcamera_test ${OpenCV_LIBS} fmt::fmt yaml-cpp component device)
|
|
target_link_libraries(handeye_test ${OpenCV_LIBS} fmt::fmt yaml-cpp component device auto_aim)
|
|
target_link_libraries(dm_test ${OpenCV_LIBS} fmt::fmt yaml-cpp component device)
|
|
target_link_libraries(minimum_vision_system ${OpenCV_LIBS} fmt::fmt yaml-cpp component device auto_aim)
|
|
|
|
add_executable(gimbal_test src/task/test/gimbal_test.cpp)
|
|
target_link_libraries(gimbal_test ${OpenCV_LIBS} fmt::fmt yaml-cpp auto_aim component device)
|
|
|
|
add_executable(planner_test src/task/test/planner_test.cpp)
|
|
target_link_libraries(planner_test ${OpenCV_LIBS} fmt::fmt yaml-cpp auto_aim component device)
|
|
|
|
add_executable(planner_test_offline src/task/test/planner_test_offline.cpp)
|
|
target_link_libraries(planner_test_offline ${OpenCV_LIBS} fmt::fmt yaml-cpp auto_aim component device)
|
|
|
|
################## new tasks (no ROS2) ##################
|
|
add_executable(auto_aim_debug_mpc src/task/auto_aim_debug_mpc.cpp)
|
|
target_link_libraries(auto_aim_debug_mpc ${OpenCV_LIBS} fmt::fmt yaml-cpp nlohmann_json::nlohmann_json auto_aim component device)
|
|
|
|
add_executable(auto_buff_debug src/task/auto_buff_debug.cpp)
|
|
target_link_libraries(auto_buff_debug ${OpenCV_LIBS} fmt::fmt yaml-cpp nlohmann_json::nlohmann_json auto_aim auto_buff component device)
|
|
|
|
add_executable(auto_buff_debug_mpc src/task/auto_buff_debug_mpc.cpp)
|
|
target_link_libraries(auto_buff_debug_mpc ${OpenCV_LIBS} fmt::fmt yaml-cpp nlohmann_json::nlohmann_json auto_aim auto_buff component device)
|
|
|
|
add_executable(mt_auto_aim_debug src/task/mt_auto_aim_debug.cpp)
|
|
target_link_libraries(mt_auto_aim_debug ${OpenCV_LIBS} fmt::fmt yaml-cpp nlohmann_json::nlohmann_json auto_aim component device)
|
|
|
|
add_executable(mt_standard src/task/mt_standard.cpp)
|
|
target_link_libraries(mt_standard ${OpenCV_LIBS} fmt::fmt yaml-cpp auto_aim auto_buff component device)
|
|
|
|
add_executable(standard src/task/standard.cpp)
|
|
target_link_libraries(standard ${OpenCV_LIBS} fmt::fmt yaml-cpp auto_aim component device)
|
|
|
|
add_executable(standard_mpc src/task/standard_mpc.cpp)
|
|
target_link_libraries(standard_mpc ${OpenCV_LIBS} fmt::fmt yaml-cpp nlohmann_json::nlohmann_json auto_aim auto_buff component device)
|
|
|
|
add_executable(uav src/task/uav.cpp)
|
|
target_link_libraries(uav ${OpenCV_LIBS} fmt::fmt yaml-cpp auto_aim auto_buff component device)
|
|
|
|
add_executable(uav_debug src/task/uav_debug.cpp)
|
|
target_link_libraries(uav_debug ${OpenCV_LIBS} fmt::fmt yaml-cpp nlohmann_json::nlohmann_json auto_aim auto_buff component device)
|
|
|
|
add_executable(balance_infantry src/task/balance_infantry.cpp)
|
|
target_link_libraries(balance_infantry ${OpenCV_LIBS} fmt::fmt yaml-cpp nlohmann_json::nlohmann_json auto_aim auto_buff component device)
|
|
|
|
add_executable(balance_infantry_mpc src/task/balance_infantry_mpc.cpp)
|
|
target_link_libraries(balance_infantry_mpc ${OpenCV_LIBS} fmt::fmt yaml-cpp nlohmann_json::nlohmann_json auto_aim auto_buff component device)
|
|
|
|
################## ROS2 tasks ##################
|
|
if(USE_ROS2)
|
|
add_executable(sentry_mpc src/task/sentry_mpc.cpp)
|
|
target_link_libraries(sentry_mpc ${OpenCV_LIBS} fmt::fmt yaml-cpp nlohmann_json::nlohmann_json auto_aim auto_buff component device rclcpp::rclcpp ${rm_msgs_TARGETS})
|
|
ament_target_dependencies(sentry_mpc rclcpp rm_msgs)
|
|
|
|
add_executable(auto_aim_debug_mpc_ros src/task/auto_aim_debug_mpc_ros.cpp)
|
|
target_link_libraries(auto_aim_debug_mpc_ros ${OpenCV_LIBS} fmt::fmt yaml-cpp nlohmann_json::nlohmann_json auto_aim component device rclcpp::rclcpp ${rm_msgs_TARGETS})
|
|
ament_target_dependencies(auto_aim_debug_mpc_ros rclcpp rm_msgs)
|
|
endif()
|
|
|