From 2bbe3c5e8b03b39b404f7af10f975628d6b2d24c Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Xavier=20Sol=C3=A9=20Nogu=C3=A9s?= Date: Fri, 17 May 2024 11:37:04 +0200 Subject: [PATCH] Remove boost from ROS2 (#7670) --- CMakeLists.txt | 1 - LibCarla/source/carla/ros2/ROS2CallbackData.h | 14 ++------------ Ros2Native/CMakeLists.txt | 2 +- Ros2Native/LibCarlaRos2Native/CMakeLists.txt | 4 ---- .../Carla/Source/Carla/Actor/ActorDispatcher.cpp | 5 +++-- 5 files changed, 6 insertions(+), 20 deletions(-) diff --git a/CMakeLists.txt b/CMakeLists.txt index 3a8232dc6..ec12313e8 100644 --- a/CMakeLists.txt +++ b/CMakeLists.txt @@ -82,7 +82,6 @@ if (BUILD_OSM_WORLD_RENDERER) endif () if (ENABLE_ROS2) - set (BOOST_INCLUDE_PATH ${CMAKE_BINARY_DIR}/_deps/boost-src/libs) add_subdirectory (Ros2Native) endif() diff --git a/LibCarla/source/carla/ros2/ROS2CallbackData.h b/LibCarla/source/carla/ros2/ROS2CallbackData.h index 47a565dbc..488e46cac 100644 --- a/LibCarla/source/carla/ros2/ROS2CallbackData.h +++ b/LibCarla/source/carla/ros2/ROS2CallbackData.h @@ -6,16 +6,6 @@ #pragma once -#ifdef _MSC_VER -#pragma warning(push) -#pragma warning(disable:4583) -#pragma warning(disable:4582) -#include -#pragma warning(pop) -#else -#include -#endif - #include #include @@ -38,8 +28,8 @@ namespace ros2 { const char* message; }; - using ROS2CallbackData = boost::variant2::variant; - using ROS2MessageCallbackData = boost::variant2::variant; + using ROS2CallbackData = std::variant; + using ROS2MessageCallbackData = std::variant; using ActorCallback = std::function; using ActorMessageCallback = std::function; diff --git a/Ros2Native/CMakeLists.txt b/Ros2Native/CMakeLists.txt index bf03f7759..d725812ad 100644 --- a/Ros2Native/CMakeLists.txt +++ b/Ros2Native/CMakeLists.txt @@ -33,7 +33,7 @@ ExternalProject_Add ( carla-ros2-native-lib DEPENDS fastdds 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) diff --git a/Ros2Native/LibCarlaRos2Native/CMakeLists.txt b/Ros2Native/LibCarlaRos2Native/CMakeLists.txt index a9d211ecc..86d0061a6 100644 --- a/Ros2Native/LibCarlaRos2Native/CMakeLists.txt +++ b/Ros2Native/LibCarlaRos2Native/CMakeLists.txt @@ -32,10 +32,6 @@ add_library ( target_include_directories (carla-ros2-native SYSTEM PRIVATE ${LIBCARLA_SOURCE_PATH} ${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 diff --git a/Unreal/CarlaUnreal/Plugins/Carla/Source/Carla/Actor/ActorDispatcher.cpp b/Unreal/CarlaUnreal/Plugins/Carla/Source/Carla/Actor/ActorDispatcher.cpp index 0e7f35b3e..c550a8fe8 100644 --- a/Unreal/CarlaUnreal/Plugins/Carla/Source/Carla/Actor/ActorDispatcher.cpp +++ b/Unreal/CarlaUnreal/Plugins/Carla/Source/Carla/Actor/ActorDispatcher.cpp @@ -20,6 +20,7 @@ #include #include "carla/ros2/ROS2.h" #include + #include #endif void UActorDispatcher::Bind(FActorDefinition Definition, SpawnFunctionType Functor) @@ -213,14 +214,14 @@ FCarlaActor* UActorDispatcher::RegisterActor( { AActor *UEActor = reinterpret_cast(Actor); ActorROS2Handler Handler(UEActor, RosName); - boost::variant2::visit(Handler, Data); + std::visit(Handler, Data); }); ROS2->AddBasicSubscriberCallback(static_cast(&Actor), RosName, [RosName](void *Actor, carla::ros2::ROS2MessageCallbackData Data) -> void { AActor *UEActor = reinterpret_cast(Actor); ActorROS2Handler Handler(UEActor, RosName); - boost::variant2::visit(Handler, Data); + std::visit(Handler, Data); }); } }