cmake_minimum_required(VERSION 3.8)
project(agv_calib_core)

if(CMAKE_COMPILER_IS_GNUCXX OR CMAKE_CXX_COMPILER_ID MATCHES "Clang")
  add_compile_options(-Wall -Wextra -Wpedantic)
endif()

# 1. 寻找 ROS 2 和 行为树 核心依赖
find_package(ament_cmake REQUIRED)
find_package(rclcpp REQUIRED)
find_package(behaviortree_cpp_v3 REQUIRED) 
find_package(ament_index_cpp REQUIRED)

# 2. 编译主节点
add_executable(master_node src/master_node.cpp)
target_include_directories(master_node PUBLIC src)
ament_target_dependencies(master_node rclcpp behaviortree_cpp_v3 ament_index_cpp)

# 3. 安装规则 (极其重要：把剧本和程序装到系统目录，让 ROS 2 能找到它)
install(TARGETS master_node DESTINATION lib/${PROJECT_NAME})
install(DIRECTORY behavior_trees/ DESTINATION share/${PROJECT_NAME}/behavior_trees)

ament_package()