cmake_minimum_required(VERSION 3.10.2 FATAL_ERROR)
project(btree)

add_compile_options(-Wall -Wextra -Wpedantic)
set(CMAKE_CXX_STANDARD_REQUIRED ON)
set(CMAKE_POSITION_INDEPENDENT_CODE ON)



# find dependencies

set(DEPENDENCIES
        ament_cmake
        rclcpp
        rclcpp_action
        #geometry_msgs
        std_msgs
        behaviortree_cpp_v3

        tf2_geometry_msgs
        moveit_core
        moveit_ros_planning_interface
        tf2_geometry_msgs
        moveit_ros_planning
        pluginlib
        ros_actor_action_server_msgs
        )

foreach(dep IN LISTS DEPENDENCIES)
    find_package(${dep} REQUIRED)
endforeach()

# uncomment the following section in order to fill in
# further dependencies manually.
# find_package(<dependency> REQUIRED)

set(CPP_FILES
        src/Tree.cpp
        src/nodes/WeightedRandomNode.cpp
        src/nodes/GenerateXYPose.cpp
        src/nodes/RobotMove.cpp
        src/nodes/MoveConnection.cpp
        src/nodes/OffsetPose.cpp
        src/nodes/RandomFailure.cpp
        src/nodes/InAreaTest.cpp
        src/nodes/InterruptableSequence.cpp
        src/nodes/SetRobotVelocity.cpp
        src/nodes/ActorAnimation.cpp
        src/nodes/ActorMovement.cpp
        )
add_executable(tree ${CPP_FILES})
SET_SOURCE_FILES_PROPERTIES(src/Extensions.hpp PROPERTIES COMPILE_FLAGS -O0)
target_include_directories(tree PUBLIC /src /src/nodes)
set_property(TARGET tree PROPERTY CXX_STANDARD 17)
ament_target_dependencies(tree ${DEPENDENCIES})

install(TARGETS
        tree
        DESTINATION lib/${PROJECT_NAME})
        
install(DIRECTORY   trees     DESTINATION   share/${PROJECT_NAME})

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

ament_package()
