mirror of
https://github.com/microsoft/vcpkg.git
synced 2024-12-26 01:30:55 +08:00
[gazebo] Fix dependencies and update (#42807)
Co-authored-by: Monica <v-liumonica@microsoft.com>
This commit is contained in:
parent
11627a2ca7
commit
faa3c0a405
@ -1,26 +1,145 @@
|
||||
diff --git a/cmake/SearchForStuff.cmake b/cmake/SearchForStuff.cmake
|
||||
index 4085b5aaeb..f89ac88333 100644
|
||||
index 732cbb4..d9d4c0c 100644
|
||||
--- a/cmake/SearchForStuff.cmake
|
||||
+++ b/cmake/SearchForStuff.cmake
|
||||
@@ -179,7 +179,7 @@ if (PKG_CONFIG_FOUND)
|
||||
@@ -3,11 +3,9 @@ include (CheckCXXSourceCompiles)
|
||||
|
||||
include (${gazebo_cmake_dir}/FindOS.cmake)
|
||||
find_package(PkgConfig)
|
||||
-include (${gazebo_cmake_dir}/FindFreeimage.cmake)
|
||||
-
|
||||
-execute_process(COMMAND ${PKG_CONFIG_EXECUTABLE} --modversion protobuf
|
||||
- OUTPUT_VARIABLE PROTOBUF_VERSION
|
||||
- RESULT_VARIABLE protobuf_modversion_failed)
|
||||
+find_package(freeimage CONFIG REQUIRED)
|
||||
+set(freeimage_LIBRARIES freeimage::FreeImage)
|
||||
+get_target_property(freeimage_INCLUDE_DIRS freeimage::FreeImage INTERFACE_INCLUDE_DIRECTORIES)
|
||||
|
||||
########################################
|
||||
# 1. can not use GAZEBO_BUILD_TYPE_PROFILE is defined after include this module
|
||||
@@ -25,6 +23,8 @@ if (CMAKE_BUILD_TYPE)
|
||||
endif()
|
||||
|
||||
########################################
|
||||
+find_package(Protobuf CONFIG REQUIRED)
|
||||
+
|
||||
if (PROTOBUF_VERSION LESS 2.3.0)
|
||||
BUILD_ERROR("Incorrect version: Gazebo requires protobuf version 2.3.0 or greater")
|
||||
endif()
|
||||
@@ -35,6 +35,7 @@ endif()
|
||||
# Protobuf >= 22 requires to link abseil, so we are constrained to use
|
||||
# find_package(Protobuf) and link to protobuf::libprotobuf,
|
||||
# see https://github.com/conda-forge/conda-forge-pinning-feedstock/issues/4075#issuecomment-1569242816
|
||||
+
|
||||
if (DEFINED PROTOBUF_VERSION AND PROTOBUF_VERSION GREATER_EQUAL 22.0)
|
||||
set(GZ_PROTOBUF_USE_CMAKE_CONFIG_DEFAULT ON)
|
||||
else()
|
||||
@@ -62,7 +63,6 @@ if(NOT GZ_PROTOBUF_USE_CMAKE_CONFIG)
|
||||
set (GZ_PROTOBUF_PROTOC_LIBRARY ${PROTOBUF_PROTOC_LIBRARY})
|
||||
endif()
|
||||
else()
|
||||
- find_package(Protobuf CONFIG REQUIRED)
|
||||
set (GZ_PROTOBUF_LIBRARY protobuf::libprotobuf)
|
||||
set (GZ_PROTOBUF_PROTOC_LIBRARY protobuf::libprotoc)
|
||||
if(NOT DEFINED PROTOBUF_PROTOC_EXECUTABLE)
|
||||
@@ -203,7 +203,7 @@ if (PKG_CONFIG_FOUND)
|
||||
# (needed, at least, for MacOS)
|
||||
|
||||
# Use system installation on UNIX and Apple, and internal copy on Windows
|
||||
- if (UNIX OR APPLE)
|
||||
+ if (true)
|
||||
message (STATUS "Using system tinyxml.")
|
||||
set (USE_EXTERNAL_TINYXML True)
|
||||
set (USE_EXTERNAL_TINYXML_DEFAULT_VALUE ON)
|
||||
elseif(WIN32)
|
||||
@@ -225,7 +225,7 @@ if (PKG_CONFIG_FOUND)
|
||||
set (USE_EXTERNAL_TINYXML_DEFAULT_VALUE OFF)
|
||||
@@ -252,7 +252,7 @@ if (PKG_CONFIG_FOUND)
|
||||
# (needed, at least, for MacOS)
|
||||
|
||||
# Use system installation on UNIX and Apple, and internal copy on Windows
|
||||
- if (UNIX OR APPLE)
|
||||
+ if (true)
|
||||
message (STATUS "Using system tinyxml2.")
|
||||
set (USE_EXTERNAL_TINYXML2 True)
|
||||
set (USE_EXTERNAL_TINYXML2_DEFAULT_VALUE ON)
|
||||
elseif(WIN32)
|
||||
@@ -513,7 +513,7 @@ if (PKG_CONFIG_FOUND)
|
||||
set (USE_EXTERNAL_TINYXML2_DEFAULT_VALUE OFF)
|
||||
@@ -331,8 +331,7 @@ if (PKG_CONFIG_FOUND)
|
||||
|
||||
#################################################
|
||||
# Find TBB
|
||||
- pkg_check_modules(TBB tbb)
|
||||
- set (TBB_PKG_CONFIG "tbb")
|
||||
+ find_package(TBB CONFIG REQUIRED)
|
||||
if (NOT TBB_FOUND)
|
||||
message(STATUS "TBB not found, attempting to detect manually")
|
||||
set (TBB_PKG_CONFIG "")
|
||||
@@ -365,23 +364,20 @@ if (PKG_CONFIG_FOUND)
|
||||
#################################################
|
||||
# Find OGRE
|
||||
|
||||
- pkg_check_modules(OGRE-RTShaderSystem
|
||||
- OGRE-RTShaderSystem>=${MIN_OGRE_VERSION})
|
||||
+ find_package(OGRE CONFIG REQUIRED)
|
||||
|
||||
- if (OGRE-RTShaderSystem_FOUND)
|
||||
- set(ogre_ldflags ${OGRE-RTShaderSystem_LDFLAGS})
|
||||
- set(ogre_include_dirs ${OGRE-RTShaderSystem_INCLUDE_DIRS})
|
||||
- set(ogre_libraries ${OGRE-RTShaderSystem_LIBRARIES})
|
||||
- set(ogre_library_dirs ${OGRE-RTShaderSystem_LIBRARY_DIRS})
|
||||
- set(ogre_cflags ${OGRE-RTShaderSystem_CFLAGS})
|
||||
+ if (OGRE_RTShaderSystem_FOUND)
|
||||
+ set(ogre_ldflags ${OGRE_RTShaderSystem_LDFLAGS})
|
||||
+ set(ogre_include_dirs ${OGRE_RTShaderSystem_INCLUDE_DIRS})
|
||||
+ set(ogre_libraries ${OGRE_RTShaderSystem_LIBRARIES})
|
||||
+ set(ogre_library_dirs ${OGRE_RTShaderSystem_LIBRARY_DIRS})
|
||||
+ set(ogre_cflags ${OGRE_RTShaderSystem_CFLAGS})
|
||||
|
||||
set (INCLUDE_RTSHADER ON CACHE BOOL "Enable GPU shaders")
|
||||
else ()
|
||||
set (INCLUDE_RTSHADER OFF CACHE BOOL "Enable GPU shaders")
|
||||
endif ()
|
||||
|
||||
- pkg_check_modules(OGRE OGRE>=${MIN_OGRE_VERSION})
|
||||
-
|
||||
if (PKG_CONFIG_EXECUTABLE AND OGRE_FOUND AND NOT DEFINED OGRE_VERSION)
|
||||
execute_process(COMMAND ${PKG_CONFIG_EXECUTABLE} --modversion OGRE
|
||||
OUTPUT_VARIABLE OGRE_VERSION)
|
||||
@@ -451,25 +447,22 @@ if (PKG_CONFIG_FOUND)
|
||||
set(ogre_cflags ${ogre_cflags} ${OGRE_CFLAGS})
|
||||
endif ()
|
||||
|
||||
- pkg_check_modules(OGRE-Terrain OGRE-Terrain)
|
||||
- if (OGRE-Terrain_FOUND)
|
||||
- set(ogre_ldflags ${ogre_ldflags} ${OGRE-Terrain_LDFLAGS})
|
||||
- set(ogre_include_dirs ${ogre_include_dirs} ${OGRE-Terrain_INCLUDE_DIRS})
|
||||
- set(ogre_libraries ${ogre_libraries};${OGRE-Terrain_LIBRARIES})
|
||||
- set(ogre_library_dirs ${ogre_library_dirs} ${OGRE-Terrain_LIBRARY_DIRS})
|
||||
- set(ogre_cflags ${ogre_cflags} ${OGRE-Terrain_CFLAGS})
|
||||
+ if (OGRE_Terrain_FOUND)
|
||||
+ set(ogre_ldflags ${ogre_ldflags} ${OGRE_Terrain_LDFLAGS})
|
||||
+ set(ogre_include_dirs ${ogre_include_dirs} ${OGRE_Terrain_INCLUDE_DIRS})
|
||||
+ set(ogre_libraries ${ogre_libraries};${OGRE_Terrain_LIBRARIES})
|
||||
+ set(ogre_library_dirs ${ogre_library_dirs} ${OGRE_Terrain_LIBRARY_DIRS})
|
||||
+ set(ogre_cflags ${ogre_cflags} ${OGRE_Terrain_CFLAGS})
|
||||
endif()
|
||||
|
||||
- pkg_check_modules(OGRE-Overlay OGRE-Overlay)
|
||||
- if (OGRE-Overlay_FOUND)
|
||||
- set(ogre_ldflags ${ogre_ldflags} ${OGRE-Overlay_LDFLAGS})
|
||||
- set(ogre_include_dirs ${ogre_include_dirs} ${OGRE-Overlay_INCLUDE_DIRS})
|
||||
- set(ogre_libraries ${ogre_libraries};${OGRE-Overlay_LIBRARIES})
|
||||
- set(ogre_library_dirs ${ogre_library_dirs} ${OGRE-Overlay_LIBRARY_DIRS})
|
||||
- set(ogre_cflags ${ogre_cflags} ${OGRE-Overlay_CFLAGS})
|
||||
+ if (OGRE_Overlay_FOUND)
|
||||
+ set(ogre_ldflags ${ogre_ldflags} ${OGRE_Overlay_LDFLAGS})
|
||||
+ set(ogre_include_dirs ${ogre_include_dirs} ${OGRE_Overlay_INCLUDE_DIRS})
|
||||
+ set(ogre_libraries ${ogre_libraries};${OGRE_Overlay_LIBRARIES})
|
||||
+ set(ogre_library_dirs ${ogre_library_dirs} ${OGRE_Overlay_LIBRARY_DIRS})
|
||||
+ set(ogre_cflags ${ogre_cflags} ${OGRE_Overlay_CFLAGS})
|
||||
endif()
|
||||
|
||||
-
|
||||
set (OGRE_INCLUDE_DIRS ${ogre_include_dirs}
|
||||
CACHE INTERNAL "Ogre include path")
|
||||
|
||||
@@ -549,7 +542,7 @@ if (PKG_CONFIG_FOUND)
|
||||
endif ()
|
||||
|
||||
if (libavutil_FOUND AND libavformat_FOUND AND libavcodec_FOUND AND
|
||||
@ -29,7 +148,7 @@ index 4085b5aaeb..f89ac88333 100644
|
||||
set (HAVE_FFMPEG TRUE)
|
||||
else ()
|
||||
set (HAVE_FFMPEG FALSE)
|
||||
@@ -538,7 +538,7 @@ if (PKG_CONFIG_FOUND)
|
||||
@@ -574,7 +567,7 @@ if (PKG_CONFIG_FOUND)
|
||||
########################################
|
||||
# Find GNU Triangulation Surface Library
|
||||
pkg_check_modules(gts gts)
|
||||
@ -38,7 +157,7 @@ index 4085b5aaeb..f89ac88333 100644
|
||||
message (STATUS "Looking for GTS - found")
|
||||
set (HAVE_GTS TRUE)
|
||||
else ()
|
||||
@@ -551,13 +551,14 @@ if (PKG_CONFIG_FOUND)
|
||||
@@ -587,7 +580,7 @@ if (PKG_CONFIG_FOUND)
|
||||
# First and preferred option is to look for bullet standard pkgconfig,
|
||||
# so check it first. if it is not present, check for the OSRF
|
||||
# custom bullet2.82.pc file
|
||||
@ -47,14 +166,15 @@ index 4085b5aaeb..f89ac88333 100644
|
||||
if (NOT BULLET_FOUND)
|
||||
pkg_check_modules(BULLET bullet2.82>=2.82)
|
||||
endif()
|
||||
|
||||
@@ -596,6 +589,7 @@ if (PKG_CONFIG_FOUND)
|
||||
endif()
|
||||
if (BULLET_FOUND)
|
||||
set (HAVE_BULLET TRUE)
|
||||
+ set(BULLET_VERSION ${BULLET_VERSION_STRING})
|
||||
add_definitions( -DLIBBULLET_VERSION=${BULLET_VERSION} )
|
||||
else()
|
||||
set (HAVE_BULLET FALSE)
|
||||
@@ -572,7 +573,7 @@ if (PKG_CONFIG_FOUND)
|
||||
if (${BULLET_VERSION} STREQUAL "")
|
||||
set (BULLET_VERSION ${BULLET_VERSION_STRING})
|
||||
endif()
|
||||
@@ -614,7 +608,7 @@ if (PKG_CONFIG_FOUND)
|
||||
########################################
|
||||
# Find libusb
|
||||
pkg_check_modules(libusb-1.0 libusb-1.0)
|
||||
@ -63,7 +183,7 @@ index 4085b5aaeb..f89ac88333 100644
|
||||
BUILD_WARNING ("libusb-1.0 not found. USB peripherals support will be disabled.")
|
||||
set (HAVE_USB OFF CACHE BOOL "HAVE USB" FORCE)
|
||||
else()
|
||||
@@ -648,7 +649,7 @@ endif ()
|
||||
@@ -690,7 +684,7 @@ endif ()
|
||||
########################################
|
||||
# Find gdal
|
||||
include (FindGDAL)
|
||||
@ -72,7 +192,7 @@ index 4085b5aaeb..f89ac88333 100644
|
||||
message (STATUS "Looking for libgdal - not found")
|
||||
BUILD_WARNING ("GDAL not found, Digital elevation terrains support will be disabled.")
|
||||
set (HAVE_GDAL OFF CACHE BOOL "HAVE GDAL" FORCE)
|
||||
@@ -718,7 +719,7 @@ endif()
|
||||
@@ -774,7 +768,7 @@ endif()
|
||||
########################################
|
||||
# Find graphviz
|
||||
include (${gazebo_cmake_dir}/FindGraphviz.cmake)
|
||||
@ -82,10 +202,17 @@ index 4085b5aaeb..f89ac88333 100644
|
||||
BUILD_WARNING ("Graphviz not found, Model editor's schematic view will be disabled.")
|
||||
set (HAVE_GRAPHVIZ OFF CACHE BOOL "HAVE GRAPHVIZ" FORCE)
|
||||
diff --git a/cmake/gazebo-config.cmake.in b/cmake/gazebo-config.cmake.in
|
||||
index b57a90dd76..63ce97095e 100644
|
||||
index ac1de2c..05cdc02 100644
|
||||
--- a/cmake/gazebo-config.cmake.in
|
||||
+++ b/cmake/gazebo-config.cmake.in
|
||||
@@ -99,12 +99,13 @@ list(APPEND @PKG_NAME@_CFLAGS -I${GAZEBO_INSTALL_INCLUDE_DIR}/gazebo-@GAZEBO_MAJ
|
||||
@@ -1,3 +1,6 @@
|
||||
+include(CMakeFindDependencyMacro)
|
||||
+find_dependency(freeimage CONFIG)
|
||||
+
|
||||
if (@PKG_NAME@_CONFIG_INCLUDED)
|
||||
return()
|
||||
endif()
|
||||
@@ -99,12 +102,13 @@ list(APPEND @PKG_NAME@_CFLAGS -I${GAZEBO_INSTALL_INCLUDE_DIR}/gazebo-@GAZEBO_MAJ
|
||||
|
||||
if (GAZEBO_HAS_BULLET)
|
||||
if (PKG_CONFIG_FOUND)
|
||||
@ -100,3 +227,16 @@ index b57a90dd76..63ce97095e 100644
|
||||
add_definitions(-DLIBBULLET_VERSION=${BULLET_VERSION})
|
||||
else()
|
||||
message(FATAL_ERROR "Error: Bullet > 2.82 not found, please install libbullet2.82-dev.")
|
||||
diff --git a/gazebo/rendering/ogre_gazebo.h b/gazebo/rendering/ogre_gazebo.h
|
||||
index a171782..c390d14 100644
|
||||
--- a/gazebo/rendering/ogre_gazebo.h
|
||||
+++ b/gazebo/rendering/ogre_gazebo.h
|
||||
@@ -66,7 +66,7 @@
|
||||
#if OGRE_VERSION_MAJOR > 1 || OGRE_VERSION_MINOR >= 7
|
||||
#include <OGRE/RTShaderSystem/OgreRTShaderSystem.h>
|
||||
#include <OGRE/RTShaderSystem/OgreShaderProgramSet.h>
|
||||
-#include <OGRE/RTShaderSystem/OgreShaderGLSLProgramWriter.h>
|
||||
+#include <OGRE/RTShaderSystem/OgreShaderProgramWriter.h>
|
||||
#include <OGRE/RTShaderSystem/OgreShaderProgramWriterManager.h>
|
||||
#include <OGRE/RTShaderSystem/OgreShaderFunction.h>
|
||||
#include <OGRE/RTShaderSystem/OgreShaderProgram.h>
|
||||
|
@ -1,443 +0,0 @@
|
||||
diff --git a/cmake/SearchForStuff.cmake b/cmake/SearchForStuff.cmake
|
||||
index af56ee4..8583740 100644
|
||||
--- a/cmake/SearchForStuff.cmake
|
||||
+++ b/cmake/SearchForStuff.cmake
|
||||
@@ -301,7 +301,7 @@ if (PKG_CONFIG_FOUND)
|
||||
|
||||
#################################################
|
||||
# Find TBB
|
||||
- pkg_check_modules(TBB tbb<2021)
|
||||
+ pkg_check_modules(TBB tbb)
|
||||
set (TBB_PKG_CONFIG "tbb")
|
||||
if (NOT TBB_FOUND)
|
||||
message(STATUS "TBB not found, attempting to detect manually")
|
||||
@@ -325,6 +325,12 @@ if (PKG_CONFIG_FOUND)
|
||||
endif(tbb_library)
|
||||
endif (NOT TBB_FOUND)
|
||||
endif (NOT TBB_FOUND)
|
||||
+ set(HAVE_TBB_GREATER_OR_EQUAL_2021 OFF)
|
||||
+ if (DEFINED TBB_VERSION AND NOT ${TBB_VERSION} STREQUAL "")
|
||||
+ if (${TBB_VERSION} VERSION_GREATER_EQUAL "2021.0")
|
||||
+ set(HAVE_TBB_GREATER_OR_EQUAL_2021 ON)
|
||||
+ endif()
|
||||
+ endif()
|
||||
|
||||
#################################################
|
||||
# Find OGRE
|
||||
diff --git a/cmake/gazebo-config.cmake.in b/cmake/gazebo-config.cmake.in
|
||||
index 36bb341..6bb8e51 100644
|
||||
--- a/cmake/gazebo-config.cmake.in
|
||||
+++ b/cmake/gazebo-config.cmake.in
|
||||
@@ -223,3 +223,11 @@ list(APPEND @PKG_NAME@_LIBRARIES ${IGNITION-FUEL_TOOLS_LIBRARIES})
|
||||
list(APPEND @PKG_NAME@_LDFLAGS -Wl,-rpath,${GAZEBO_INSTALL_LIB_DIR}/gazebo-@GAZEBO_MAJOR_VERSION@/plugins)
|
||||
list(APPEND @PKG_NAME@_LDFLAGS -L${GAZEBO_INSTALL_LIB_DIR})
|
||||
list(APPEND @PKG_NAME@_LDFLAGS -L${GAZEBO_INSTALL_LIB_DIR}/gazebo-@GAZEBO_MAJOR_VERSION@/plugins)
|
||||
+
|
||||
+set (GAZEBO_HAS_TBB_GREATER_OR_EQUAL_2021 @HAVE_TBB_GREATER_OR_EQUAL_2021@)
|
||||
+if (GAZEBO_HAS_TBB_GREATER_OR_EQUAL_2021)
|
||||
+ find_package(TBB CONFIG)
|
||||
+ if (TARGET tbb::tbb)
|
||||
+ list(APPEND @PKG_NAME@_LIBRARIES TBB::tbb)
|
||||
+ endif ()
|
||||
+endif ()
|
||||
diff --git a/gazebo/transport/CMakeLists.txt b/gazebo/transport/CMakeLists.txt
|
||||
index 8e59020..a72d49b 100644
|
||||
--- a/gazebo/transport/CMakeLists.txt
|
||||
+++ b/gazebo/transport/CMakeLists.txt
|
||||
@@ -29,6 +29,7 @@ set (headers
|
||||
SubscribeOptions.hh
|
||||
Subscriber.hh
|
||||
SubscriptionTransport.hh
|
||||
+ TaskGroup.hh
|
||||
TopicManager.hh
|
||||
TransportIface.hh
|
||||
TransportTypes.hh
|
||||
@@ -70,6 +71,12 @@ if (WIN32)
|
||||
target_link_libraries(gazebo_transport ws2_32 Iphlpapi)
|
||||
endif()
|
||||
|
||||
+if(${CMAKE_VERSION} VERSION_LESS "3.13.0")
|
||||
+ link_directories(${TBB_LIBRARY_DIRS})
|
||||
+else()
|
||||
+ target_link_directories(gazebo_transport PUBLIC ${TBB_LIBRARY_DIRS})
|
||||
+endif()
|
||||
+
|
||||
if (USE_PCH)
|
||||
add_pch(gazebo_transport transport_pch.hh ${Boost_PKGCONFIG_CFLAGS} "-I${PROTOBUF_INCLUDE_DIR}" "-I${TBB_INCLUDEDIR}")
|
||||
endif()
|
||||
diff --git a/gazebo/transport/Connection.hh b/gazebo/transport/Connection.hh
|
||||
index 0e7d88a..cbcd7af 100644
|
||||
--- a/gazebo/transport/Connection.hh
|
||||
+++ b/gazebo/transport/Connection.hh
|
||||
@@ -17,7 +17,16 @@
|
||||
#ifndef _CONNECTION_HH_
|
||||
#define _CONNECTION_HH_
|
||||
|
||||
+#undef emit
|
||||
#include <tbb/task.h>
|
||||
+#define emit
|
||||
+
|
||||
+// If TBB_VERSION_MAJOR is not defined, this means that
|
||||
+// tbb >= 2021 and we can include the tbb/version.h header
|
||||
+#ifndef TBB_VERSION_MAJOR
|
||||
+#include <tbb/version.h>
|
||||
+#endif
|
||||
+
|
||||
#include <google/protobuf/message.h>
|
||||
|
||||
#include <boost/asio.hpp>
|
||||
@@ -37,6 +46,9 @@
|
||||
#include "gazebo/common/Console.hh"
|
||||
#include "gazebo/common/Exception.hh"
|
||||
#include "gazebo/common/WeakBind.hh"
|
||||
+#if TBB_VERSION_MAJOR >= 2021
|
||||
+#include "gazebo/transport/TaskGroup.hh"
|
||||
+#endif
|
||||
#include "gazebo/util/system.hh"
|
||||
|
||||
#define HEADER_LENGTH 8
|
||||
@@ -54,7 +66,11 @@ namespace gazebo
|
||||
/// \cond
|
||||
/// \brief A task instance that is created when data is read from
|
||||
/// a socket and used by TBB
|
||||
+#if TBB_VERSION_MAJOR < 2021
|
||||
class GZ_TRANSPORT_VISIBLE ConnectionReadTask : public tbb::task
|
||||
+#else
|
||||
+ class GZ_TRANSPORT_VISIBLE ConnectionReadTask
|
||||
+#endif
|
||||
{
|
||||
/// \brief Constructor
|
||||
/// \param[_in] _func Boost function pointer, which is the function
|
||||
@@ -68,6 +84,7 @@ namespace gazebo
|
||||
{
|
||||
}
|
||||
|
||||
+#if TBB_VERSION_MAJOR < 2021
|
||||
/// \bried Overridden function from tbb::task that exectues the data
|
||||
/// callback.
|
||||
public: tbb::task *execute()
|
||||
@@ -75,6 +92,11 @@ namespace gazebo
|
||||
this->func(this->data);
|
||||
return NULL;
|
||||
}
|
||||
+#else
|
||||
+ /// \brief Execute the data callback
|
||||
+ public: void operator()() const
|
||||
+ { this->func(this->data); }
|
||||
+#endif
|
||||
|
||||
/// \brief The boost function pointer
|
||||
private: boost::function<void (const std::string &)> func;
|
||||
@@ -310,12 +332,16 @@ namespace gazebo
|
||||
|
||||
if (!_e && !transport::is_stopped())
|
||||
{
|
||||
+#if TBB_VERSION_MAJOR < 2021
|
||||
ConnectionReadTask *task = new(tbb::task::allocate_root())
|
||||
ConnectionReadTask(boost::get<0>(_handler), data);
|
||||
tbb::task::enqueue(*task);
|
||||
|
||||
// Non-tbb version:
|
||||
// boost::get<0>(_handler)(data);
|
||||
+#else
|
||||
+ this->taskGroup.run<ConnectionReadTask>(boost::get<0>(_handler), data);
|
||||
+#endif
|
||||
}
|
||||
}
|
||||
|
||||
@@ -465,6 +491,11 @@ namespace gazebo
|
||||
|
||||
/// \brief True if the connection is open.
|
||||
private: bool isOpen;
|
||||
+
|
||||
+#if TBB_VERSION_MAJOR >= 2021
|
||||
+ /// \brief For managing asynchronous tasks with tbb
|
||||
+ private: TaskGroup taskGroup;
|
||||
+#endif
|
||||
};
|
||||
/// \}
|
||||
}
|
||||
diff --git a/gazebo/transport/ConnectionManager.cc b/gazebo/transport/ConnectionManager.cc
|
||||
index b0546e5..17016a4 100644
|
||||
--- a/gazebo/transport/ConnectionManager.cc
|
||||
+++ b/gazebo/transport/ConnectionManager.cc
|
||||
@@ -27,6 +27,7 @@
|
||||
using namespace gazebo;
|
||||
using namespace transport;
|
||||
|
||||
+#if TBB_VERSION_MAJOR < 2021
|
||||
/// TBB task to process nodes.
|
||||
class TopicManagerProcessTask : public tbb::task
|
||||
{
|
||||
@@ -37,20 +38,30 @@ class TopicManagerProcessTask : public tbb::task
|
||||
return NULL;
|
||||
}
|
||||
};
|
||||
+#endif
|
||||
|
||||
/// TBB task to establish subscriber to publisher connection.
|
||||
+#if TBB_VERSION_MAJOR < 2021
|
||||
class TopicManagerConnectionTask : public tbb::task
|
||||
+#else
|
||||
+class TopicManagerConnectionTask
|
||||
+#endif
|
||||
{
|
||||
/// \brief Constructor.
|
||||
/// \param[in] _pub Publish message
|
||||
public: explicit TopicManagerConnectionTask(msgs::Publish _pub) : pub(_pub) {}
|
||||
|
||||
/// Implements the necessary execute function
|
||||
+#if TBB_VERSION_MAJOR < 2021
|
||||
public: tbb::task *execute()
|
||||
{
|
||||
TopicManager::Instance()->ConnectSubToPub(pub);
|
||||
return NULL;
|
||||
}
|
||||
+#else
|
||||
+ public: void operator()() const
|
||||
+ { TopicManager::Instance()->ConnectSubToPub(pub); }
|
||||
+#endif
|
||||
|
||||
/// \brief Publish message
|
||||
private: msgs::Publish pub;
|
||||
@@ -273,11 +284,6 @@ void ConnectionManager::RunUpdate()
|
||||
if (this->masterConn)
|
||||
this->masterConn->ProcessWriteQueue();
|
||||
|
||||
- // Use TBB to process nodes. Need more testing to see if this makes
|
||||
- // a difference.
|
||||
- // TopicManagerProcessTask *task = new(tbb::task::allocate_root())
|
||||
- // TopicManagerProcessTask();
|
||||
- // tbb::task::enqueue(*task);
|
||||
boost::recursive_mutex::scoped_lock lock(this->connectionMutex);
|
||||
|
||||
TopicManager::Instance()->ProcessNodes();
|
||||
@@ -403,9 +409,13 @@ void ConnectionManager::ProcessMessage(const std::string &_data)
|
||||
if (pub.host() != this->serverConn->GetLocalAddress() ||
|
||||
pub.port() != this->serverConn->GetLocalPort())
|
||||
{
|
||||
+#if TBB_VERSION_MAJOR < 2021
|
||||
TopicManagerConnectionTask *task = new(tbb::task::allocate_root())
|
||||
TopicManagerConnectionTask(pub);
|
||||
tbb::task::enqueue(*task);
|
||||
+#else
|
||||
+ this->taskGroup.run<TopicManagerConnectionTask>(pub);
|
||||
+#endif
|
||||
}
|
||||
}
|
||||
// publisher_subscribe. This occurs when we try to subscribe to a topic, and
|
||||
diff --git a/gazebo/transport/ConnectionManager.hh b/gazebo/transport/ConnectionManager.hh
|
||||
index ef80eaf..6dc212b 100644
|
||||
--- a/gazebo/transport/ConnectionManager.hh
|
||||
+++ b/gazebo/transport/ConnectionManager.hh
|
||||
@@ -27,8 +27,11 @@
|
||||
#include "gazebo/msgs/msgs.hh"
|
||||
#include "gazebo/common/SingletonT.hh"
|
||||
|
||||
-#include "gazebo/transport/Publisher.hh"
|
||||
#include "gazebo/transport/Connection.hh"
|
||||
+#include "gazebo/transport/Publisher.hh"
|
||||
+#if TBB_VERSION_MAJOR >= 2021
|
||||
+#include "gazebo/transport/TaskGroup.hh"
|
||||
+#endif
|
||||
#include "gazebo/util/system.hh"
|
||||
|
||||
/// \brief Explicit instantiation for typed SingletonT.
|
||||
@@ -194,6 +197,11 @@ namespace gazebo
|
||||
/// \brief Condition used for synchronization
|
||||
private: boost::condition_variable namespaceCondition;
|
||||
|
||||
+#if TBB_VERSION_MAJOR >= 2021
|
||||
+ /// \brief For managing asynchronous tasks with tbb
|
||||
+ private: TaskGroup taskGroup;
|
||||
+#endif
|
||||
+
|
||||
// Singleton implementation
|
||||
private: friend class SingletonT<ConnectionManager>;
|
||||
};
|
||||
diff --git a/gazebo/transport/Node.hh b/gazebo/transport/Node.hh
|
||||
index b7d37f7..7248b72 100644
|
||||
--- a/gazebo/transport/Node.hh
|
||||
+++ b/gazebo/transport/Node.hh
|
||||
@@ -18,7 +18,12 @@
|
||||
#ifndef GAZEBO_TRANSPORT_NODE_HH_
|
||||
#define GAZEBO_TRANSPORT_NODE_HH_
|
||||
|
||||
+#undef emit
|
||||
#include <tbb/task.h>
|
||||
+#define emit
|
||||
+#ifndef TBB_VERSION_MAJOR
|
||||
+#include <tbb/version.h>
|
||||
+#endif
|
||||
#include <boost/bind/bind.hpp>
|
||||
#include <boost/enable_shared_from_this.hpp>
|
||||
#include <map>
|
||||
@@ -26,6 +31,9 @@
|
||||
#include <string>
|
||||
#include <vector>
|
||||
|
||||
+#if TBB_VERSION_MAJOR >= 2021
|
||||
+#include "gazebo/transport/TaskGroup.hh"
|
||||
+#endif
|
||||
#include "gazebo/transport/TransportTypes.hh"
|
||||
#include "gazebo/transport/TopicManager.hh"
|
||||
#include "gazebo/util/system.hh"
|
||||
@@ -36,7 +44,11 @@ namespace gazebo
|
||||
{
|
||||
/// \cond
|
||||
/// \brief Task used by Node::Publish to publish on a one-time publisher
|
||||
+#if TBB_VERSION_MAJOR < 2021
|
||||
class GZ_TRANSPORT_VISIBLE PublishTask : public tbb::task
|
||||
+#else
|
||||
+ class GZ_TRANSPORT_VISIBLE PublishTask
|
||||
+#endif
|
||||
{
|
||||
/// \brief Constructor
|
||||
/// \param[in] _pub Publisher to publish the message on.
|
||||
@@ -49,16 +61,23 @@ namespace gazebo
|
||||
this->msg->CopyFrom(_message);
|
||||
}
|
||||
|
||||
+#if TBB_VERSION_MAJOR < 2021
|
||||
/// \brief Overridden function from tbb::task that exectues the
|
||||
/// publish task.
|
||||
public: tbb::task *execute()
|
||||
+#else
|
||||
+ /// \brief Executes the publish task.
|
||||
+ public: void operator()() const
|
||||
+#endif
|
||||
{
|
||||
this->pub->WaitForConnection();
|
||||
this->pub->Publish(*this->msg, true);
|
||||
this->pub->SendMessage();
|
||||
delete this->msg;
|
||||
+#if TBB_VERSION_MAJOR < 2021
|
||||
this->pub.reset();
|
||||
return NULL;
|
||||
+#endif
|
||||
}
|
||||
|
||||
/// \brief Pointer to the publisher.
|
||||
@@ -159,11 +178,15 @@ namespace gazebo
|
||||
const google::protobuf::Message &_message)
|
||||
{
|
||||
transport::PublisherPtr pub = this->Advertise<M>(_topic);
|
||||
+#if TBB_VERSION_MAJOR < 2021
|
||||
PublishTask *task = new(tbb::task::allocate_root())
|
||||
PublishTask(pub, _message);
|
||||
|
||||
tbb::task::enqueue(*task);
|
||||
return;
|
||||
+#else
|
||||
+ this->taskGroup.run<PublishTask>(pub, _message);
|
||||
+#endif
|
||||
}
|
||||
|
||||
/// \brief Advertise a topic
|
||||
@@ -420,6 +443,10 @@ namespace gazebo
|
||||
|
||||
/// \brief List of newly arrive messages
|
||||
private: std::map<std::string, std::list<MessagePtr> > incomingMsgsLocal;
|
||||
+#if TBB_VERSION_MAJOR >= 2021
|
||||
+ /// \brief For managing asynchronous tasks with tbb
|
||||
+ private: TaskGroup taskGroup;
|
||||
+#endif
|
||||
|
||||
private: boost::mutex publisherMutex;
|
||||
private: boost::mutex publisherDeleteMutex;
|
||||
diff --git a/gazebo/transport/TaskGroup.hh b/gazebo/transport/TaskGroup.hh
|
||||
new file mode 100644
|
||||
index 0000000..b95b5d8
|
||||
--- /dev/null
|
||||
+++ b/gazebo/transport/TaskGroup.hh
|
||||
@@ -0,0 +1,47 @@
|
||||
+/*
|
||||
+ * Copyright (C) 2021 Open Source Robotics Foundation
|
||||
+ *
|
||||
+ * Licensed under the Apache License, Version 2.0 (the "License");
|
||||
+ * you may not use this file except in compliance with the License.
|
||||
+ * You may obtain a copy of the License at
|
||||
+ *
|
||||
+ * http://www.apache.org/licenses/LICENSE-2.0
|
||||
+ *
|
||||
+ * Unless required by applicable law or agreed to in writing, software
|
||||
+ * distributed under the License is distributed on an "AS IS" BASIS,
|
||||
+ * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
|
||||
+ * See the License for the specific language governing permissions and
|
||||
+ * limitations under the License.
|
||||
+ *
|
||||
+*/
|
||||
+#ifndef GAZEBO_TRANSPORT_TASKGROUP_HH_
|
||||
+#define GAZEBO_TRANSPORT_TASKGROUP_HH_
|
||||
+
|
||||
+#include <utility>
|
||||
+
|
||||
+// Emit is both a macro in Qt and a function defined by tbb
|
||||
+#undef emit
|
||||
+#include <tbb/tbb.h>
|
||||
+#define emit
|
||||
+
|
||||
+namespace gazebo {
|
||||
+ namespace transport {
|
||||
+ class TaskGroup
|
||||
+ {
|
||||
+ public: ~TaskGroup() noexcept
|
||||
+ {
|
||||
+ // Wait for running tasks to finish
|
||||
+ this->taskGroup.wait();
|
||||
+ }
|
||||
+
|
||||
+ public: template<class Functor, class... Args> void run(Args&&... args)
|
||||
+ {
|
||||
+ this->taskGroup.run(Functor(std::forward<Args>(args)...));
|
||||
+ }
|
||||
+
|
||||
+ private: tbb::task_group taskGroup;
|
||||
+ };
|
||||
+ }
|
||||
+}
|
||||
+
|
||||
+#endif
|
||||
diff --git a/gazebo/transport/transport_pch.hh b/gazebo/transport/transport_pch.hh
|
||||
index 0119d40..f288de2 100644
|
||||
--- a/gazebo/transport/transport_pch.hh
|
||||
+++ b/gazebo/transport/transport_pch.hh
|
||||
@@ -21,6 +21,7 @@
|
||||
* To get a starting list for this file, I use the command:
|
||||
* grep --include="*.hh" --include="*.cc" --no-filename -r "#include <" | sort -u
|
||||
*/
|
||||
+
|
||||
#include <boost/algorithm/string.hpp>
|
||||
#include <boost/asio.hpp>
|
||||
#include <boost/bind/bind.hpp>
|
||||
@@ -44,8 +45,18 @@
|
||||
#include <stdio.h>
|
||||
#include <stdlib.h>
|
||||
#include <string>
|
||||
+#include <tbb/task.h>
|
||||
+#ifndef TBB_VERSION_MAJOR
|
||||
+#include <tbb/version.h>
|
||||
+#endif
|
||||
+#if TBB_VERSION_MAJOR < 2021
|
||||
#include <tbb/blocked_range.h>
|
||||
#include <tbb/parallel_for.h>
|
||||
#include <tbb/task.h>
|
||||
+#else
|
||||
+#undef emit
|
||||
+#include <tbb/tbb.h>
|
||||
+#define emit
|
||||
+#endif
|
||||
#include <utility>
|
||||
#include <vector>
|
||||
diff --git a/tools/CMakeLists.txt b/tools/CMakeLists.txt
|
||||
index 5f2c112..6d09a11 100644
|
||||
--- a/tools/CMakeLists.txt
|
||||
+++ b/tools/CMakeLists.txt
|
||||
@@ -49,6 +49,7 @@ target_link_libraries(gz
|
||||
gazebo_gui
|
||||
gazebo_physics
|
||||
gazebo_sensors
|
||||
+ gazebo_transport
|
||||
${Qt5Core_LIBRARIES}
|
||||
${Qt5Widgets_LIBRARIES}
|
||||
${Boost_LIBRARIES}
|
@ -1,19 +1,11 @@
|
||||
vcpkg_download_distfile(gazebo3211
|
||||
URLS "https://patch-diff.githubusercontent.com/raw/osrf/gazebo/pull/3211.diff?full_index=1"
|
||||
FILENAME "gazebo3211.diff"
|
||||
SHA512 761e254866d4705acc0b81479285f979c436b3b611739a207a575031d8a8daba48de4fc0c8de5edb9a9f89725586c5caeef9e6e1e3d63a2d961ca09df974f7de
|
||||
)
|
||||
|
||||
vcpkg_from_github(
|
||||
OUT_SOURCE_PATH SOURCE_PATH
|
||||
REPO osrf/gazebo
|
||||
REF 382dcc3f36095a8d79b5bc9c8b8ad346e867c51d
|
||||
SHA512 57638cd0b23b5f2bfd32fdc159d6cd77ca34e3bd695c225591979aef4b7271eac93d3706fa1ffa2340f90013267a4171bebe1e4c142f19ad2bf67963dfed627e
|
||||
REPO gazebosim/gazebo-classic
|
||||
REF "gazebo11_${VERSION}"
|
||||
SHA512 0dede29618fc9d9a91d208a75b8ca1d3e6d3e8f4f60a80047b2d5806991f00f0bec46f6e2daca5931aed9c243f1e1d334e7a3eae9165b453cdedfb5b73b71186
|
||||
HEAD_REF gazebo11
|
||||
PATCHES
|
||||
0001-Fix-deps.patch
|
||||
"${gazebo3211}"
|
||||
fix-tbb.patch # Effectively https://github.com/osrf/gazebo/pull/3174 with merge conflict resolutions
|
||||
)
|
||||
|
||||
vcpkg_check_features(OUT_FEATURE_OPTIONS FEATURE_OPTIONS
|
||||
|
@ -1,7 +1,6 @@
|
||||
{
|
||||
"name": "gazebo",
|
||||
"version-date": "2022-01-20",
|
||||
"port-version": 5,
|
||||
"version": "11.15.1",
|
||||
"description": "Open source robotics simulator.",
|
||||
"homepage": "http://gazebosim.org",
|
||||
"license": "Apache-2.0",
|
||||
@ -36,6 +35,7 @@
|
||||
"host": true
|
||||
},
|
||||
"protobuf",
|
||||
"qt5",
|
||||
"qwt",
|
||||
"sdformat9",
|
||||
"tbb",
|
||||
|
@ -3029,8 +3029,8 @@
|
||||
"port-version": 0
|
||||
},
|
||||
"gazebo": {
|
||||
"baseline": "2022-01-20",
|
||||
"port-version": 5
|
||||
"baseline": "11.15.1",
|
||||
"port-version": 0
|
||||
},
|
||||
"gcem": {
|
||||
"baseline": "1.18.0",
|
||||
|
@ -1,5 +1,10 @@
|
||||
{
|
||||
"versions": [
|
||||
{
|
||||
"git-tree": "bf7b1a3b9eab1aa4a1ba0fc818a84dcc889d01cb",
|
||||
"version": "11.15.1",
|
||||
"port-version": 0
|
||||
},
|
||||
{
|
||||
"git-tree": "c5ff2241343daba9b2e89620fc5502104b459476",
|
||||
"version-date": "2022-01-20",
|
||||
|
Loading…
x
Reference in New Issue
Block a user