cmake_minimum_required(VERSION 3.10.2 FATAL_ERROR)

set(CMAKE_CXX_STANDARD 17)
set(CMAKE_CXX_STANDARD_REQUIRED ON)

project(ign_actor_plugin)

find_package(ament_cmake REQUIRED)
find_package(ignition-cmake2 REQUIRED)
find_package(ignition-gazebo6 REQUIRED)
find_package(geometry_msgs REQUIRED)
find_package(ros_actor_message_queue_msgs REQUIRED)

find_package(ignition-plugin1 REQUIRED COMPONENTS register)
set(IGN_PLUGIN_VER ${ignition-plugin1_VERSION_MAJOR})

ament_export_dependencies(ign_actor_plugin
    "rosidl_default_runtime"
    "ros_actor_action_server_msgs"
    "geometry_msgs"
)

# Add sources for each plugin to be registered.
add_library(ign_actor_plugin SHARED src/ActorSystem.cpp)
ament_target_dependencies(ign_actor_plugin ros_actor_message_queue_msgs geometry_msgs)
set_property(TARGET ign_actor_plugin PROPERTY CXX_STANDARD 17)
target_compile_options(ign_actor_plugin PRIVATE -std=c++17)

target_link_libraries(ign_actor_plugin
    ignition-gazebo6::ignition-gazebo6
    ignition-plugin${IGN_PLUGIN_VER}::ignition-plugin${IGN_PLUGIN_VER}
)

install(TARGETS
    ign_actor_plugin
    DESTINATION share/${PROJECT_NAME}
)
install(DIRECTORY   animation    DESTINATION   share/${PROJECT_NAME})

ament_package()
