cmake_minimum_required(VERSION 3.8)
project(chassis_calibration_service)

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

set(CMAKE_CXX_STANDARD 17)
set(CMAKE_CXX_STANDARD_REQUIRED ON)

find_package(ament_cmake REQUIRED)
find_package(rclcpp REQUIRED)
find_package(rclcpp_action REQUIRED)
find_package(rclcpp_components REQUIRED)
find_package(calibration_common_interfaces REQUIRED)
find_package(calibration_chassis_interfaces REQUIRED)
find_package(calibration_control_interfaces REQUIRED)
find_package(calibration_external_localization_interfaces REQUIRED)
find_package(calibration_sensor_interfaces REQUIRED)
find_package(calibration_vehicle_profile_interfaces REQUIRED)
find_package(calibration_workshop_orchestration_interfaces REQUIRED)

include_directories(include)

add_library(chassis_calibration_service_component SHARED
  src/chassis_calibration_service_node.cpp
  src/chassis_calibration_algorithm_template.cpp
  src/ackermann_chassis_algorithm.cpp
  src/differential_chassis_algorithm.cpp
  src/single_steer_wheel_chassis_algorithm.cpp
  src/multi_steer_wheel_chassis_algorithm.cpp
)

ament_target_dependencies(chassis_calibration_service_component
  rclcpp
  rclcpp_action
  rclcpp_components
  calibration_common_interfaces
  calibration_chassis_interfaces
  calibration_control_interfaces
  calibration_external_localization_interfaces
  calibration_sensor_interfaces
  calibration_vehicle_profile_interfaces
  calibration_workshop_orchestration_interfaces
)

rclcpp_components_register_nodes(chassis_calibration_service_component
  "chassis_calibration_service::ChassisCalibrationServiceNode"
)

add_executable(chassis_calibration_service_node src/main.cpp)
ament_target_dependencies(chassis_calibration_service_node
  rclcpp
  rclcpp_components
)
target_link_libraries(chassis_calibration_service_node
  chassis_calibration_service_component
)

install(TARGETS
  chassis_calibration_service_component
  chassis_calibration_service_node
  ARCHIVE DESTINATION lib
  LIBRARY DESTINATION lib
  RUNTIME DESTINATION lib/${PROJECT_NAME}
)

install(DIRECTORY include/
  DESTINATION include/
)

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

ament_package()
