cmake_minimum_required(VERSION 3.5)
project(planner)

if(NOT CMAKE_CXX_STANDARD)
  set(CMAKE_CXX_STANDARD 17)
endif()

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

find_package(ament_cmake REQUIRED)
find_package(geometry_msgs REQUIRED)
find_package(nav_msgs REQUIRED)
find_package(rclcpp REQUIRED)
find_package(std_msgs REQUIRED)
find_package(tf2 REQUIRED)
find_package(tf2_geometry_msgs REQUIRED)
find_package(tf2_ros REQUIRED)

add_executable(planner_version src/planner_version.cpp)
add_executable(grid_astar_theta_node src/grid_astar_theta_node.cpp)
ament_target_dependencies(grid_astar_theta_node
  geometry_msgs
  nav_msgs
  rclcpp
  std_msgs
  tf2
  tf2_geometry_msgs
  tf2_ros
)

install(TARGETS
  planner_version
  grid_astar_theta_node
  DESTINATION lib/${PROJECT_NAME}
)

install(PROGRAMS
  scripts/topology_pure_pursuit_node.py
  scripts/grid_astar_theta_node.py
  scripts/send_goal.py
  scripts/send_start_goal.py
  scripts/odom_map_tf.py
  scripts/preflight_check.py
  scripts/map_info.py
  scripts/navigation_test_recorder.py
  scripts/goal_reach_debug_collector.py
  scripts/ackermann_cmd_bridge.py
  scripts/lidar_health_check.py
  scripts/evaluate_navigation_test.py
  DESTINATION lib/${PROJECT_NAME}
)

install(
  DIRECTORY launch config maps
  DESTINATION share/${PROJECT_NAME}
)

install(FILES
  README.md
  ACKERMANN_HYBRID_ASTAR_PLAN.md
  REAL_ROBOT_RUNBOOK.md
  REAL_ROBOT_TEST_PLAN_ZH.md
  操作手册.md
  DESTINATION share/${PROJECT_NAME}
)

if(BUILD_TESTING)
  find_package(ament_lint_auto REQUIRED)
  set(ament_cmake_copyright_FOUND TRUE)
  set(ament_cmake_cpplint_FOUND TRUE)
  ament_lint_auto_find_test_dependencies()
endif()

ament_package()
