Remove boost from ROS2 (#7670)

This commit is contained in:
Xavier Solé Nogués 2024-05-17 11:37:04 +02:00 committed by GitHub
parent 298d44b31b
commit 2bbe3c5e8b
No known key found for this signature in database
GPG Key ID: B5690EEEBB952194
5 changed files with 6 additions and 20 deletions

View File

@ -82,7 +82,6 @@ if (BUILD_OSM_WORLD_RENDERER)
endif () endif ()
if (ENABLE_ROS2) if (ENABLE_ROS2)
set (BOOST_INCLUDE_PATH ${CMAKE_BINARY_DIR}/_deps/boost-src/libs)
add_subdirectory (Ros2Native) add_subdirectory (Ros2Native)
endif() endif()

View File

@ -6,16 +6,6 @@
#pragma once #pragma once
#ifdef _MSC_VER
#pragma warning(push)
#pragma warning(disable:4583)
#pragma warning(disable:4582)
#include <boost/variant2/variant.hpp>
#pragma warning(pop)
#else
#include <boost/variant2/variant.hpp>
#endif
#include <variant> #include <variant>
#include <functional> #include <functional>
@ -38,8 +28,8 @@ namespace ros2 {
const char* message; const char* message;
}; };
using ROS2CallbackData = boost::variant2::variant<VehicleControl>; using ROS2CallbackData = std::variant<VehicleControl>;
using ROS2MessageCallbackData = boost::variant2::variant<MessageControl>; using ROS2MessageCallbackData = std::variant<MessageControl>;
using ActorCallback = std::function<void(void *actor, ROS2CallbackData data)>; using ActorCallback = std::function<void(void *actor, ROS2CallbackData data)>;
using ActorMessageCallback = std::function<void(void *actor, ROS2MessageCallbackData data)>; using ActorMessageCallback = std::function<void(void *actor, ROS2MessageCallbackData data)>;

View File

@ -33,7 +33,7 @@ ExternalProject_Add (
carla-ros2-native-lib carla-ros2-native-lib
DEPENDS fastdds DEPENDS fastdds
SOURCE_DIR ${PROJECT_SOURCE_DIR}/LibCarlaRos2Native SOURCE_DIR ${PROJECT_SOURCE_DIR}/LibCarlaRos2Native
CMAKE_ARGS ${PROJECT_CMAKE_FLAGS} -DBOOST_INCLUDE_PATH=${BOOST_INCLUDE_PATH} CMAKE_ARGS ${PROJECT_CMAKE_FLAGS}
) )
set (CARLA_PLUGIN_BINARY_PATH ${CMAKE_SOURCE_DIR}/Unreal/CarlaUnreal/Plugins/Carla/Binaries/Linux) set (CARLA_PLUGIN_BINARY_PATH ${CMAKE_SOURCE_DIR}/Unreal/CarlaUnreal/Plugins/Carla/Binaries/Linux)

View File

@ -32,10 +32,6 @@ add_library (
target_include_directories (carla-ros2-native SYSTEM PRIVATE target_include_directories (carla-ros2-native SYSTEM PRIVATE
${LIBCARLA_SOURCE_PATH} ${LIBCARLA_SOURCE_PATH}
${CMAKE_INSTALL_PREFIX}/include ${CMAKE_INSTALL_PREFIX}/include
${BOOST_INCLUDE_PATH}/variant2/include
${BOOST_INCLUDE_PATH}/mp11/include
${BOOST_INCLUDE_PATH}/assert/include
${BOOST_INCLUDE_PATH}/config/include
) )
target_compile_definitions (carla-ros2-native PUBLIC target_compile_definitions (carla-ros2-native PUBLIC

View File

@ -20,6 +20,7 @@
#include <compiler/disable-ue4-macros.h> #include <compiler/disable-ue4-macros.h>
#include "carla/ros2/ROS2.h" #include "carla/ros2/ROS2.h"
#include <compiler/enable-ue4-macros.h> #include <compiler/enable-ue4-macros.h>
#include <variant>
#endif #endif
void UActorDispatcher::Bind(FActorDefinition Definition, SpawnFunctionType Functor) void UActorDispatcher::Bind(FActorDefinition Definition, SpawnFunctionType Functor)
@ -213,14 +214,14 @@ FCarlaActor* UActorDispatcher::RegisterActor(
{ {
AActor *UEActor = reinterpret_cast<AActor *>(Actor); AActor *UEActor = reinterpret_cast<AActor *>(Actor);
ActorROS2Handler Handler(UEActor, RosName); ActorROS2Handler Handler(UEActor, RosName);
boost::variant2::visit(Handler, Data); std::visit(Handler, Data);
}); });
ROS2->AddBasicSubscriberCallback(static_cast<void*>(&Actor), RosName, [RosName](void *Actor, carla::ros2::ROS2MessageCallbackData Data) -> void ROS2->AddBasicSubscriberCallback(static_cast<void*>(&Actor), RosName, [RosName](void *Actor, carla::ros2::ROS2MessageCallbackData Data) -> void
{ {
AActor *UEActor = reinterpret_cast<AActor *>(Actor); AActor *UEActor = reinterpret_cast<AActor *>(Actor);
ActorROS2Handler Handler(UEActor, RosName); ActorROS2Handler Handler(UEActor, RosName);
boost::variant2::visit(Handler, Data); std::visit(Handler, Data);
}); });
} }
} }