From 4719b870fef99a1817d4ffebe503dc6974718194 Mon Sep 17 00:00:00 2001 From: Jose Luis Rivero Date: Fri, 11 Dec 2020 18:25:16 +0100 Subject: [PATCH 01/22] Fix for Protobuf compiler Signed-off-by: Jose Luis Rivero --- CMakeLists.txt | 4 +++- 1 file changed, 3 insertions(+), 1 deletion(-) diff --git a/CMakeLists.txt b/CMakeLists.txt index 56e4189ced..0c64cd75ae 100644 --- a/CMakeLists.txt +++ b/CMakeLists.txt @@ -124,13 +124,15 @@ set(IGN_MATH_VER ${ignition-math6_VERSION_MAJOR}) #-------------------------------------- # Find protobuf +# Module is needed to use the PROTOBUF_GENERATE_CPP +set(protobuf_MODULE_COMPATIBLE TRUE) set(REQ_PROTOBUF_VER 3) ign_find_package(IgnProtobuf VERSION ${REQ_PROTOBUF_VER} REQUIRED COMPONENTS all PRETTY Protobuf) -set(PROTOBUF_IMPORT_DIRS ${ignition-msgs6_INCLUDE_DIRS}) +set(Protobuf_IMPORT_DIRS ${ignition-msgs6_INCLUDE_DIRS}) # Plugin install dirs set(IGNITION_GAZEBO_PLUGIN_INSTALL_DIR From b860682fe09e5d4d7118107f401f8620a631129a Mon Sep 17 00:00:00 2001 From: Jose Luis Rivero Date: Fri, 11 Dec 2020 18:25:28 +0100 Subject: [PATCH 02/22] No symlink on Windows Signed-off-by: Jose Luis Rivero --- src/systems/CMakeLists.txt | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/src/systems/CMakeLists.txt b/src/systems/CMakeLists.txt index 770bff4497..bc101920b7 100644 --- a/src/systems/CMakeLists.txt +++ b/src/systems/CMakeLists.txt @@ -66,7 +66,7 @@ function(gz_add_system system_name) # create_symlink requires cmake 3.13 on windows cmake_minimum_required(VERSION 3.13 FATAL_ERROR) endif() - EXECUTE_PROCESS(COMMAND ${CMAKE_COMMAND} -E create_symlink ${versioned} ${unversioned}) + install(FILES ${versioned} DESTINATION ${IGNITION_GAZEBO_PLUGIN_INSTALL_DIR} RENAME ${unversioned}) INSTALL(FILES ${PROJECT_BINARY_DIR}/${unversioned} DESTINATION ${IGNITION_GAZEBO_PLUGIN_INSTALL_DIR}) endfunction() From 25150a42e3e4263b50fb1d257ac012f978b4b041 Mon Sep 17 00:00:00 2001 From: Jose Luis Rivero Date: Fri, 11 Dec 2020 20:38:46 +0100 Subject: [PATCH 03/22] Add missing headers Signed-off-by: Jose Luis Rivero --- include/ignition/gazebo/EntityComponentManager.hh | 1 + include/ignition/gazebo/Server.hh | 1 + include/ignition/gazebo/World.hh | 1 + include/ignition/gazebo/detail/EntityComponentManager.hh | 1 + src/SdfGenerator.hh | 1 + src/ServerPrivate.hh | 1 + src/SimulationRunner.hh | 1 + src/systems/breadcrumbs/Breadcrumbs.hh | 1 + src/systems/multicopter_control/Common.hh | 1 + src/systems/velocity_control/VelocityControl.hh | 1 + test/integration/breadcrumbs.cc | 1 + test/integration/entity_erase.cc | 2 ++ test/integration/level_manager.cc | 1 + test/integration/level_manager_runtime_performers.cc | 1 + test/integration/multicopter.cc | 2 ++ 15 files changed, 17 insertions(+) diff --git a/include/ignition/gazebo/EntityComponentManager.hh b/include/ignition/gazebo/EntityComponentManager.hh index 2aefa6c54c..a12cf93485 100644 --- a/include/ignition/gazebo/EntityComponentManager.hh +++ b/include/ignition/gazebo/EntityComponentManager.hh @@ -22,6 +22,7 @@ #include #include +#include #include #include #include diff --git a/include/ignition/gazebo/Server.hh b/include/ignition/gazebo/Server.hh index 8387399ae3..ff8edae5b6 100644 --- a/include/ignition/gazebo/Server.hh +++ b/include/ignition/gazebo/Server.hh @@ -19,6 +19,7 @@ #include #include +#include #include #include #include diff --git a/include/ignition/gazebo/World.hh b/include/ignition/gazebo/World.hh index 1e902ef169..55d98ea54b 100644 --- a/include/ignition/gazebo/World.hh +++ b/include/ignition/gazebo/World.hh @@ -18,6 +18,7 @@ #define IGNITION_GAZEBO_WORLD_HH_ #include +#include #include #include diff --git a/include/ignition/gazebo/detail/EntityComponentManager.hh b/include/ignition/gazebo/detail/EntityComponentManager.hh index 0ea2777849..38bf67068d 100644 --- a/include/ignition/gazebo/detail/EntityComponentManager.hh +++ b/include/ignition/gazebo/detail/EntityComponentManager.hh @@ -19,6 +19,7 @@ #include #include +#include #include #include #include diff --git a/src/SdfGenerator.hh b/src/SdfGenerator.hh index cc278c59e0..54acff3241 100644 --- a/src/SdfGenerator.hh +++ b/src/SdfGenerator.hh @@ -20,6 +20,7 @@ #include #include +#include #include #include diff --git a/src/ServerPrivate.hh b/src/ServerPrivate.hh index c8980291c4..7aeae8a033 100644 --- a/src/ServerPrivate.hh +++ b/src/ServerPrivate.hh @@ -23,6 +23,7 @@ #include #include #include +#include #include #include #include diff --git a/src/SimulationRunner.hh b/src/SimulationRunner.hh index e7f4c0b15f..38afb117f7 100644 --- a/src/SimulationRunner.hh +++ b/src/SimulationRunner.hh @@ -26,6 +26,7 @@ #include #include #include +#include #include #include #include diff --git a/src/systems/breadcrumbs/Breadcrumbs.hh b/src/systems/breadcrumbs/Breadcrumbs.hh index bb34021344..7d748a39d6 100644 --- a/src/systems/breadcrumbs/Breadcrumbs.hh +++ b/src/systems/breadcrumbs/Breadcrumbs.hh @@ -17,6 +17,7 @@ #ifndef IGNITION_GAZEBO_SYSTEMS_BREADCRUMBS_HH_ #define IGNITION_GAZEBO_SYSTEMS_BREADCRUMBS_HH_ +#include #include #include #include diff --git a/src/systems/multicopter_control/Common.hh b/src/systems/multicopter_control/Common.hh index 4d3fdee009..d0e41f7689 100644 --- a/src/systems/multicopter_control/Common.hh +++ b/src/systems/multicopter_control/Common.hh @@ -19,6 +19,7 @@ #define IGNITION_GAZEBO_SYSTEMS_MULTICOPTERVELOCITYCONTROL_COMMON_HH_ #include +#include #include #include diff --git a/src/systems/velocity_control/VelocityControl.hh b/src/systems/velocity_control/VelocityControl.hh index a4427f22c2..f2428093dd 100644 --- a/src/systems/velocity_control/VelocityControl.hh +++ b/src/systems/velocity_control/VelocityControl.hh @@ -18,6 +18,7 @@ #define IGNITION_GAZEBO_SYSTEMS_VELOCITYCONTROL_HH_ #include +#include #include diff --git a/test/integration/breadcrumbs.cc b/test/integration/breadcrumbs.cc index 2644cde331..bdd9e4447d 100644 --- a/test/integration/breadcrumbs.cc +++ b/test/integration/breadcrumbs.cc @@ -20,6 +20,7 @@ #include #include +#include #include #include diff --git a/test/integration/entity_erase.cc b/test/integration/entity_erase.cc index 711a99897c..a0fc85d493 100644 --- a/test/integration/entity_erase.cc +++ b/test/integration/entity_erase.cc @@ -17,6 +17,8 @@ #include +#include + #include "ignition/gazebo/Server.hh" #include "ignition/gazebo/test_config.hh" // NOLINT(build/include) diff --git a/test/integration/level_manager.cc b/test/integration/level_manager.cc index be1ac4ebb6..e873c906be 100644 --- a/test/integration/level_manager.cc +++ b/test/integration/level_manager.cc @@ -18,6 +18,7 @@ #include +#include #include #include diff --git a/test/integration/level_manager_runtime_performers.cc b/test/integration/level_manager_runtime_performers.cc index 5abd564149..3486910a31 100644 --- a/test/integration/level_manager_runtime_performers.cc +++ b/test/integration/level_manager_runtime_performers.cc @@ -20,6 +20,7 @@ #include #include +#include #include #include diff --git a/test/integration/multicopter.cc b/test/integration/multicopter.cc index b1c1fd11d4..5ecede8df7 100644 --- a/test/integration/multicopter.cc +++ b/test/integration/multicopter.cc @@ -18,6 +18,8 @@ #include +#include + #include #include From d8f5da7de7d95a02997151c494ceb19fbd412a6c Mon Sep 17 00:00:00 2001 From: Jose Luis Rivero Date: Fri, 11 Dec 2020 20:44:57 +0100 Subject: [PATCH 04/22] Missing header for accumulate Signed-off-by: Jose Luis Rivero --- src/Server.cc | 2 ++ 1 file changed, 2 insertions(+) diff --git a/src/Server.cc b/src/Server.cc index 9fb9492de8..13734c3499 100644 --- a/src/Server.cc +++ b/src/Server.cc @@ -15,6 +15,8 @@ * */ +#include + #include #include #include From 3555c8f7dcffe802b08653883c9f8e70b343f0cf Mon Sep 17 00:00:00 2001 From: Jose Luis Rivero Date: Fri, 11 Dec 2020 20:57:16 +0100 Subject: [PATCH 05/22] Fix error with experimental on MSVC Signed-off-by: Jose Luis Rivero --- src/Util.cc | 10 +++++++++- 1 file changed, 9 insertions(+), 1 deletion(-) diff --git a/src/Util.cc b/src/Util.cc index 5b5995ae9e..0d14d494f7 100644 --- a/src/Util.cc +++ b/src/Util.cc @@ -16,12 +16,20 @@ */ #ifndef __APPLE__ - #if __GNUC__ < 8 + #if (defined(_MSVC_LANG)) + #if (_MSVC_LANG >= 201703L || __cplusplus >= 201703L) + #include //C++17 + #else + #define _SILENCE_EXPERIMENTAL_FILESYSTEM_DEPRECATION_WARNING + #include + #endif + #elif __GNUC__ < 8 #include #else #include #endif #endif + #include #include From a77513c769e8fa87cdde588c8f71b4fb830267a9 Mon Sep 17 00:00:00 2001 From: Jose Luis Rivero Date: Wed, 16 Dec 2020 16:05:21 +0100 Subject: [PATCH 06/22] Add missing visible macros Signed-off-by: Jose Luis Rivero --- src/LevelManager.hh | 2 +- src/systems/multicopter_control/LeeVelocityController.hh | 2 +- 2 files changed, 2 insertions(+), 2 deletions(-) diff --git a/src/LevelManager.hh b/src/LevelManager.hh index 5e51833ae8..556ad87d29 100644 --- a/src/LevelManager.hh +++ b/src/LevelManager.hh @@ -74,7 +74,7 @@ namespace ignition /// when the level is reloaded. Likewise, they should not be deleted. /// * Entities spawned during simulation are part of the default level. /// - class LevelManager + class IGNITION_GAZEBO_VISIBLE LevelManager { /// \brief Constructor /// \param[in] _runner A pointer to the simulationrunner that owns this diff --git a/src/systems/multicopter_control/LeeVelocityController.hh b/src/systems/multicopter_control/LeeVelocityController.hh index d0d48ea4b7..29c4e190fc 100644 --- a/src/systems/multicopter_control/LeeVelocityController.hh +++ b/src/systems/multicopter_control/LeeVelocityController.hh @@ -49,7 +49,7 @@ namespace multicopter_control /// https://github.com/ethz-asl/rotors_simulator/blob/master/rotors_control/include/rotors_control/lee_position_controller.h /// The controller can be used to command linear velocity and yaw angle /// velocity expressed in the body frame. - class LeeVelocityController + class IGNITION_GAZEBO_VISIBLE LeeVelocityController { /// \brief Factory function to create LeeVelocityController objects /// \param[in] _controllerParams Controller parameteres From caaa192dd082b512db453d3004b80443d02f75f1 Mon Sep 17 00:00:00 2001 From: Jose Luis Rivero Date: Wed, 16 Dec 2020 22:04:43 +0100 Subject: [PATCH 07/22] Fixes for Windows in CMake Signed-off-by: Jose Luis Rivero --- src/CMakeLists.txt | 11 ++++++++++- 1 file changed, 10 insertions(+), 1 deletion(-) diff --git a/src/CMakeLists.txt b/src/CMakeLists.txt index 1c029e2900..d83a5dcd56 100644 --- a/src/CMakeLists.txt +++ b/src/CMakeLists.txt @@ -85,6 +85,15 @@ set (gtest_sources network/NetworkManager_TEST.cc ) +if (MSVC) + # Warning #4251 is the "dll-interface" warning that tells you when types used + # by a class are not being exported. These generated source files have private + # members that don't get exported, so they trigger this warning. However, the + # warning is not important since those members do not need to be interfaced + # with. + set_source_files_properties(${sources} ${gtest_sources} COMPILE_FLAGS "/wd4251 /wd4146") +endif() + # Create the library target ign_create_core_library(SOURCES ${sources} CXX_STANDARD 17) target_link_libraries(${PROJECT_LIBRARY_TARGET_NAME} @@ -101,7 +110,7 @@ target_link_libraries(${PROJECT_LIBRARY_TARGET_NAME} PRIVATE ignition-plugin${IGN_PLUGIN_VER}::loader ) -if (NOT APPLE) +if (UNIX AND NOT APPLE) target_link_libraries(${PROJECT_LIBRARY_TARGET_NAME} PRIVATE stdc++fs) endif() From a66a2d0538dd76a333b031521da4c106e1737199 Mon Sep 17 00:00:00 2001 From: Jose Luis Rivero Date: Thu, 17 Dec 2020 20:51:04 +0100 Subject: [PATCH 08/22] Portable setenv/getenv Signed-off-by: Jose Luis Rivero --- src/Server_TEST.cc | 16 ++++++++-------- src/Util.cc | 15 ++++++++------- src/gui/Gui_TEST.cc | 11 ++++++----- 3 files changed, 22 insertions(+), 20 deletions(-) diff --git a/src/Server_TEST.cc b/src/Server_TEST.cc index a6ff94dbdc..23927ace55 100644 --- a/src/Server_TEST.cc +++ b/src/Server_TEST.cc @@ -48,7 +48,7 @@ class ServerFixture : public ::testing::TestWithParam protected: void SetUp() override { // Augment the system plugin path. In SetUp to avoid test order issues. - setenv("IGN_GAZEBO_SYSTEM_PLUGIN_PATH", + ignition::common::setenv("IGN_GAZEBO_SYSTEM_PLUGIN_PATH", (std::string(PROJECT_BINARY_PATH) + "/lib").c_str(), 1); ignition::common::Console::SetVerbosity(4); @@ -783,7 +783,7 @@ TEST_P(ServerFixture, Seed) ///////////////////////////////////////////////// TEST_P(ServerFixture, ResourcePath) { - setenv("IGN_GAZEBO_RESOURCE_PATH", + ignition::common::setenv("IGN_GAZEBO_RESOURCE_PATH", (std::string(PROJECT_SOURCE_PATH) + "/test/worlds:" + std::string(PROJECT_SOURCE_PATH) + "/test/worlds/models").c_str(), 1); @@ -871,7 +871,7 @@ TEST_P(ServerFixture, ResourcePath) ///////////////////////////////////////////////// TEST_P(ServerFixture, GetResourcePaths) { - setenv("IGN_GAZEBO_RESOURCE_PATH", + ignition::common::setenv("IGN_GAZEBO_RESOURCE_PATH", "/tmp/some/path:/home/user/another_path", 1); ServerConfig serverConfig; @@ -903,7 +903,7 @@ TEST_P(ServerFixture, CachedFuelWorld) { auto cachedWorldPath = common::joinPaths(std::string(PROJECT_SOURCE_PATH), "test", "worlds"); - setenv("IGN_FUEL_CACHE_PATH", cachedWorldPath.c_str(), 1); + ignition::common::setenv("IGN_FUEL_CACHE_PATH", cachedWorldPath.c_str(), 1); ServerConfig serverConfig; auto fuelWorldURL = @@ -927,10 +927,10 @@ TEST_P(ServerFixture, CachedFuelWorld) ///////////////////////////////////////////////// TEST_P(ServerFixture, AddResourcePaths) { - setenv("IGN_GAZEBO_RESOURCE_PATH", + ignition::common::setenv("IGN_GAZEBO_RESOURCE_PATH", "/tmp/some/path:/home/user/another_path", 1); - setenv("SDF_PATH", "", 1); - setenv("IGN_FILE_PATH", "", 1); + ignition::common::setenv("SDF_PATH", "", 1); + ignition::common::setenv("IGN_FILE_PATH", "", 1); ServerConfig serverConfig; gazebo::Server server(serverConfig); @@ -974,7 +974,7 @@ TEST_P(ServerFixture, AddResourcePaths) // Check environment variables for (auto env : {"IGN_GAZEBO_RESOURCE_PATH", "SDF_PATH", "IGN_FILE_PATH"}) { - char *pathCStr = getenv(env); + char *pathCStr = std::getenv(env); auto paths = common::Split(pathCStr, ':'); paths.erase(std::remove_if(paths.begin(), paths.end(), diff --git a/src/Util.cc b/src/Util.cc index 0d14d494f7..687e05d49f 100644 --- a/src/Util.cc +++ b/src/Util.cc @@ -32,6 +32,7 @@ #include #include +#include #include "ignition/gazebo/components/Actor.hh" #include "ignition/gazebo/components/Collision.hh" @@ -311,7 +312,7 @@ std::string asFullPath(const std::string &_uri, const std::string &_filePath) std::vector resourcePaths() { std::vector gzPaths; - char *gzPathCStr = getenv(kResourcePathEnv.c_str()); + char *gzPathCStr = std::getenv(kResourcePathEnv.c_str()); if (gzPathCStr && *gzPathCStr != '\0') { gzPaths = common::Split(gzPathCStr, ':'); @@ -331,7 +332,7 @@ void addResourcePaths(const std::vector &_paths) { // SDF paths (for s) std::vector sdfPaths; - char *sdfPathCStr = getenv(kSdfPathEnv.c_str()); + char *sdfPathCStr = std::getenv(kSdfPathEnv.c_str()); if (sdfPathCStr && *sdfPathCStr != '\0') { sdfPaths = common::Split(sdfPathCStr, ':'); @@ -340,7 +341,7 @@ void addResourcePaths(const std::vector &_paths) // Ignition file paths (for s) auto systemPaths = common::systemPaths(); std::vector ignPaths; - char *ignPathCStr = getenv(systemPaths->FilePathEnv().c_str()); + char *ignPathCStr = std::getenv(systemPaths->FilePathEnv().c_str()); if (ignPathCStr && *ignPathCStr != '\0') { ignPaths = common::Split(ignPathCStr, ':'); @@ -348,7 +349,7 @@ void addResourcePaths(const std::vector &_paths) // Gazebo resource paths std::vector gzPaths; - char *gzPathCStr = getenv(kResourcePathEnv.c_str()); + char *gzPathCStr = std::getenv(kResourcePathEnv.c_str()); if (gzPathCStr && *gzPathCStr != '\0') { gzPaths = common::Split(gzPathCStr, ':'); @@ -382,19 +383,19 @@ void addResourcePaths(const std::vector &_paths) for (const auto &path : sdfPaths) sdfPathsStr += ':' + path; - setenv(kSdfPathEnv.c_str(), sdfPathsStr.c_str(), 1); + ignition::common::setenv(kSdfPathEnv.c_str(), sdfPathsStr.c_str(), 1); std::string ignPathsStr; for (const auto &path : ignPaths) ignPathsStr += ':' + path; - setenv(systemPaths->FilePathEnv().c_str(), ignPathsStr.c_str(), 1); + ignition::common::setenv(systemPaths->FilePathEnv().c_str(), ignPathsStr.c_str(), 1); std::string gzPathsStr; for (const auto &path : gzPaths) gzPathsStr += ':' + path; - setenv(kResourcePathEnv.c_str(), gzPathsStr.c_str(), 1); + ignition::common::setenv(kResourcePathEnv.c_str(), gzPathsStr.c_str(), 1); // Force re-evaluation // SDF is evaluated at find call diff --git a/src/gui/Gui_TEST.cc b/src/gui/Gui_TEST.cc index 05245005e2..02664149f3 100644 --- a/src/gui/Gui_TEST.cc +++ b/src/gui/Gui_TEST.cc @@ -21,6 +21,7 @@ #include #include +#include #include #include @@ -40,10 +41,10 @@ TEST(GuiTest, IGN_UTILS_TEST_DISABLED_ON_MAC(PathManager)) common::Console::SetVerbosity(4); igndbg << "Start test" << std::endl; - setenv("IGN_GAZEBO_RESOURCE_PATH", + ignition::common::setenv("IGN_GAZEBO_RESOURCE_PATH", "/from_env:/tmp/more_env", 1); - setenv("SDF_PATH", "", 1); - setenv("IGN_FILE_PATH", "", 1); + ignition::common::setenv("SDF_PATH", "", 1); + ignition::common::setenv("IGN_FILE_PATH", "", 1); igndbg << "Environment set" << std::endl; transport::Node node; @@ -95,7 +96,7 @@ TEST(GuiTest, IGN_UTILS_TEST_DISABLED_ON_MAC(PathManager)) for (auto env : {"IGN_GAZEBO_RESOURCE_PATH", "SDF_PATH", "IGN_FILE_PATH"}) { igndbg << "Checking variable [" << env << "]" << std::endl; - char *pathCStr = getenv(env); + char *pathCStr = std::getenv(env); auto paths = common::Split(pathCStr, ':'); paths.erase(std::remove_if(paths.begin(), paths.end(), @@ -141,7 +142,7 @@ TEST(GuiTest, IGN_UTILS_TEST_DISABLED_ON_MAC(PathManager)) for (auto env : {"IGN_GAZEBO_RESOURCE_PATH", "SDF_PATH", "IGN_FILE_PATH"}) { igndbg << "Checking variable [" << env << "]" << std::endl; - char *pathCStr = getenv(env); + char *pathCStr = std::getenv(env); auto paths = common::Split(pathCStr, ':'); paths.erase(std::remove_if(paths.begin(), paths.end(), From c0a291b8ba94f40ae8382725d11d4f22a8935b9d Mon Sep 17 00:00:00 2001 From: Jose Luis Rivero Date: Thu, 17 Dec 2020 20:57:46 +0100 Subject: [PATCH 09/22] Fix API for setenv Signed-off-by: Jose Luis Rivero --- src/Server_TEST.cc | 14 +++++++------- src/SimulationRunner_TEST.cc | 5 +++-- src/Util.cc | 6 +++--- src/gui/Gui_TEST.cc | 6 +++--- src/ign_TEST.cc | 5 +++-- src/network/PeerTracker_TEST.cc | 11 ++++++----- 6 files changed, 25 insertions(+), 22 deletions(-) diff --git a/src/Server_TEST.cc b/src/Server_TEST.cc index 23927ace55..784089b9b3 100644 --- a/src/Server_TEST.cc +++ b/src/Server_TEST.cc @@ -49,7 +49,7 @@ class ServerFixture : public ::testing::TestWithParam { // Augment the system plugin path. In SetUp to avoid test order issues. ignition::common::setenv("IGN_GAZEBO_SYSTEM_PLUGIN_PATH", - (std::string(PROJECT_BINARY_PATH) + "/lib").c_str(), 1); + (std::string(PROJECT_BINARY_PATH) + "/lib").c_str()); ignition::common::Console::SetVerbosity(4); } @@ -785,7 +785,7 @@ TEST_P(ServerFixture, ResourcePath) { ignition::common::setenv("IGN_GAZEBO_RESOURCE_PATH", (std::string(PROJECT_SOURCE_PATH) + "/test/worlds:" + - std::string(PROJECT_SOURCE_PATH) + "/test/worlds/models").c_str(), 1); + std::string(PROJECT_SOURCE_PATH) + "/test/worlds/models").c_str()); ServerConfig serverConfig; serverConfig.SetSdfFile("resource_paths.sdf"); @@ -872,7 +872,7 @@ TEST_P(ServerFixture, ResourcePath) TEST_P(ServerFixture, GetResourcePaths) { ignition::common::setenv("IGN_GAZEBO_RESOURCE_PATH", - "/tmp/some/path:/home/user/another_path", 1); + "/tmp/some/path:/home/user/another_path"); ServerConfig serverConfig; gazebo::Server server(serverConfig); @@ -903,7 +903,7 @@ TEST_P(ServerFixture, CachedFuelWorld) { auto cachedWorldPath = common::joinPaths(std::string(PROJECT_SOURCE_PATH), "test", "worlds"); - ignition::common::setenv("IGN_FUEL_CACHE_PATH", cachedWorldPath.c_str(), 1); + ignition::common::setenv("IGN_FUEL_CACHE_PATH", cachedWorldPath.c_str()); ServerConfig serverConfig; auto fuelWorldURL = @@ -928,9 +928,9 @@ TEST_P(ServerFixture, CachedFuelWorld) TEST_P(ServerFixture, AddResourcePaths) { ignition::common::setenv("IGN_GAZEBO_RESOURCE_PATH", - "/tmp/some/path:/home/user/another_path", 1); - ignition::common::setenv("SDF_PATH", "", 1); - ignition::common::setenv("IGN_FILE_PATH", "", 1); + "/tmp/some/path:/home/user/another_path"); + ignition::common::setenv("SDF_PATH", ""); + ignition::common::setenv("IGN_FILE_PATH", ""); ServerConfig serverConfig; gazebo::Server server(serverConfig); diff --git a/src/SimulationRunner_TEST.cc b/src/SimulationRunner_TEST.cc index 317d00aa9e..09078037a4 100644 --- a/src/SimulationRunner_TEST.cc +++ b/src/SimulationRunner_TEST.cc @@ -17,6 +17,7 @@ #include #include +#include #include #include #include @@ -81,8 +82,8 @@ class SimulationRunnerTest : public ::testing::TestWithParam { common::Console::SetVerbosity(4); - setenv("IGN_GAZEBO_SYSTEM_PLUGIN_PATH", - (std::string(PROJECT_BINARY_PATH) + "/lib").c_str(), 1); + ignition::common::setenv("IGN_GAZEBO_SYSTEM_PLUGIN_PATH", + (std::string(PROJECT_BINARY_PATH) + "/lib").c_str()); } }; diff --git a/src/Util.cc b/src/Util.cc index 687e05d49f..8cfe27d54a 100644 --- a/src/Util.cc +++ b/src/Util.cc @@ -383,19 +383,19 @@ void addResourcePaths(const std::vector &_paths) for (const auto &path : sdfPaths) sdfPathsStr += ':' + path; - ignition::common::setenv(kSdfPathEnv.c_str(), sdfPathsStr.c_str(), 1); + ignition::common::setenv(kSdfPathEnv.c_str(), sdfPathsStr.c_str()); std::string ignPathsStr; for (const auto &path : ignPaths) ignPathsStr += ':' + path; - ignition::common::setenv(systemPaths->FilePathEnv().c_str(), ignPathsStr.c_str(), 1); + ignition::common::setenv(systemPaths->FilePathEnv().c_str(), ignPathsStr.c_str()); std::string gzPathsStr; for (const auto &path : gzPaths) gzPathsStr += ':' + path; - ignition::common::setenv(kResourcePathEnv.c_str(), gzPathsStr.c_str(), 1); + ignition::common::setenv(kResourcePathEnv.c_str(), gzPathsStr.c_str()); // Force re-evaluation // SDF is evaluated at find call diff --git a/src/gui/Gui_TEST.cc b/src/gui/Gui_TEST.cc index 02664149f3..7c61a211dc 100644 --- a/src/gui/Gui_TEST.cc +++ b/src/gui/Gui_TEST.cc @@ -42,9 +42,9 @@ TEST(GuiTest, IGN_UTILS_TEST_DISABLED_ON_MAC(PathManager)) igndbg << "Start test" << std::endl; ignition::common::setenv("IGN_GAZEBO_RESOURCE_PATH", - "/from_env:/tmp/more_env", 1); - ignition::common::setenv("SDF_PATH", "", 1); - ignition::common::setenv("IGN_FILE_PATH", "", 1); + "/from_env:/tmp/more_env"); + ignition::common::setenv("SDF_PATH", ""); + ignition::common::setenv("IGN_FILE_PATH", ""); igndbg << "Environment set" << std::endl; transport::Node node; diff --git a/src/ign_TEST.cc b/src/ign_TEST.cc index c5d0fcdc7f..0acdb5d496 100644 --- a/src/ign_TEST.cc +++ b/src/ign_TEST.cc @@ -20,6 +20,7 @@ #include #include +#include #include #include "ignition/gazebo/test_config.hh" // NOLINT(build/include) @@ -94,7 +95,7 @@ TEST(CmdLine, Server) TEST(CmdLine, IGN_UTILS_TEST_DISABLED_ON_MAC(CachedFuelWorld)) { std::string projectPath = std::string(PROJECT_SOURCE_PATH) + "/test/worlds"; - setenv("IGN_FUEL_CACHE_PATH", projectPath.c_str(), true); + ignition::common::setenv("IGN_FUEL_CACHE_PATH", projectPath.c_str()); std::string cmd = kIgnCommand + " -r -v 4 --iterations 5" + " https://fuel.ignitionrobotics.org/1.0/OpenRobotics/worlds/Test%20world"; std::cout << "Running command [" << cmd << "]" << std::endl; @@ -172,7 +173,7 @@ int main(int _argc, char **_argv) { // Set IGN_CONFIG_PATH to the directory where the .yaml configuration files // is located. - setenv("IGN_CONFIG_PATH", IGN_CONFIG_PATH, 1); + ignition::common::setenv("IGN_CONFIG_PATH", IGN_CONFIG_PATH); ::testing::InitGoogleTest(&_argc, _argv); return RUN_ALL_TESTS(); diff --git a/src/network/PeerTracker_TEST.cc b/src/network/PeerTracker_TEST.cc index 05b3bc02c1..3721a968da 100644 --- a/src/network/PeerTracker_TEST.cc +++ b/src/network/PeerTracker_TEST.cc @@ -19,6 +19,7 @@ #include #include +#include #include "PeerTracker.hh" #include "ignition/gazebo/EventManager.hh" @@ -267,11 +268,11 @@ TEST(PeerTracker, PartitionedEnv) ignition::common::Console::SetVerbosity(4); EventManager eventMgr; - setenv("IGN_PARTITION", "p1", 1); + ignition::common::setenv("IGN_PARTITION", "p1"); auto tracker1 = PeerTracker( PeerInfo(NetworkRole::SimulationPrimary), &eventMgr); - setenv("IGN_PARTITION", "p2", 1); + igniton::common:setenv("IGN_PARTITION", "p2"); auto tracker2 = PeerTracker( PeerInfo(NetworkRole::SimulationPrimary), &eventMgr); @@ -282,11 +283,11 @@ TEST(PeerTracker, PartitionedEnv) EXPECT_EQ(0u, tracker1.NumPeers()); EXPECT_EQ(0u, tracker2.NumPeers()); - setenv("IGN_PARTITION", "p1", 1); + igniton::common:setenv("IGN_PARTITION", "p1"); auto tracker3 = PeerTracker( PeerInfo(NetworkRole::SimulationSecondary), &eventMgr); - setenv("IGN_PARTITION", "p2", 1); + igniton::common:setenv("IGN_PARTITION", "p2"); auto tracker4 = PeerTracker( PeerInfo(NetworkRole::SimulationSecondary), &eventMgr); @@ -300,6 +301,6 @@ TEST(PeerTracker, PartitionedEnv) EXPECT_EQ(1u, tracker3.NumPeers()); EXPECT_EQ(1u, tracker4.NumPeers()); - unsetenv("IGN_PARTITION"); + igniton::common:unsetenv("IGN_PARTITION"); } #endif From 9a2b0716269b2a478be8f6014ba63f99f3796bbe Mon Sep 17 00:00:00 2001 From: Jose Luis Rivero Date: Thu, 17 Dec 2020 21:59:59 +0100 Subject: [PATCH 10/22] Protobuf requires no visibility keywords Signed-off-by: Jose Luis Rivero --- include/ignition/gazebo/EventManager.hh | 2 +- include/ignition/gazebo/gui/GuiRunner.hh | 2 +- include/ignition/gazebo/gui/GuiSystem.hh | 2 +- include/ignition/gazebo/gui/TmpIface.hh | 2 +- src/gui/GuiFileHandler.hh | 2 +- src/gui/PathManager.hh | 2 +- 6 files changed, 6 insertions(+), 6 deletions(-) diff --git a/include/ignition/gazebo/EventManager.hh b/include/ignition/gazebo/EventManager.hh index 7d466c5b09..128960fd95 100644 --- a/include/ignition/gazebo/EventManager.hh +++ b/include/ignition/gazebo/EventManager.hh @@ -47,7 +47,7 @@ namespace ignition /// occur. /// /// See \ref ignition::gazebo::events for a complete list of events. - class IGNITION_GAZEBO_VISIBLE EventManager + class EventManager { /// \brief Constructor public: EventManager(); diff --git a/include/ignition/gazebo/gui/GuiRunner.hh b/include/ignition/gazebo/gui/GuiRunner.hh index 564ac183f0..08bfbee366 100644 --- a/include/ignition/gazebo/gui/GuiRunner.hh +++ b/include/ignition/gazebo/gui/GuiRunner.hh @@ -35,7 +35,7 @@ namespace gazebo inline namespace IGNITION_GAZEBO_VERSION_NAMESPACE { /// \brief Responsible for running GUI systems as new states are received from /// the backend. -class IGNITION_GAZEBO_VISIBLE GuiRunner : public QObject +class GuiRunner : public QObject { Q_OBJECT diff --git a/include/ignition/gazebo/gui/GuiSystem.hh b/include/ignition/gazebo/gui/GuiSystem.hh index c031101042..16ecdd1e09 100644 --- a/include/ignition/gazebo/gui/GuiSystem.hh +++ b/include/ignition/gazebo/gui/GuiSystem.hh @@ -41,7 +41,7 @@ namespace gazebo /// GUI systems are different from `ignition::gazebo::System`s because they /// don't run in the same process as the physics. Instead, they run in a /// separate process that is stepped by updates coming through the network - class IGNITION_GAZEBO_VISIBLE GuiSystem : public ignition::gui::Plugin + class GuiSystem : public ignition::gui::Plugin { Q_OBJECT diff --git a/include/ignition/gazebo/gui/TmpIface.hh b/include/ignition/gazebo/gui/TmpIface.hh index 8d339a887d..079b2946a5 100644 --- a/include/ignition/gazebo/gui/TmpIface.hh +++ b/include/ignition/gazebo/gui/TmpIface.hh @@ -36,7 +36,7 @@ namespace ignition /// Move API from here to their appropriate locations once that's known. /// /// This class should be removed before releasing! - class IGNITION_GAZEBO_VISIBLE TmpIface : public QObject + class TmpIface : public QObject { Q_OBJECT diff --git a/src/gui/GuiFileHandler.hh b/src/gui/GuiFileHandler.hh index 017a575346..981b9fb769 100644 --- a/src/gui/GuiFileHandler.hh +++ b/src/gui/GuiFileHandler.hh @@ -36,7 +36,7 @@ inline namespace IGNITION_GAZEBO_VERSION_NAMESPACE { namespace gui { /// \brief Class for handling saving and loading of SDFormat files -class IGNITION_GAZEBO_VISIBLE GuiFileHandler : public QObject +class GuiFileHandler : public QObject { Q_OBJECT diff --git a/src/gui/PathManager.hh b/src/gui/PathManager.hh index 2247916a60..341e382cf2 100644 --- a/src/gui/PathManager.hh +++ b/src/gui/PathManager.hh @@ -35,7 +35,7 @@ namespace gui /// \brief Class for handling paths and their environment variables. /// It queries the server for paths at startup, and keeps paths updated /// whenever they change in the server. -class IGNITION_GAZEBO_VISIBLE PathManager : public QObject +class PathManager : public QObject { Q_OBJECT From 3a48576e476550b77f19dadfa06d92d9d53ef2e0 Mon Sep 17 00:00:00 2001 From: Jose Luis Rivero Date: Thu, 17 Dec 2020 22:01:20 +0100 Subject: [PATCH 11/22] Fix use of filesystem on Windows Signed-off-by: Jose Luis Rivero --- src/Util.cc | 8 +++++++- 1 file changed, 7 insertions(+), 1 deletion(-) diff --git a/src/Util.cc b/src/Util.cc index 8cfe27d54a..05595af83e 100644 --- a/src/Util.cc +++ b/src/Util.cc @@ -266,7 +266,13 @@ std::string asFullPath(const std::string &_uri, const std::string &_filePath) } #else // Not a relative path, return unmodified - #if __GNUC__ < 8 + #if (defined(_MSVC_LANG)) + #if (_MSVC_LANG >= 201703L || __cplusplus >= 201703L) + using namespace std::filesystem; + #else + using namespace std::experimental::filesystem; + #endif + #elif __GNUC__ < 8 using namespace std::experimental::filesystem; #else using namespace std::filesystem; From d6e88fae697ec800f58683adb5ad0675bf351211 Mon Sep 17 00:00:00 2001 From: Jose Luis Rivero Date: Thu, 17 Dec 2020 22:05:05 +0100 Subject: [PATCH 12/22] Workaround for getMessage Windows call Signed-off-by: Jose Luis Rivero --- src/systems/triggered_publisher/TriggeredPublisher.cc | 6 ++++++ 1 file changed, 6 insertions(+) diff --git a/src/systems/triggered_publisher/TriggeredPublisher.cc b/src/systems/triggered_publisher/TriggeredPublisher.cc index ddbcb58de7..316177f2d4 100644 --- a/src/systems/triggered_publisher/TriggeredPublisher.cc +++ b/src/systems/triggered_publisher/TriggeredPublisher.cc @@ -17,6 +17,7 @@ #include "TriggeredPublisher.hh" +#include #include #include @@ -27,6 +28,11 @@ #include #include +// bug https://github.com/protocolbuffers/protobuf/issues/5051 +#ifdef _WIN32 +#undef GetMessage +#endif + using namespace ignition; using namespace gazebo; using namespace systems; From 591980e1b7c9317cc2736a998885773325252da1 Mon Sep 17 00:00:00 2001 From: Jose Luis Rivero Date: Fri, 18 Dec 2020 16:12:02 +0100 Subject: [PATCH 13/22] Include codecheck fixes Signed-off-by: Jose Luis Rivero --- src/Util.cc | 5 +++-- src/gui/plugins/align_tool/AlignTool.cc | 6 ++++++ src/gui/plugins/resource_spawner/ResourceSpawner.hh | 1 + src/gui/plugins/visualize_lidar/VisualizeLidar.cc | 1 + src/systems/buoyancy/Buoyancy.cc | 2 ++ src/systems/camera_video_recorder/CameraVideoRecorder.cc | 1 + src/systems/diff_drive/DiffDrive.cc | 1 + src/systems/follow_actor/FollowActor.cc | 2 ++ src/systems/sensors/Sensors.cc | 1 + src/systems/velocity_control/VelocityControl.cc | 1 + 10 files changed, 19 insertions(+), 2 deletions(-) diff --git a/src/Util.cc b/src/Util.cc index 05595af83e..8c87122d7a 100644 --- a/src/Util.cc +++ b/src/Util.cc @@ -18,7 +18,7 @@ #ifndef __APPLE__ #if (defined(_MSVC_LANG)) #if (_MSVC_LANG >= 201703L || __cplusplus >= 201703L) - #include //C++17 + #include //C++17 #else #define _SILENCE_EXPERIMENTAL_FILESYSTEM_DEPRECATION_WARNING #include @@ -395,7 +395,8 @@ void addResourcePaths(const std::vector &_paths) for (const auto &path : ignPaths) ignPathsStr += ':' + path; - ignition::common::setenv(systemPaths->FilePathEnv().c_str(), ignPathsStr.c_str()); + ignition::common::setenv(systemPaths->FilePathEnv().c_str(), + ignPathsStr.c_str()); std::string gzPathsStr; for (const auto &path : gzPaths) diff --git a/src/gui/plugins/align_tool/AlignTool.cc b/src/gui/plugins/align_tool/AlignTool.cc index 20c56f0cb5..5404327f4c 100644 --- a/src/gui/plugins/align_tool/AlignTool.cc +++ b/src/gui/plugins/align_tool/AlignTool.cc @@ -18,7 +18,13 @@ #include #include +#include +#include #include +#include +#include +#include + #include #include #include diff --git a/src/gui/plugins/resource_spawner/ResourceSpawner.hh b/src/gui/plugins/resource_spawner/ResourceSpawner.hh index e2fa9478c8..02a13cc766 100644 --- a/src/gui/plugins/resource_spawner/ResourceSpawner.hh +++ b/src/gui/plugins/resource_spawner/ResourceSpawner.hh @@ -18,6 +18,7 @@ #ifndef IGNITION_GAZEBO_GUI_RESOURCE_SPAWNER_HH_ #define IGNITION_GAZEBO_GUI_RESOURCE_SPAWNER_HH_ +#include #include #include #include diff --git a/src/gui/plugins/visualize_lidar/VisualizeLidar.cc b/src/gui/plugins/visualize_lidar/VisualizeLidar.cc index 52668dc0f0..a62d12608b 100644 --- a/src/gui/plugins/visualize_lidar/VisualizeLidar.cc +++ b/src/gui/plugins/visualize_lidar/VisualizeLidar.cc @@ -16,6 +16,7 @@ */ #include +#include #include #include diff --git a/src/systems/buoyancy/Buoyancy.cc b/src/systems/buoyancy/Buoyancy.cc index f3489f6f56..81a880a21a 100644 --- a/src/systems/buoyancy/Buoyancy.cc +++ b/src/systems/buoyancy/Buoyancy.cc @@ -17,6 +17,8 @@ #include #include +#include +#include #include #include diff --git a/src/systems/camera_video_recorder/CameraVideoRecorder.cc b/src/systems/camera_video_recorder/CameraVideoRecorder.cc index 70aed6c885..52c24ad0f9 100644 --- a/src/systems/camera_video_recorder/CameraVideoRecorder.cc +++ b/src/systems/camera_video_recorder/CameraVideoRecorder.cc @@ -17,6 +17,7 @@ #include #include +#include #include #include diff --git a/src/systems/diff_drive/DiffDrive.cc b/src/systems/diff_drive/DiffDrive.cc index c8101552f2..dfd78b7769 100644 --- a/src/systems/diff_drive/DiffDrive.cc +++ b/src/systems/diff_drive/DiffDrive.cc @@ -21,6 +21,7 @@ #include #include +#include #include #include diff --git a/src/systems/follow_actor/FollowActor.cc b/src/systems/follow_actor/FollowActor.cc index 32d51ef60a..f55c65c8ce 100644 --- a/src/systems/follow_actor/FollowActor.cc +++ b/src/systems/follow_actor/FollowActor.cc @@ -15,6 +15,8 @@ * */ +#include + #include #include diff --git a/src/systems/sensors/Sensors.cc b/src/systems/sensors/Sensors.cc index 74b5b36bd1..d973d94a60 100644 --- a/src/systems/sensors/Sensors.cc +++ b/src/systems/sensors/Sensors.cc @@ -19,6 +19,7 @@ #include #include +#include #include #include diff --git a/src/systems/velocity_control/VelocityControl.cc b/src/systems/velocity_control/VelocityControl.cc index b431b86c7d..d6e07f48e7 100644 --- a/src/systems/velocity_control/VelocityControl.cc +++ b/src/systems/velocity_control/VelocityControl.cc @@ -16,6 +16,7 @@ */ #include +#include #include #include From 156268045bc7db3b5a68a4283b0876b7d7c0f59b Mon Sep 17 00:00:00 2001 From: Jose Luis Rivero Date: Fri, 18 Dec 2020 16:18:53 +0100 Subject: [PATCH 14/22] Fix style for comment Signed-off-by: Jose Luis Rivero --- src/Util.cc | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/src/Util.cc b/src/Util.cc index 8c87122d7a..dbbeaf8176 100644 --- a/src/Util.cc +++ b/src/Util.cc @@ -18,7 +18,7 @@ #ifndef __APPLE__ #if (defined(_MSVC_LANG)) #if (_MSVC_LANG >= 201703L || __cplusplus >= 201703L) - #include //C++17 + #include // C++17 #else #define _SILENCE_EXPERIMENTAL_FILESYSTEM_DEPRECATION_WARNING #include From 3dd83b24c79213300e0fa48710f3ede38c67d609 Mon Sep 17 00:00:00 2001 From: Jose Luis Rivero Date: Fri, 18 Dec 2020 17:57:22 +0100 Subject: [PATCH 15/22] Fix typo in ignition --- src/network/PeerTracker_TEST.cc | 8 ++++---- 1 file changed, 4 insertions(+), 4 deletions(-) diff --git a/src/network/PeerTracker_TEST.cc b/src/network/PeerTracker_TEST.cc index 3721a968da..a64ffb9a04 100644 --- a/src/network/PeerTracker_TEST.cc +++ b/src/network/PeerTracker_TEST.cc @@ -272,7 +272,7 @@ TEST(PeerTracker, PartitionedEnv) auto tracker1 = PeerTracker( PeerInfo(NetworkRole::SimulationPrimary), &eventMgr); - igniton::common:setenv("IGN_PARTITION", "p2"); + ignition::common:setenv("IGN_PARTITION", "p2"); auto tracker2 = PeerTracker( PeerInfo(NetworkRole::SimulationPrimary), &eventMgr); @@ -283,11 +283,11 @@ TEST(PeerTracker, PartitionedEnv) EXPECT_EQ(0u, tracker1.NumPeers()); EXPECT_EQ(0u, tracker2.NumPeers()); - igniton::common:setenv("IGN_PARTITION", "p1"); + ignition::common:setenv("IGN_PARTITION", "p1"); auto tracker3 = PeerTracker( PeerInfo(NetworkRole::SimulationSecondary), &eventMgr); - igniton::common:setenv("IGN_PARTITION", "p2"); + ignition::common:setenv("IGN_PARTITION", "p2"); auto tracker4 = PeerTracker( PeerInfo(NetworkRole::SimulationSecondary), &eventMgr); @@ -301,6 +301,6 @@ TEST(PeerTracker, PartitionedEnv) EXPECT_EQ(1u, tracker3.NumPeers()); EXPECT_EQ(1u, tracker4.NumPeers()); - igniton::common:unsetenv("IGN_PARTITION"); + ignition::common:unsetenv("IGN_PARTITION"); } #endif From 4209742183adcbc25bd87c7eeefc0eaa479c929c Mon Sep 17 00:00:00 2001 From: Jose Luis Rivero Date: Fri, 18 Dec 2020 18:17:25 +0100 Subject: [PATCH 16/22] Patch system installation --- src/systems/CMakeLists.txt | 10 ++++++---- 1 file changed, 6 insertions(+), 4 deletions(-) diff --git a/src/systems/CMakeLists.txt b/src/systems/CMakeLists.txt index bc101920b7..f207f3c027 100644 --- a/src/systems/CMakeLists.txt +++ b/src/systems/CMakeLists.txt @@ -61,12 +61,14 @@ function(gz_add_system system_name) # (i.e. libignition-gazebo1-name-system.so), but for portability of SDF # files, we also install an unversioned symlink into the same versioned folder. set(versioned ${CMAKE_SHARED_LIBRARY_PREFIX}${system_target}${CMAKE_SHARED_LIBRARY_SUFFIX}) - set(unversioned ${CMAKE_SHARED_LIBRARY_PREFIX}${PROJECT_NAME_NO_VERSION_LOWER}-${system_name}${CMAKE_SHARED_LIBRARY_SUFFIX}) + set(unversioned_file_name ${PROJECT_NAME_NO_VERSION_LOWER}-${system_name}${CMAKE_SHARED_LIBRARY_SUFFIX}) + set(unversioned ${CMAKE_SHARED_LIBRARY_PREFIX}${unversioned_file_name}) if (WIN32) - # create_symlink requires cmake 3.13 on windows - cmake_minimum_required(VERSION 3.13 FATAL_ERROR) + # symlinks on Windows require admin priviledges, fallback to copy + install(FILES ${versioned} DESTINATION ${CMAKE_SHARED_LIBRARY_PREFIX} RENAME ${unversioned_file_name}) + else() + EXECUTE_PROCESS(COMMAND ${CMAKE_COMMAND} -E create_symlink ${versioned} ${unversioned}) endif() - install(FILES ${versioned} DESTINATION ${IGNITION_GAZEBO_PLUGIN_INSTALL_DIR} RENAME ${unversioned}) INSTALL(FILES ${PROJECT_BINARY_DIR}/${unversioned} DESTINATION ${IGNITION_GAZEBO_PLUGIN_INSTALL_DIR}) endfunction() From 31c84108746545efa583a1979f48cdaaeb3ee828 Mon Sep 17 00:00:00 2001 From: Nate Koenig Date: Wed, 23 Dec 2020 15:33:11 -0800 Subject: [PATCH 17/22] Bump to ign-transport10 and msgs7 Signed-off-by: Nate Koenig --- CMakeLists.txt | 10 +++++----- README.md | 4 ++-- docker/Dockerfile.nightly | 4 ++-- examples/standalone/joy_to_twist/CMakeLists.txt | 4 ++-- examples/standalone/joystick/CMakeLists.txt | 4 ++-- examples/standalone/keyboard/CMakeLists.txt | 8 ++++---- examples/standalone/marker/CMakeLists.txt | 8 ++++---- examples/standalone/scene_requester/CMakeLists.txt | 4 ++-- tutorials/migrating_ardupilot_plugin.md | 4 ++-- 9 files changed, 25 insertions(+), 25 deletions(-) diff --git a/CMakeLists.txt b/CMakeLists.txt index 56e4189ced..e9c8095395 100644 --- a/CMakeLists.txt +++ b/CMakeLists.txt @@ -48,13 +48,13 @@ set(IGN_PLUGIN_VER ${ignition-plugin1_VERSION_MAJOR}) #-------------------------------------- # Find ignition-transport -ign_find_package(ignition-transport9 REQUIRED COMPONENTS log) -set(IGN_TRANSPORT_VER ${ignition-transport9_VERSION_MAJOR}) +ign_find_package(ignition-transport10 REQUIRED COMPONENTS log) +set(IGN_TRANSPORT_VER ${ignition-transport10_VERSION_MAJOR}) #-------------------------------------- # Find ignition-msgs -ign_find_package(ignition-msgs6 REQUIRED) -set(IGN_MSGS_VER ${ignition-msgs6_VERSION_MAJOR}) +ign_find_package(ignition-msgs7 REQUIRED) +set(IGN_MSGS_VER ${ignition-msgs7_VERSION_MAJOR}) #-------------------------------------- # Find ignition-common @@ -130,7 +130,7 @@ ign_find_package(IgnProtobuf REQUIRED COMPONENTS all PRETTY Protobuf) -set(PROTOBUF_IMPORT_DIRS ${ignition-msgs6_INCLUDE_DIRS}) +set(PROTOBUF_IMPORT_DIRS ${ignition-msgs7_INCLUDE_DIRS}) # Plugin install dirs set(IGNITION_GAZEBO_PLUGIN_INSTALL_DIR diff --git a/README.md b/README.md index 4d34826ef2..77f7319e5f 100644 --- a/README.md +++ b/README.md @@ -236,8 +236,8 @@ line is using symbolic links to each library's YAML file. mkdir ~/.ignition/tools/configs -p cd ~/.ignition/tools/configs/ ln -s /usr/local/share/ignition/fuel4.yaml . -ln -s /usr/local/share/ignition/transport9.yaml . -ln -s /usr/local/share/ignition/transportlog9.yaml . +ln -s /usr/local/share/ignition/transport10.yaml . +ln -s /usr/local/share/ignition/transportlog10.yaml . ... export IGN_CONFIG_PATH=$HOME/.ignition/tools/configs ``` diff --git a/docker/Dockerfile.nightly b/docker/Dockerfile.nightly index 10bab8a405..463e70613b 100644 --- a/docker/Dockerfile.nightly +++ b/docker/Dockerfile.nightly @@ -19,9 +19,9 @@ RUN apt-get update \ libignition-physics3-dev \ libignition-rendering5-dev \ libignition-tools-dev \ - libignition-transport9-dev \ + libignition-transport10-dev \ libignition-gui5-dev \ - libignition-msgs6-dev \ + libignition-msgs7-dev \ libignition-sensors5-dev \ libsdformat10-dev diff --git a/examples/standalone/joy_to_twist/CMakeLists.txt b/examples/standalone/joy_to_twist/CMakeLists.txt index a370bc286d..ff4c277f28 100644 --- a/examples/standalone/joy_to_twist/CMakeLists.txt +++ b/examples/standalone/joy_to_twist/CMakeLists.txt @@ -1,7 +1,7 @@ cmake_minimum_required(VERSION 3.10.2 FATAL_ERROR) -find_package(ignition-transport9 QUIET REQUIRED OPTIONAL_COMPONENTS log) -set(IGN_TRANSPORT_VER ${ignition-transport9_VERSION_MAJOR}) +find_package(ignition-transport10 QUIET REQUIRED OPTIONAL_COMPONENTS log) +set(IGN_TRANSPORT_VER ${ignition-transport10_VERSION_MAJOR}) find_package(sdformat10 REQUIRED) set(SDF_VER ${sdformat10_VERSION_MAJOR}) diff --git a/examples/standalone/joystick/CMakeLists.txt b/examples/standalone/joystick/CMakeLists.txt index a65f071cec..3d0957d133 100644 --- a/examples/standalone/joystick/CMakeLists.txt +++ b/examples/standalone/joystick/CMakeLists.txt @@ -2,8 +2,8 @@ cmake_minimum_required(VERSION 3.10.2 FATAL_ERROR) # joystick currently works only on linux if(${CMAKE_SYSTEM_NAME} STREQUAL "Linux") - find_package(ignition-transport9 QUIET REQUIRED OPTIONAL_COMPONENTS log) - set(IGN_TRANSPORT_VER ${ignition-transport9_VERSION_MAJOR}) + find_package(ignition-transport10 QUIET REQUIRED OPTIONAL_COMPONENTS log) + set(IGN_TRANSPORT_VER ${ignition-transport10_VERSION_MAJOR}) find_package(sdformat10 REQUIRED) set(SDF_VER ${sdformat10_VERSION_MAJOR}) diff --git a/examples/standalone/keyboard/CMakeLists.txt b/examples/standalone/keyboard/CMakeLists.txt index 34e5f6fc22..bdab11aab0 100644 --- a/examples/standalone/keyboard/CMakeLists.txt +++ b/examples/standalone/keyboard/CMakeLists.txt @@ -1,14 +1,14 @@ cmake_minimum_required(VERSION 3.10.2 FATAL_ERROR) if(${CMAKE_SYSTEM_NAME} STREQUAL "Linux") - find_package(ignition-transport9 QUIET REQUIRED OPTIONAL_COMPONENTS log) - set(IGN_TRANSPORT_VER ${ignition-transport9_VERSION_MAJOR}) + find_package(ignition-transport10 QUIET REQUIRED OPTIONAL_COMPONENTS log) + set(IGN_TRANSPORT_VER ${ignition-transport10_VERSION_MAJOR}) find_package(sdformat10 REQUIRED) set(SDF_VER ${sdformat10_VERSION_MAJOR}) - find_package(ignition-msgs6 REQUIRED) - set(IGN_MSGS_VER ${ignition-msgs6_VERSION_MAJOR}) + find_package(ignition-msgs7 REQUIRED) + set(IGN_MSGS_VER ${ignition-msgs7_VERSION_MAJOR}) find_package(ignition-common3 REQUIRED) set(IGN_COMMON_VER ${ignition-common3_VERSION_MAJOR}) diff --git a/examples/standalone/marker/CMakeLists.txt b/examples/standalone/marker/CMakeLists.txt index 931d976ac9..171aa844d6 100644 --- a/examples/standalone/marker/CMakeLists.txt +++ b/examples/standalone/marker/CMakeLists.txt @@ -1,14 +1,14 @@ cmake_minimum_required(VERSION 3.10.2 FATAL_ERROR) if(${CMAKE_SYSTEM_NAME} STREQUAL "Linux") - find_package(ignition-transport9 QUIET REQUIRED OPTIONAL_COMPONENTS log) - set(IGN_TRANSPORT_VER ${ignition-transport9_VERSION_MAJOR}) + find_package(ignition-transport10 QUIET REQUIRED OPTIONAL_COMPONENTS log) + set(IGN_TRANSPORT_VER ${ignition-transport10_VERSION_MAJOR}) find_package(ignition-common3 REQUIRED) set(IGN_COMMON_VER ${ignition-common3_VERSION_MAJOR}) - find_package(ignition-msgs6 REQUIRED) - set(IGN_MSGS_VER ${ignition-msgs6_VERSION_MAJOR}) + find_package(ignition-msgs7 REQUIRED) + set(IGN_MSGS_VER ${ignition-msgs7_VERSION_MAJOR}) add_executable(marker marker.cc) target_link_libraries(marker diff --git a/examples/standalone/scene_requester/CMakeLists.txt b/examples/standalone/scene_requester/CMakeLists.txt index bdd24b6898..4264cf811b 100644 --- a/examples/standalone/scene_requester/CMakeLists.txt +++ b/examples/standalone/scene_requester/CMakeLists.txt @@ -1,7 +1,7 @@ cmake_minimum_required(VERSION 3.10.2 FATAL_ERROR) -find_package(ignition-transport9 QUIET REQUIRED OPTIONAL_COMPONENTS log) -set(IGN_TRANSPORT_VER ${ignition-transport9_VERSION_MAJOR}) +find_package(ignition-transport10 QUIET REQUIRED OPTIONAL_COMPONENTS log) +set(IGN_TRANSPORT_VER ${ignition-transport10_VERSION_MAJOR}) add_executable(scene_requester scene_requester.cc) target_link_libraries(scene_requester diff --git a/tutorials/migrating_ardupilot_plugin.md b/tutorials/migrating_ardupilot_plugin.md index f2c5b838da..06a561dd6b 100644 --- a/tutorials/migrating_ardupilot_plugin.md +++ b/tutorials/migrating_ardupilot_plugin.md @@ -807,10 +807,10 @@ find_package(sdformat9 REQUIRED) find_package(ignition-common3-all REQUIRED) find_package(ignition-gazebo5-all REQUIRED) find_package(ignition-math6-all REQUIRED) -find_package(ignition-msgs6-all REQUIRED) +find_package(ignition-msgs7-all REQUIRED) find_package(ignition-physics3-all REQUIRED) find_package(ignition-sensors5-all REQUIRED) -find_package(ignition-transport9-all REQUIRED) +find_package(ignition-transport10-all REQUIRED) ``` In the old code we need only refer to the build configuration retrieved from the Gazebo package: From 9011b3dfb9b2ad732fa3a392894c7e2d1654a499 Mon Sep 17 00:00:00 2001 From: Jose Luis Rivero Date: Tue, 12 Jan 2021 19:37:43 +0100 Subject: [PATCH 18/22] Remove .cc file in favor of header only --- include/ignition/gazebo/EventManager.hh | 4 ++-- src/CMakeLists.txt | 1 - src/EventManager.cc | 26 ------------------------- 3 files changed, 2 insertions(+), 29 deletions(-) delete mode 100644 src/EventManager.cc diff --git a/include/ignition/gazebo/EventManager.hh b/include/ignition/gazebo/EventManager.hh index 128960fd95..0241bae447 100644 --- a/include/ignition/gazebo/EventManager.hh +++ b/include/ignition/gazebo/EventManager.hh @@ -50,10 +50,10 @@ namespace ignition class EventManager { /// \brief Constructor - public: EventManager(); + public: EventManager() = default; /// \brief Destructor - public: ~EventManager(); + public: ~EventManager() = default; /// \brief Add a connection to an event. /// \param[in] _subscriber A std::function callback function. The function diff --git a/src/CMakeLists.txt b/src/CMakeLists.txt index d83a5dcd56..5bd002d5bd 100644 --- a/src/CMakeLists.txt +++ b/src/CMakeLists.txt @@ -42,7 +42,6 @@ set (sources Barrier.cc Conversions.cc EntityComponentManager.cc - EventManager.cc LevelManager.cc Link.cc Model.cc diff --git a/src/EventManager.cc b/src/EventManager.cc deleted file mode 100644 index 656c816607..0000000000 --- a/src/EventManager.cc +++ /dev/null @@ -1,26 +0,0 @@ -/* - * Copyright (C) 2018 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. - * -*/ -#include "ignition/gazebo/EventManager.hh" - -using namespace ignition; -using namespace gazebo; - -////////////////////////////////////////////////// -EventManager::EventManager() = default; - -////////////////////////////////////////////////// -EventManager::~EventManager() = default; From c91424fb0ae4175c54e1652dca7432ec5babfa9f Mon Sep 17 00:00:00 2001 From: Jose Luis Rivero Date: Tue, 19 Jan 2021 18:01:16 +0100 Subject: [PATCH 19/22] Remove changes handled in a different PR --- src/network/PeerTracker_TEST.cc | 11 +++++------ 1 file changed, 5 insertions(+), 6 deletions(-) diff --git a/src/network/PeerTracker_TEST.cc b/src/network/PeerTracker_TEST.cc index 4435c8c261..abb46cf6b9 100644 --- a/src/network/PeerTracker_TEST.cc +++ b/src/network/PeerTracker_TEST.cc @@ -19,7 +19,6 @@ #include #include -#include #include "PeerTracker.hh" #include "ignition/gazebo/EventManager.hh" @@ -282,11 +281,11 @@ TEST(PeerTracker, PartitionedEnv) ignition::common::Console::SetVerbosity(4); EventManager eventMgr; - ignition::common::setenv("IGN_PARTITION", "p1"); + setenv("IGN_PARTITION", "p1", 1); auto tracker1 = PeerTracker( PeerInfo(NetworkRole::SimulationPrimary), &eventMgr); - ignition::common:setenv("IGN_PARTITION", "p2"); + setenv("IGN_PARTITION", "p2", 1); auto tracker2 = PeerTracker( PeerInfo(NetworkRole::SimulationPrimary), &eventMgr); @@ -297,11 +296,11 @@ TEST(PeerTracker, PartitionedEnv) EXPECT_EQ(0u, tracker1.NumPeers()); EXPECT_EQ(0u, tracker2.NumPeers()); - ignition::common:setenv("IGN_PARTITION", "p1"); + setenv("IGN_PARTITION", "p1", 1); auto tracker3 = PeerTracker( PeerInfo(NetworkRole::SimulationSecondary), &eventMgr); - ignition::common:setenv("IGN_PARTITION", "p2"); + setenv("IGN_PARTITION", "p2", 1); auto tracker4 = PeerTracker( PeerInfo(NetworkRole::SimulationSecondary), &eventMgr); @@ -315,6 +314,6 @@ TEST(PeerTracker, PartitionedEnv) EXPECT_EQ(1u, tracker3.NumPeers()); EXPECT_EQ(1u, tracker4.NumPeers()); - ignition::common:unsetenv("IGN_PARTITION"); + unsetenv("IGN_PARTITION"); } #endif From 814081e988a45e55085eb71469903651e9828617 Mon Sep 17 00:00:00 2001 From: Jose Luis Rivero Date: Wed, 20 Jan 2021 19:20:13 +0100 Subject: [PATCH 20/22] Update LeeVelocityController.hh --- src/systems/multicopter_control/LeeVelocityController.hh | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/src/systems/multicopter_control/LeeVelocityController.hh b/src/systems/multicopter_control/LeeVelocityController.hh index 29c4e190fc..d0d48ea4b7 100644 --- a/src/systems/multicopter_control/LeeVelocityController.hh +++ b/src/systems/multicopter_control/LeeVelocityController.hh @@ -49,7 +49,7 @@ namespace multicopter_control /// https://github.com/ethz-asl/rotors_simulator/blob/master/rotors_control/include/rotors_control/lee_position_controller.h /// The controller can be used to command linear velocity and yaw angle /// velocity expressed in the body frame. - class IGNITION_GAZEBO_VISIBLE LeeVelocityController + class LeeVelocityController { /// \brief Factory function to create LeeVelocityController objects /// \param[in] _controllerParams Controller parameteres From 2a9836f8981477e2fc2af0cc3a875f4fdb6eb502 Mon Sep 17 00:00:00 2001 From: Jose Luis Rivero Date: Thu, 21 Jan 2021 00:57:35 +0100 Subject: [PATCH 21/22] Use ADD_CUSTOM_COMMAND to copy unversioned file of plugins --- src/systems/CMakeLists.txt | 12 +++++++----- 1 file changed, 7 insertions(+), 5 deletions(-) diff --git a/src/systems/CMakeLists.txt b/src/systems/CMakeLists.txt index c68dbc5de2..935cf86dc3 100644 --- a/src/systems/CMakeLists.txt +++ b/src/systems/CMakeLists.txt @@ -61,15 +61,17 @@ function(gz_add_system system_name) # (i.e. libignition-gazebo1-name-system.so), but for portability of SDF # files, we also install an unversioned symlink into the same versioned folder. set(versioned ${CMAKE_SHARED_LIBRARY_PREFIX}${system_target}${CMAKE_SHARED_LIBRARY_SUFFIX}) - set(unversioned_file_name ${PROJECT_NAME_NO_VERSION_LOWER}-${system_name}${CMAKE_SHARED_LIBRARY_SUFFIX}) - set(unversioned ${CMAKE_SHARED_LIBRARY_PREFIX}${unversioned_file_name}) - if (WIN32) + set(unversioned ${CMAKE_SHARED_LIBRARY_PREFIX}${PROJECT_NAME_NO_VERSION_LOWER}-${system_name}${CMAKE_SHARED_LIBRARY_SUFFIX}) + if(WIN32) # symlinks on Windows require admin priviledges, fallback to copy - install(FILES ${versioned} DESTINATION ${CMAKE_SHARED_LIBRARY_PREFIX} RENAME ${unversioned_file_name}) + ADD_CUSTOM_COMMAND(TARGET ${system_target} POST_BUILD + COMMAND "${CMAKE_COMMAND}" -E copy + "$" + "$/${unversioned}") else() EXECUTE_PROCESS(COMMAND ${CMAKE_COMMAND} -E create_symlink ${versioned} ${unversioned}) + INSTALL(FILES ${PROJECT_BINARY_DIR}/${unversioned} DESTINATION ${IGNITION_GAZEBO_PLUGIN_INSTALL_DIR}) endif() - INSTALL(FILES ${PROJECT_BINARY_DIR}/${unversioned} DESTINATION ${IGNITION_GAZEBO_PLUGIN_INSTALL_DIR}) endfunction() add_subdirectory(air_pressure) From 8c6b51f9767ed6d925b080b527f922f8bc479dd9 Mon Sep 17 00:00:00 2001 From: Jose Luis Rivero Date: Fri, 22 Jan 2021 16:32:31 +0100 Subject: [PATCH 22/22] Remove duplicate Signed-off-by: Jose Luis Rivero --- src/systems/breadcrumbs/Breadcrumbs.hh | 1 - 1 file changed, 1 deletion(-) diff --git a/src/systems/breadcrumbs/Breadcrumbs.hh b/src/systems/breadcrumbs/Breadcrumbs.hh index 7d29c6f88d..e57be62402 100644 --- a/src/systems/breadcrumbs/Breadcrumbs.hh +++ b/src/systems/breadcrumbs/Breadcrumbs.hh @@ -17,7 +17,6 @@ #ifndef IGNITION_GAZEBO_SYSTEMS_BREADCRUMBS_HH_ #define IGNITION_GAZEBO_SYSTEMS_BREADCRUMBS_HH_ -#include #include #include #include