cmake_minimum_required(VERSION 3.8)
project(external_localization_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(calibration_chassis_interfaces REQUIRED)
find_package(calibration_common_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)
find_package(rclcpp REQUIRED)
find_package(rclcpp_action REQUIRED)

include_directories(include)

add_library(external_reference_executor
  src/external_localization_algorithm_template.cpp
  src/external_reference_executor.cpp
  src/reference_pose_collection_algorithm.cpp
  src/marker_alignment_algorithm.cpp
  src/truth_source_validation_algorithm.cpp
)

ament_target_dependencies(external_reference_executor
  calibration_chassis_interfaces
  calibration_common_interfaces
  calibration_control_interfaces
  calibration_external_localization_interfaces
  calibration_sensor_interfaces
  calibration_vehicle_profile_interfaces
  calibration_workshop_orchestration_interfaces
  rclcpp
)

add_executable(external_localization_service_node
  src/main.cpp
  src/external_localization_service_node.cpp
)

ament_target_dependencies(external_localization_service_node
  calibration_common_interfaces
  calibration_external_localization_interfaces
  calibration_workshop_orchestration_interfaces
  rclcpp
  rclcpp_action
)

target_link_libraries(external_localization_service_node
  external_reference_executor
)

install(TARGETS
  external_reference_executor
  external_localization_service_node
  DESTINATION lib/${PROJECT_NAME}
)

install(DIRECTORY include/
  DESTINATION include/
)

ament_package()
