cmake_minimum_required(VERSION 3.8)
project(origincar_birdseye)

if(NOT CMAKE_CXX_STANDARD)
  set(CMAKE_CXX_STANDARD 17)
endif()

find_package(ament_cmake REQUIRED)
find_package(cv_bridge REQUIRED)
find_package(geometry_msgs REQUIRED)
find_package(OpenCV REQUIRED)
find_package(rclcpp REQUIRED)
find_package(sensor_msgs REQUIRED)
find_package(tf2 REQUIRED)
find_package(tf2_geometry_msgs REQUIRED)
find_package(tf2_ros REQUIRED)

add_executable(birdseye_node src/birdseye_node.cpp)
target_include_directories(birdseye_node PRIVATE include)
ament_target_dependencies(birdseye_node
  cv_bridge
  geometry_msgs
  rclcpp
  sensor_msgs
  tf2
  tf2_geometry_msgs
  tf2_ros)
target_link_libraries(birdseye_node ${OpenCV_LIBS} tf2_geometry_msgs::tf2_geometry_msgs)

add_executable(synthetic_camera_node src/synthetic_camera_node.cpp)
ament_target_dependencies(synthetic_camera_node rclcpp sensor_msgs)

if(BUILD_TESTING)
  find_package(ament_cmake_gtest REQUIRED)
  ament_add_gtest(test_ground_projection test/test_ground_projection.cpp)
  target_include_directories(test_ground_projection PRIVATE include)
endif()

install(TARGETS birdseye_node synthetic_camera_node DESTINATION lib/${PROJECT_NAME})
install(DIRECTORY config launch DESTINATION share/${PROJECT_NAME})
install(DIRECTORY include/ DESTINATION include)
install(FILES README.md DESTINATION share/${PROJECT_NAME})

ament_package()
