cmake_minimum_required(VERSION 3.8)
project(mg_bt)

set(CMAKE_CXX_STANDARD 17)
set(CMAKE_CXX_STANDARD_REQUIRED ON)


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

# find dependencies
find_package(ament_cmake REQUIRED)
find_package(rclcpp REQUIRED)
find_package(behaviortree_cpp REQUIRED)
find_package(behaviortree_ros2 REQUIRED)
find_package(btcpp_ros2_interfaces REQUIRED)
find_package(mg_msgs REQUIRED)

set(PACKAGE_DEPS
  rclcpp
  behaviortree_cpp
  behaviortree_ros2
  btcpp_ros2_interfaces
  mg_msgs
)


add_executable(mg_bt_executor 
  src/mg_bt_executor.cpp
  src/MoveStraightBehavior.cpp)
ament_target_dependencies(mg_bt_executor ${PACKAGE_DEPS})

target_include_directories(
  mg_bt_executor
  PRIVATE
  include
)

install( TARGETS
  mg_bt_executor
  DESTINATION lib/${PROJECT_NAME}
)

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

if(BUILD_TESTING)
  find_package(ament_lint_auto REQUIRED)
  # the following line skips the linter which checks for copyrights
  # comment the line when a copyright and license is added to all source files
  set(ament_cmake_copyright_FOUND TRUE)
  # the following line skips cpplint (only works in a git repo)
  # comment the line when this package is in a git repo and when
  # a copyright and license is added to all source files
  set(ament_cmake_cpplint_FOUND TRUE)
  ament_lint_auto_find_test_dependencies()
endif()


ament_export_dependencies(behaviortree_ros2 btcpp_ros2_interfaces)

ament_package()
