From 894e2e2319617fbde652960b847e13436391ec9c Mon Sep 17 00:00:00 2001 From: "Addisu Z. Taddese" Date: Wed, 14 Jun 2023 23:09:41 -0500 Subject: [PATCH 01/12] 5.3.0 Release (#221) Signed-off-by: Addisu Z. Taddese --- CMakeLists.txt | 2 +- Changelog.md | 23 +++++++++++++++++++++++ 2 files changed, 24 insertions(+), 1 deletion(-) diff --git a/CMakeLists.txt b/CMakeLists.txt index 6d5e17b5..f336d92a 100644 --- a/CMakeLists.txt +++ b/CMakeLists.txt @@ -3,7 +3,7 @@ cmake_minimum_required(VERSION 3.5.1 FATAL_ERROR) #============================================================================ # Initialize the project #============================================================================ -project(ignition-launch5 VERSION 5.2.0) +project(ignition-launch5 VERSION 5.3.0) #============================================================================ # Find ignition-cmake diff --git a/Changelog.md b/Changelog.md index 66c99027..fc00bffe 100644 --- a/Changelog.md +++ b/Changelog.md @@ -1,5 +1,28 @@ ## Gazebo Launch 5.x +### Gazebo Launch 5.3.0 (2023-06-14) + +1. Forward ports + * [Pull request #214](https://github.com/gazebosim/gz-launch/pull/214) + +1. Infrastructure + * [Pull request #213](https://github.com/gazebosim/gz-launch/pull/213) + +1. Rename COPYING to LICENSE + * [Pull request #212](https://github.com/gazebosim/gz-launch/pull/212) + +1. Small cleanup fixes + * [Pull request #211](https://github.com/gazebosim/gz-launch/pull/211) + +1. Add pause and stop to Websocket Server + * [Pull request #187](https://github.com/gazebosim/gz-launch/pull/187) + +1. Return a message on asset error + * [Pull request #197](https://github.com/gazebosim/gz-launch/pull/197) + +1. Remove redundant namespace references + * [Pull request #190](https://github.com/gazebosim/gz-launch/pull/190) + ### Gazebo Launch 5.2.0 (2022-08-16) 1. Add code coverage ignore file From 3822e48ee7936808c8c43f5c1abb61a3dff5815d Mon Sep 17 00:00:00 2001 From: "Addisu Z. Taddese" Date: Mon, 27 Nov 2023 14:10:56 -0600 Subject: [PATCH 02/12] Update github action workflows (#238) * Use on `push` only on stable branches to avoid duplicate runs * Update project automation Signed-off-by: Addisu Z. Taddese --- .github/workflows/ci.yml | 12 +++++++++--- .github/workflows/triage.yml | 9 +++------ 2 files changed, 12 insertions(+), 9 deletions(-) diff --git a/.github/workflows/ci.yml b/.github/workflows/ci.yml index 744bfcff..d0774285 100644 --- a/.github/workflows/ci.yml +++ b/.github/workflows/ci.yml @@ -1,6 +1,12 @@ name: Ubuntu CI -on: [push, pull_request] +on: + pull_request: + push: + branches: + - 'ign-launch[0-9]' + - 'gz-launch[0-9]?' + - 'main' jobs: bionic-ci: @@ -8,7 +14,7 @@ jobs: name: Ubuntu Bionic CI steps: - name: Checkout - uses: actions/checkout@v3 + uses: actions/checkout@v4 - name: Compile and test id: ci uses: ignition-tooling/action-ignition-ci@bionic @@ -19,7 +25,7 @@ jobs: name: Ubuntu Focal CI steps: - name: Checkout - uses: actions/checkout@v3 + uses: actions/checkout@v4 - name: Compile and test id: ci uses: ignition-tooling/action-ignition-ci@focal diff --git a/.github/workflows/triage.yml b/.github/workflows/triage.yml index 736670e0..2332244b 100644 --- a/.github/workflows/triage.yml +++ b/.github/workflows/triage.yml @@ -10,10 +10,7 @@ jobs: runs-on: ubuntu-latest steps: - name: Add ticket to inbox - uses: technote-space/create-project-card-action@v1 + uses: actions/add-to-project@v0.5.0 with: - PROJECT: Core development - COLUMN: Inbox - GITHUB_TOKEN: ${{ secrets.TRIAGE_TOKEN }} - CHECK_ORG_PROJECT: true - + project-url: https://github.com/orgs/gazebosim/projects/7 + github-token: ${{ secrets.TRIAGE_TOKEN }} From 11ea9199c44b26637cf3c4b1473b55a3b19c5402 Mon Sep 17 00:00:00 2001 From: Ian Chen Date: Thu, 21 Dec 2023 07:42:09 -0800 Subject: [PATCH 03/12] Update CI badges in README (#239) Signed-off-by: Ian Chen --- README.md | 8 ++++---- 1 file changed, 4 insertions(+), 4 deletions(-) diff --git a/README.md b/README.md index bf2d5382..d42ca954 100644 --- a/README.md +++ b/README.md @@ -9,10 +9,10 @@ Build | Status -- | -- -Test coverage | [![codecov](https://codecov.io/gh/gazebosim/gz-launch/branch/main/graph/badge.svg)](https://codecov.io/gh/gazebosim/gz-launch) -Ubuntu Focal | [![Build Status](https://build.osrfoundation.org/buildStatus/icon?job=ignition_launch-ci-main-focal-amd64)](https://build.osrfoundation.org/job/ignition_launch-ci-main-focal-amd64) -Homebrew | [![Build Status](https://build.osrfoundation.org/buildStatus/icon?job=ignition_launch-ci-main-homebrew-amd64)](https://build.osrfoundation.org/job/ignition_launch-ci-main-homebrew-amd64) -Windows | [![Build Status](https://build.osrfoundation.org/job/ign_launch-ci-win/badge/icon)](https://build.osrfoundation.org/job/ign_launch-ci-win/) +Test coverage | [![codecov](https://codecov.io/gh/gazebosim/gz-launch/tree/gz-launch7/graph/badge.svg)](https://codecov.io/gh/gazebosim/gz-launch/tree/gz-launch7) +Ubuntu Jammy | [![Build Status](https://build.osrfoundation.org/buildStatus/icon?job=gz_launch-ci-gz-launch7-jammy-amd64)](https://build.osrfoundation.org/job/gz_launch-ci-gz-launch7-jammy-amd64) +Homebrew | [![Build Status](https://build.osrfoundation.org/buildStatus/icon?job=gz_launch-ci-gz-launch7-homebrew-amd64)](https://build.osrfoundation.org/job/gz_launch-ci-gz-launch7-homebrew-amd64) +Windows | [![Build Status](https://build.osrfoundation.org/job/gz_launch-7-win/badge/icon)](https://build.osrfoundation.org/job/gz_launch-7-win/) Gazebo Launch, a component of [Gazebo](https://gazebosim.org), provides a command line interface to run and manager application and plugins. From 3c40338c0e5048b4b9eb88ee7fbf39b0d708e500 Mon Sep 17 00:00:00 2001 From: "Addisu Z. Taddese" Date: Fri, 5 Jan 2024 19:05:03 -0600 Subject: [PATCH 04/12] Prepare for 2.3.1 release (#240) Signed-off-by: Addisu Z. Taddese --- CMakeLists.txt | 2 +- Changelog.md | 10 ++++++++++ 2 files changed, 11 insertions(+), 1 deletion(-) diff --git a/CMakeLists.txt b/CMakeLists.txt index 4b287a93..3ae8e621 100644 --- a/CMakeLists.txt +++ b/CMakeLists.txt @@ -3,7 +3,7 @@ cmake_minimum_required(VERSION 3.5.1 FATAL_ERROR) #============================================================================ # Initialize the project #============================================================================ -project(ignition-launch2 VERSION 2.3.0) +project(ignition-launch2 VERSION 2.3.1) #============================================================================ # Find ignition-cmake diff --git a/Changelog.md b/Changelog.md index 2d70718b..b554e60e 100644 --- a/Changelog.md +++ b/Changelog.md @@ -1,5 +1,15 @@ ## Gazebo Launch 2.x +### Gazebo Launch 2.3.1 (2024-01-05) + +1. Small cleanup fixes + * [Pull request #211](https://github.com/gazebosim/gz-launch/pull/211) + +1. Infrastructure + * [Pull request #238](https://github.com/gazebosim/gz-launch/pull/238) + * [Pull request #213](https://github.com/gazebosim/gz-launch/pull/213) + * [Pull request #212](https://github.com/gazebosim/gz-launch/pull/212) + ### Gazebo Launch 2.3.0 (2022-08-15) 1. Remove redundant namespace references From c4f4e4dd8740b58bae80094034eff132cc1e03f1 Mon Sep 17 00:00:00 2001 From: Nate Koenig Date: Mon, 11 Mar 2024 05:29:43 -0700 Subject: [PATCH 05/12] Fix windows warnings (#199) * Fix windows warnings Signed-off-by: Nate Koenig * Fix more windows warnings Signed-off-by: Nate Koenig * Added string include Signed-off-by: Nate Koenig --------- Signed-off-by: Nate Koenig Signed-off-by: Nate Koenig Co-authored-by: Nate Koenig --- plugins/joy_to_twist/JoyToTwist.cc | 48 +++++++++--- plugins/joy_to_twist/JoyToTwist.hh | 2 +- src/Manager.hh | 6 +- src/vendor/backward.hpp | 120 +++++++++++++++-------------- 4 files changed, 101 insertions(+), 75 deletions(-) diff --git a/plugins/joy_to_twist/JoyToTwist.cc b/plugins/joy_to_twist/JoyToTwist.cc index 5242c66a..bc72da74 100644 --- a/plugins/joy_to_twist/JoyToTwist.cc +++ b/plugins/joy_to_twist/JoyToTwist.cc @@ -21,6 +21,8 @@ #include #endif +#include + #include #include @@ -49,6 +51,22 @@ void setVectorFromString(const std::string &_str, } } +////////////////////////////////////////////////// +// String to vector helper function. +void setVectorFromString(const std::string &_str, + gz::math::Vector3i &_v) +{ + std::string str = gz::common::trimmed(_str); + + std::vector parts = gz::common::split(str, " "); + if (parts.size() == 3) + { + _v.X(std::stoi(parts[0])); + _v.Y(std::stoi(parts[1])); + _v.Z(std::stoi(parts[2])); + } +} + ///////////////////////////////////////////////// JoyToTwist::JoyToTwist() : Plugin() @@ -130,18 +148,21 @@ void JoyToTwist::OnJoy(const gz::msgs::Joy &_msg) if (this->enableTurboButton >= 0 && _msg.buttons(this->enableTurboButton)) { cmdVelMsg.mutable_linear()->set_x( - _msg.axes(this->axisLinear.X()) * this->scaleLinearTurbo.X()); + _msg.axes(this->axisLinear.X()) * this->scaleLinearTurbo.X()); cmdVelMsg.mutable_linear()->set_y( - _msg.axes(this->axisLinear.Y()) * this->scaleLinearTurbo.Y()); + _msg.axes(this->axisLinear.Y()) * this->scaleLinearTurbo.Y()); cmdVelMsg.mutable_linear()->set_z( - _msg.axes(this->axisLinear.Z()) * this->scaleLinearTurbo.Z()); + _msg.axes(this->axisLinear.Z()) * this->scaleLinearTurbo.Z()); cmdVelMsg.mutable_angular()->set_x( - _msg.axes(this->axisAngular.X()) * this->scaleAngularTurbo.X()); + _msg.axes(static_cast(this->axisAngular.X())) * + this->scaleAngularTurbo.X()); cmdVelMsg.mutable_angular()->set_y( - _msg.axes(this->axisAngular.Y()) * this->scaleAngularTurbo.Y()); + _msg.axes(static_cast(this->axisAngular.Y())) * + this->scaleAngularTurbo.Y()); cmdVelMsg.mutable_angular()->set_z( - _msg.axes(this->axisAngular.Z()) * this->scaleAngularTurbo.Z()); + _msg.axes(static_cast(this->axisAngular.Z())) * + this->scaleAngularTurbo.Z()); this->cmdVelPub.Publish(cmdVelMsg); this->sentDisableMsg = false; @@ -150,18 +171,21 @@ void JoyToTwist::OnJoy(const gz::msgs::Joy &_msg) else if (_msg.buttons(this->enableButton)) { cmdVelMsg.mutable_linear()->set_x( - _msg.axes(this->axisLinear.X()) * this->scaleLinear.X()); + _msg.axes(this->axisLinear.X()) * this->scaleLinear.X()); cmdVelMsg.mutable_linear()->set_y( - _msg.axes(this->axisLinear.Y()) * this->scaleLinear.Y()); + _msg.axes(this->axisLinear.Y()) * this->scaleLinear.Y()); cmdVelMsg.mutable_linear()->set_z( - _msg.axes(this->axisLinear.Z()) * this->scaleLinear.Z()); + _msg.axes(this->axisLinear.Z()) * this->scaleLinear.Z()); cmdVelMsg.mutable_angular()->set_x( - _msg.axes(this->axisAngular.X()) * this->scaleAngular.X()); + _msg.axes(static_cast(this->axisAngular.X())) * + this->scaleAngular.X()); cmdVelMsg.mutable_angular()->set_y( - _msg.axes(this->axisAngular.Y()) * this->scaleAngular.Y()); + _msg.axes(static_cast(this->axisAngular.Y())) * + this->scaleAngular.Y()); cmdVelMsg.mutable_angular()->set_z( - _msg.axes(this->axisAngular.Z()) * this->scaleAngular.Z()); + _msg.axes(static_cast(this->axisAngular.Z())) * + this->scaleAngular.Z()); this->cmdVelPub.Publish(cmdVelMsg); this->sentDisableMsg = false; diff --git a/plugins/joy_to_twist/JoyToTwist.hh b/plugins/joy_to_twist/JoyToTwist.hh index 5228916c..353abff4 100644 --- a/plugins/joy_to_twist/JoyToTwist.hh +++ b/plugins/joy_to_twist/JoyToTwist.hh @@ -94,7 +94,7 @@ namespace gz private: int enableButton = 0; private: int enableTurboButton = -1; - private: gz::math::Vector3d axisLinear{1.0, 0.0, 0.0}; + private: gz::math::Vector3i axisLinear{1, 0, 0}; private: gz::math::Vector3d scaleLinear{0.5, 0.0, 0.0}; private: gz::math::Vector3d scaleLinearTurbo{0.5, 0.0, 0.0}; diff --git a/src/Manager.hh b/src/Manager.hh index fccfffce..fb2d9225 100644 --- a/src/Manager.hh +++ b/src/Manager.hh @@ -20,7 +20,7 @@ #include #include -// #include +#include #include @@ -52,9 +52,9 @@ namespace gz public: bool Stop(); /// \brief Private data pointer. - // GZ_COMMON_WARN_IGNORE__DLL_INTERFACE_MISSING + GZ_UTILS_WARN_IGNORE__DLL_INTERFACE_MISSING private: std::unique_ptr dataPtr; - // GZ_COMMON_WARN_RESUME__DLL_INTERFACE_MISSING + GZ_UTILS_WARN_IGNORE__DLL_INTERFACE_MISSING }; } } diff --git a/src/vendor/backward.hpp b/src/vendor/backward.hpp index 6cacf822..8844ea0d 100644 --- a/src/vendor/backward.hpp +++ b/src/vendor/backward.hpp @@ -51,13 +51,13 @@ // You can define one of the following (or leave it to the auto-detection): // // #define BACKWARD_SYSTEM_LINUX -// - specialization for linux +// - specialization for linux // // #define BACKWARD_SYSTEM_DARWIN -// - specialization for Mac OS X 10.5 and later. +// - specialization for Mac OS X 10.5 and later. // // #define BACKWARD_SYSTEM_UNKNOWN -// - placebo implementation, does nothing. +// - placebo implementation, does nothing. // #if defined(BACKWARD_SYSTEM_LINUX) #elif defined(BACKWARD_SYSTEM_DARWIN) @@ -132,9 +132,9 @@ // - object filename // - function name // - source filename -// - line and column numbers -// - source code snippet (assuming the file is accessible) -// - variables name and values (if not optimized out) +// - line and column numbers +// - source code snippet (assuming the file is accessible) +// - variables name and values (if not optimized out) // - You need to link with the lib "dw": // - apt-get install libdw-dev // - g++/clang++ -ldw ... @@ -144,8 +144,8 @@ // - object filename // - function name // - source filename -// - line numbers -// - source code snippet (assuming the file is accessible) +// - line numbers +// - source code snippet (assuming the file is accessible) // - You need to link with the lib "bfd": // - apt-get install binutils-dev // - g++/clang++ -lbfd ... @@ -191,8 +191,8 @@ #include #include #ifdef __ANDROID__ -// Old Android API levels define _Unwind_Ptr in both link.h and -// unwind.h Rename the one in link.h as we are not going to be using +// Old Android API levels define _Unwind_Ptr in both link.h and +// unwind.h Rename the one in link.h as we are not going to be using // it #define _Unwind_Ptr _Unwind_Ptr_Custom #include @@ -320,7 +320,9 @@ #include typedef SSIZE_T ssize_t; +#ifndef NOMINMAX #define NOMINMAX +#endif #include #include @@ -1129,14 +1131,14 @@ class TraceResolverLinuxImpl // Now we get in symbol_info: // .dli_fname: - // pathname of the shared object that contains the address. + // pathname of the shared object that contains the address. // .dli_fbase: - // where the object is loaded in memory. + // where the object is loaded in memory. // .dli_sname: - // the name of the nearest symbol to trace.addr, we expect a - // function name. + // the name of the nearest symbol to trace.addr, we expect a + // function name. // .dli_saddr: - // the exact address corresponding to .dli_sname. + // the exact address corresponding to .dli_sname. if (symbol_info.dli_sname) { trace.object_function = demangle(symbol_info.dli_sname); @@ -1218,47 +1220,47 @@ class TraceResolverLinuxImpl trace.inliners = backtrace_inliners(fobj, *details_selected); #if 0 - if (trace.inliners.size() == 0) { - // Maybe the trace was not inlined... or maybe it was and we - // are lacking the debug information. Let's try to make the - // world better and see if we can get the line number of the - // function (trace.source.function) now. - // - // We will get the location of where the function start (to be - // exact: the first instruction that really start the - // function), not where the name of the function is defined. - // This can be quite far away from the name of the function - // btw. - // - // If the source of the function is the same as the source of - // the trace, we cannot say if the trace was really inlined or - // not. However, if the filename of the source is different - // between the function and the trace... we can declare it as - // an inliner. This is not 100% accurate, but better than - // nothing. - - if (symbol_info.dli_saddr) { - find_sym_result details = find_symbol_details(fobj, - symbol_info.dli_saddr, - symbol_info.dli_fbase); - - if (details.found) { - ResolvedTrace::SourceLoc diy_inliner; - diy_inliner.line = details.line; - if (details.filename) { - diy_inliner.filename = details.filename; - } - if (details.funcname) { - diy_inliner.function = demangle(details.funcname); - } else { - diy_inliner.function = trace.source.function; - } - if (diy_inliner != trace.source) { - trace.inliners.push_back(diy_inliner); - } - } - } - } + if (trace.inliners.size() == 0) { + // Maybe the trace was not inlined... or maybe it was and we + // are lacking the debug information. Let's try to make the + // world better and see if we can get the line number of the + // function (trace.source.function) now. + // + // We will get the location of where the function start (to be + // exact: the first instruction that really start the + // function), not where the name of the function is defined. + // This can be quite far away from the name of the function + // btw. + // + // If the source of the function is the same as the source of + // the trace, we cannot say if the trace was really inlined or + // not. However, if the filename of the source is different + // between the function and the trace... we can declare it as + // an inliner. This is not 100% accurate, but better than + // nothing. + + if (symbol_info.dli_saddr) { + find_sym_result details = find_symbol_details(fobj, + symbol_info.dli_saddr, + symbol_info.dli_fbase); + + if (details.found) { + ResolvedTrace::SourceLoc diy_inliner; + diy_inliner.line = details.line; + if (details.filename) { + diy_inliner.filename = details.filename; + } + if (details.funcname) { + diy_inliner.function = demangle(details.funcname); + } else { + diy_inliner.function = trace.source.function; + } + if (diy_inliner != trace.source) { + trace.inliners.push_back(diy_inliner); + } + } + } + } #endif } @@ -3434,9 +3436,9 @@ class SourceFile { lines_t &get_lines(unsigned line_start, unsigned line_count, lines_t &lines) { using namespace std; // This function make uses of the dumbest algo ever: - // 1) seek(0) - // 2) read lines one by one and discard until line_start - // 3) read line one by one until line_start + line_count + // 1) seek(0) + // 2) read lines one by one and discard until line_start + // 3) read line one by one until line_start + line_count // // If you are getting snippets many time from the same file, it is // somewhat a waste of CPU, feel free to benchmark and propose a From 28c76dbf9d5a367ca00641b5f35c660f8052ecb5 Mon Sep 17 00:00:00 2001 From: "Addisu Z. Taddese" Date: Tue, 19 Mar 2024 13:58:19 -0500 Subject: [PATCH 06/12] Fix msvc warning (#250) Signed-off-by: Addisu Z. Taddese --- src/Manager.cc | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/src/Manager.cc b/src/Manager.cc index 42f51e1b..21fa9737 100644 --- a/src/Manager.cc +++ b/src/Manager.cc @@ -381,7 +381,7 @@ ManagerPrivate::ManagerPrivate() const auto pid_seed = std::hash()( std::this_thread::get_id()); std::seed_seq seed_value{time_seed, pid_seed}; - std::vector seeds(1); + std::vector seeds(1); seed_value.generate(seeds.begin(), seeds.end()); math::Rand::Seed(seeds[0]); } From 17835ca9d41ca5fa0b0973cb8c82d4e5812451d1 Mon Sep 17 00:00:00 2001 From: Silvio Traversaro Date: Wed, 3 Apr 2024 16:42:30 +0200 Subject: [PATCH 07/12] Add optional binary relocatability (#218) Signed-off-by: Silvio Traversaro --- CMakeLists.txt | 3 +- include/gz/launch/InstallationDirectories.hh | 46 ++++++++++++++++++++ include/gz/launch/config.hh.in | 4 +- src/CMakeLists.txt | 13 ++++++ src/InstallationDirectories.cc | 43 ++++++++++++++++++ src/Manager.cc | 3 +- src/cmd/CMakeLists.txt | 3 +- src/cmd/gz.cc | 5 ++- test/integration/CMakeLists.txt | 5 ++- test/performance/CMakeLists.txt | 4 +- test/regression/CMakeLists.txt | 4 +- 11 files changed, 124 insertions(+), 9 deletions(-) create mode 100644 include/gz/launch/InstallationDirectories.hh create mode 100644 src/InstallationDirectories.cc diff --git a/CMakeLists.txt b/CMakeLists.txt index 5e19ca64..6d2fe831 100644 --- a/CMakeLists.txt +++ b/CMakeLists.txt @@ -23,7 +23,8 @@ gz_configure_project(VERSION_SUFFIX) # Set project-specific options #============================================================================ -set(GZ_LAUNCH_PLUGIN_INSTALL_PATH "${CMAKE_INSTALL_PREFIX}/${GZ_LIB_INSTALL_DIR}/gz-${GZ_DESIGNATION}-${PROJECT_VERSION_MAJOR}/plugins/") +set(GZ_LAUNCH_PLUGIN_RELATIVE_INSTALL_PATH "${GZ_LIB_INSTALL_DIR}/gz-${GZ_DESIGNATION}-${PROJECT_VERSION_MAJOR}/plugins/") +set(GZ_LAUNCH_PLUGIN_INSTALL_PATH "${CMAKE_INSTALL_PREFIX}/${GZ_LAUNCH_PLUGIN_RELATIVE_INSTALL_PATH}") #============================================================================ # Search for project-specific dependencies diff --git a/include/gz/launch/InstallationDirectories.hh b/include/gz/launch/InstallationDirectories.hh new file mode 100644 index 00000000..f9fd398d --- /dev/null +++ b/include/gz/launch/InstallationDirectories.hh @@ -0,0 +1,46 @@ +/* + * Copyright (C) 2023 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 GZ_LAUNCH_INSTALLATION_DIRECTORIES_HH_ +#define GZ_LAUNCH_INSTALLATION_DIRECTORIES_HH_ + +#include + +#include +#include + +namespace gz +{ + namespace launch + { + inline namespace GZ_LAUNCH_VERSION_NAMESPACE { + + /// \brief getInstallPrefix return the install prefix of the library + /// i.e. CMAKE_INSTALL_PREFIX unless the library has been moved + GZ_LAUNCH_VISIBLE std::string getInstallPrefix(); + + /// \brief getPluginInstallPath return the plugin install path + GZ_LAUNCH_VISIBLE std::string getPluginInstallPath(); + + /// \brief getInitialConfigPath return the initial config path + GZ_LAUNCH_VISIBLE std::string getInitialConfigPath(); + + } + } +} + +#endif diff --git a/include/gz/launch/config.hh.in b/include/gz/launch/config.hh.in index b0fb1f30..73609ae4 100644 --- a/include/gz/launch/config.hh.in +++ b/include/gz/launch/config.hh.in @@ -30,8 +30,8 @@ #define GZ_LAUNCH_VERSION_HEADER "Gazebo Launch, version ${PROJECT_VERSION_FULL}\nCopyright (C) 2019 Open Source Robotics Foundation.\nReleased under the Apache 2.0 License.\n\n" -#define GZ_LAUNCH_INITIAL_CONFIG_PATH "${CMAKE_INSTALL_PREFIX}/${GZ_DATA_INSTALL_DIR}/configs" +#define GZ_LAUNCH_INITIAL_CONFIG_PATH _Pragma ("GCC warning \"'GZ_LAUNCH_INITIAL_CONFIG_PATH' macro is deprecated, use gz::launch::getInitialConfigPath() function instead. \"") "${CMAKE_INSTALL_PREFIX}/${GZ_DATA_INSTALL_DIR}/configs" -#define GZ_LAUNCH_PLUGIN_INSTALL_PATH "${GZ_LAUNCH_PLUGIN_INSTALL_PATH}" +#define GZ_LAUNCH_PLUGIN_INSTALL_PATH _Pragma ("GCC warning \"'GZ_LAUNCH_PLUGIN_INSTALL_PATH' macro is deprecated, use gz::launch::getPluginInstallPath() function instead. \"") "${GZ_LAUNCH_PLUGIN_INSTALL_PATH}" #endif diff --git a/src/CMakeLists.txt b/src/CMakeLists.txt index e5f87b11..d3b5350d 100644 --- a/src/CMakeLists.txt +++ b/src/CMakeLists.txt @@ -1,6 +1,7 @@ # add_subdirectory(plugins) set (sources + InstallationDirectories.cc Manager.cc ) @@ -10,6 +11,16 @@ set (gtest_sources # Create the library target. gz_create_core_library(SOURCES ${sources}) +gz_add_get_install_prefix_impl(GET_INSTALL_PREFIX_FUNCTION gz::launch::getInstallPrefix + GET_INSTALL_PREFIX_HEADER gz/launch/InstallationDirectories.hh + OVERRIDE_INSTALL_PREFIX_ENV_VARIABLE GZ_LAUNCH_INSTALL_PREFIX) + +set_property( + SOURCE InstallationDirectories.cc + PROPERTY COMPILE_DEFINITIONS + GZ_LAUNCH_PLUGIN_RELATIVE_INSTALL_PATH="${GZ_LAUNCH_PLUGIN_RELATIVE_INSTALL_PATH}" + GZ_LAUNCH_INITIAL_CONFIG_RELATIVE_PATH="${GZ_DATA_INSTALL_DIR}/configs" +) # Link the libraries that we always need. target_link_libraries(${PROJECT_LIBRARY_TARGET_NAME} @@ -31,6 +42,8 @@ gz_build_tests(TYPE UNIT SOURCES ${gtest_sources} LIB_DEPS ${PROJECT_LIBRARY_TARGET_NAME} gz-common${GZ_COMMON_VER}::gz-common${GZ_COMMON_VER} + ENVIRONMENT + GZ_LAUNCH_INSTALL_PREFIX=${CMAKE_INSTALL_PREFIX} ) add_subdirectory(cmd) diff --git a/src/InstallationDirectories.cc b/src/InstallationDirectories.cc new file mode 100644 index 00000000..39dcaacf --- /dev/null +++ b/src/InstallationDirectories.cc @@ -0,0 +1,43 @@ +/* + * Copyright (C) 2023 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 +#include + +#include + +namespace gz +{ +namespace launch +{ +inline namespace GZ_LAUNCH_VERSION_NAMESPACE { + +std::string getPluginInstallPath() +{ + return gz::common::joinPaths( + getInstallPrefix(), GZ_LAUNCH_PLUGIN_RELATIVE_INSTALL_PATH); +} + +std::string getInitialConfigPath() +{ + return gz::common::joinPaths( + getInstallPrefix(), GZ_LAUNCH_INITIAL_CONFIG_RELATIVE_PATH); +} + +} +} +} diff --git a/src/Manager.cc b/src/Manager.cc index 400d95a3..9ca71c87 100644 --- a/src/Manager.cc +++ b/src/Manager.cc @@ -57,6 +57,7 @@ #include #include "gz/launch/config.hh" +#include "gz/launch/InstallationDirectories.hh" #include "gz/launch/Plugin.hh" #include "vendor/backward.hpp" @@ -1089,7 +1090,7 @@ void ManagerPrivate::LoadPlugin(const tinyxml2::XMLElement *_elem) gz::common::SystemPaths systemPaths; systemPaths.SetPluginPathEnv("GZ_LAUNCH_PLUGIN_PATH"); - systemPaths.AddPluginPaths(GZ_LAUNCH_PLUGIN_INSTALL_PATH); + systemPaths.AddPluginPaths(gz::launch::getPluginInstallPath()); // Add LD_LIBRARY_PATH #ifdef __linux__ diff --git a/src/cmd/CMakeLists.txt b/src/cmd/CMakeLists.txt index b87f706d..49be965e 100644 --- a/src/cmd/CMakeLists.txt +++ b/src/cmd/CMakeLists.txt @@ -32,7 +32,8 @@ install( # Build the unit tests. gz_build_tests(TYPE UNIT SOURCES ${gtest_sources} TEST_LIST test_list - LIB_DEPS ${EXTRA_TEST_LIB_DEPS}) + LIB_DEPS ${EXTRA_TEST_LIB_DEPS} + ENVIRONMENT GZ_LAUNCH_INSTALL_PREFIX=${CMAKE_INSTALL_PREFIX}) foreach(test ${test_list}) target_link_libraries(${test} gz) diff --git a/src/cmd/gz.cc b/src/cmd/gz.cc index d770541b..cdd559c7 100644 --- a/src/cmd/gz.cc +++ b/src/cmd/gz.cc @@ -15,9 +15,11 @@ * */ #include +#include #include #include "gz/launch/config.hh" +#include "gz/launch/InstallationDirectories.hh" #include "gz.hh" #include "../Manager.hh" @@ -30,7 +32,8 @@ extern "C" char *gzVersion() ////////////////////////////////////////////////// extern "C" const char *configPath() { - return GZ_LAUNCH_INITIAL_CONFIG_PATH; + std::string configPath = gz::launch::getPluginInstallPath(); + return configPath.c_str(); } ////////////////////////////////////////////////// diff --git a/test/integration/CMakeLists.txt b/test/integration/CMakeLists.txt index 1c6496c6..f4162ed8 100644 --- a/test/integration/CMakeLists.txt +++ b/test/integration/CMakeLists.txt @@ -10,7 +10,10 @@ if(NOT WIN32) # Disable test on Windows, it deals with UNIX signals set(tests faulty_plugins.cc) - gz_build_tests(TYPE INTEGRATION SOURCES ${tests} TEST_LIST test_targets) + gz_build_tests(TYPE INTEGRATION + SOURCES ${tests} + TEST_LIST test_targets + ENVIRONMENT GZ_LAUNCH_INSTALL_PREFIX=${CMAKE_INSTALL_PREFIX}) foreach(test ${test_targets}) target_compile_definitions(${test} PRIVATE "bad_plugins_LIB=\"$\"") diff --git a/test/performance/CMakeLists.txt b/test/performance/CMakeLists.txt index a73bfddb..872a9539 100644 --- a/test/performance/CMakeLists.txt +++ b/test/performance/CMakeLists.txt @@ -4,4 +4,6 @@ set(tests) link_directories(${PROJECT_BINARY_DIR}/test) -gz_build_tests(TYPE PERFORMANCE SOURCES ${tests}) +gz_build_tests(TYPE PERFORMANCE + SOURCES ${tests} + ENVIRONMENT GZ_LAUNCH_INSTALL_PREFIX=${CMAKE_INSTALL_PREFIX}) diff --git a/test/regression/CMakeLists.txt b/test/regression/CMakeLists.txt index aac9ecda..1e94deee 100644 --- a/test/regression/CMakeLists.txt +++ b/test/regression/CMakeLists.txt @@ -5,4 +5,6 @@ set(tests link_directories(${PROJECT_BINARY_DIR}/test) -gz_build_tests(TYPE REGRESSION SOURCES ${tests}) +gz_build_tests(TYPE REGRESSION + SOURCES ${tests} + ENVIRONMENT GZ_LAUNCH_INSTALL_PREFIX=${CMAKE_INSTALL_PREFIX}) From 5938a17c8d0605c1b6547d2a23ec73cba2064032 Mon Sep 17 00:00:00 2001 From: "Addisu Z. Taddese" Date: Fri, 5 Apr 2024 11:55:46 -0500 Subject: [PATCH 08/12] Fix bug where address of local variable was returned (#252) Signed-off-by: Addisu Z. Taddese --- src/cmd/gz.cc | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/src/cmd/gz.cc b/src/cmd/gz.cc index cdd559c7..25109c9e 100644 --- a/src/cmd/gz.cc +++ b/src/cmd/gz.cc @@ -33,7 +33,7 @@ extern "C" char *gzVersion() extern "C" const char *configPath() { std::string configPath = gz::launch::getPluginInstallPath(); - return configPath.c_str(); + return strdup(configPath.c_str()); } ////////////////////////////////////////////////// From a3ea50d7325dc39bbf9df7cb7d559130e7a27364 Mon Sep 17 00:00:00 2001 From: "Addisu Z. Taddese" Date: Mon, 8 Apr 2024 18:47:19 -0500 Subject: [PATCH 09/12] Use relative install paths for plugin shared libraries and gz-tools data (#253) Signed-off-by: Addisu Z. Taddese --- plugins/joy_to_twist/CMakeLists.txt | 2 +- plugins/joystick/CMakeLists.txt | 2 +- plugins/sim_factory/CMakeLists.txt | 2 +- plugins/sim_gui/CMakeLists.txt | 2 +- plugins/sim_server/CMakeLists.txt | 2 +- plugins/websocket_server/CMakeLists.txt | 2 +- src/cmd/CMakeLists.txt | 4 ++-- 7 files changed, 8 insertions(+), 8 deletions(-) diff --git a/plugins/joy_to_twist/CMakeLists.txt b/plugins/joy_to_twist/CMakeLists.txt index ca374032..ff9c15ec 100644 --- a/plugins/joy_to_twist/CMakeLists.txt +++ b/plugins/joy_to_twist/CMakeLists.txt @@ -11,4 +11,4 @@ target_link_libraries(${plugin} gz-transport${GZ_TRANSPORT_VER}::core ) -install (TARGETS ${plugin} DESTINATION ${GZ_LAUNCH_PLUGIN_INSTALL_PATH}) +install (TARGETS ${plugin} DESTINATION ${GZ_LAUNCH_PLUGIN_RELATIVE_INSTALL_PATH}) diff --git a/plugins/joystick/CMakeLists.txt b/plugins/joystick/CMakeLists.txt index 71a3f359..e2a6ab41 100644 --- a/plugins/joystick/CMakeLists.txt +++ b/plugins/joystick/CMakeLists.txt @@ -11,4 +11,4 @@ target_link_libraries(${plugin} gz-plugin${GZ_PLUGIN_VER}::core ) -install (TARGETS ${plugin} DESTINATION ${GZ_LAUNCH_PLUGIN_INSTALL_PATH}) +install (TARGETS ${plugin} DESTINATION ${GZ_LAUNCH_PLUGIN_RELATIVE_INSTALL_PATH}) diff --git a/plugins/sim_factory/CMakeLists.txt b/plugins/sim_factory/CMakeLists.txt index e292621b..9c7d8eb8 100644 --- a/plugins/sim_factory/CMakeLists.txt +++ b/plugins/sim_factory/CMakeLists.txt @@ -13,4 +13,4 @@ target_link_libraries(${plugin_lower} gz-plugin${GZ_PLUGIN_VER}::core ) -install (TARGETS ${plugin} DESTINATION ${GZ_LAUNCH_PLUGIN_INSTALL_PATH}) +install (TARGETS ${plugin} DESTINATION ${GZ_LAUNCH_PLUGIN_RELATIVE_INSTALL_PATH}) diff --git a/plugins/sim_gui/CMakeLists.txt b/plugins/sim_gui/CMakeLists.txt index 76a16765..50732cf6 100644 --- a/plugins/sim_gui/CMakeLists.txt +++ b/plugins/sim_gui/CMakeLists.txt @@ -16,4 +16,4 @@ target_link_libraries(${plugin_lower} gz-plugin${GZ_PLUGIN_VER}::core ) -install (TARGETS ${plugin} DESTINATION ${GZ_LAUNCH_PLUGIN_INSTALL_PATH}) +install (TARGETS ${plugin} DESTINATION ${GZ_LAUNCH_PLUGIN_RELATIVE_INSTALL_PATH}) diff --git a/plugins/sim_server/CMakeLists.txt b/plugins/sim_server/CMakeLists.txt index f27edce3..1b7d77ff 100644 --- a/plugins/sim_server/CMakeLists.txt +++ b/plugins/sim_server/CMakeLists.txt @@ -13,4 +13,4 @@ target_link_libraries(${plugin_lower} gz-plugin${GZ_PLUGIN_VER}::core ) -install (TARGETS ${plugin} DESTINATION ${GZ_LAUNCH_PLUGIN_INSTALL_PATH}) +install (TARGETS ${plugin} DESTINATION ${GZ_LAUNCH_PLUGIN_RELATIVE_INSTALL_PATH}) diff --git a/plugins/websocket_server/CMakeLists.txt b/plugins/websocket_server/CMakeLists.txt index 8b32bd17..a751695c 100644 --- a/plugins/websocket_server/CMakeLists.txt +++ b/plugins/websocket_server/CMakeLists.txt @@ -25,5 +25,5 @@ if (websockets_FOUND) gz-transport${GZ_TRANSPORT_VER}::core ) - install (TARGETS ${plugin} DESTINATION ${GZ_LAUNCH_PLUGIN_INSTALL_PATH}) + install (TARGETS ${plugin} DESTINATION ${GZ_LAUNCH_PLUGIN_RELATIVE_INSTALL_PATH}) endif() diff --git a/src/cmd/CMakeLists.txt b/src/cmd/CMakeLists.txt index cfb3ad3d..461c6617 100644 --- a/src/cmd/CMakeLists.txt +++ b/src/cmd/CMakeLists.txt @@ -80,7 +80,7 @@ install( FILES ${CMAKE_CURRENT_BINARY_DIR}/launch${PROJECT_VERSION_MAJOR}.bash_completion.sh DESTINATION - ${CMAKE_INSTALL_PREFIX}/${CMAKE_INSTALL_DATAROOTDIR}/gz/gz${GZ_TOOLS_VER}.completion.d) + ${CMAKE_INSTALL_DATAROOTDIR}/gz/gz${GZ_TOOLS_VER}.completion.d) #=============================================================================== # Generate the ruby script for internal testing. @@ -151,7 +151,7 @@ configure_file( # Install the yaml configuration files in an unversioned location. install(FILES ${CMAKE_CURRENT_BINARY_DIR}/${GZ_DESIGNATION}${PROJECT_VERSION_MAJOR}.yaml -DESTINATION ${CMAKE_INSTALL_PREFIX}/${CMAKE_INSTALL_DATAROOTDIR}/gz/) +DESTINATION ${CMAKE_INSTALL_DATAROOTDIR}/gz/) # Install the ruby command line library in an unversioned location. install(FILES ${cmd_script_generated} DESTINATION lib/ruby/gz) From 1317511d365d1b2c312c86f9062b8a4b7bfdc132 Mon Sep 17 00:00:00 2001 From: "Addisu Z. Taddese" Date: Thu, 11 Apr 2024 12:47:22 -0500 Subject: [PATCH 10/12] Prepare for 7.1.0 (#254) Signed-off-by: Addisu Z. Taddese --- CMakeLists.txt | 2 +- Changelog.md | 21 +++++++++++++++++++++ 2 files changed, 22 insertions(+), 1 deletion(-) diff --git a/CMakeLists.txt b/CMakeLists.txt index a9b82c0b..a6e0a3b8 100644 --- a/CMakeLists.txt +++ b/CMakeLists.txt @@ -3,7 +3,7 @@ cmake_minimum_required(VERSION 3.5.1 FATAL_ERROR) #============================================================================ # Initialize the project #============================================================================ -project(gz-launch7 VERSION 7.0.0) +project(gz-launch7 VERSION 7.1.0) #============================================================================ # Find gz-cmake diff --git a/Changelog.md b/Changelog.md index 11d4a593..fb5787af 100644 --- a/Changelog.md +++ b/Changelog.md @@ -1,5 +1,26 @@ ## Gazebo Launch 7.x +### Gazebo Launch 7.1.0 (2024-04-11) + +1. Use relative install paths for plugin shared libraries and gz-tools data + * [Pull request #253](https://github.com/gazebosim/gz-launch/pull/253) + +1. Fix bug where address of local variable was returned + * [Pull request #252](https://github.com/gazebosim/gz-launch/pull/252) + +1. Add optional binary relocatability + * [Pull request #218](https://github.com/gazebosim/gz-launch/pull/218) + +1. Fix windows warnings + * [Pull request #199](https://github.com/gazebosim/gz-launch/pull/199) + * [Pull request #250](https://github.com/gazebosim/gz-launch/pull/250) + +1. Update CI badges in README + * [Pull request #239](https://github.com/gazebosim/gz-launch/pull/239) + +1. Infrastructure + * [Pull request #238](https://github.com/gazebosim/gz-launch/pull/238) + ### Gazebo Launch 7.0.0 (2023-09-29) 1. Documentation fixes From 6459072643c2c37fc37afaf99c574e5411306ede Mon Sep 17 00:00:00 2001 From: "Addisu Z. Taddese" Date: Tue, 30 Apr 2024 21:32:27 -0500 Subject: [PATCH 11/12] Add package.xml, remove dependency on python3-yaml, and disable failing windows tests (#249) Signed-off-by: Addisu Z. Taddese --- .github/ci/packages.apt | 1 - .github/workflows/package_xml.yml | 11 ++++++++ package.xml | 42 +++++++++++++++++++++++++++++++ src/Manager_TEST.cc | 6 ++--- 4 files changed, 56 insertions(+), 4 deletions(-) create mode 100644 .github/workflows/package_xml.yml create mode 100644 package.xml diff --git a/.github/ci/packages.apt b/.github/ci/packages.apt index 4edbd19d..8ea6d0b6 100644 --- a/.github/ci/packages.apt +++ b/.github/ci/packages.apt @@ -20,6 +20,5 @@ libwebsockets-dev libxi-dev libxmu-dev libyaml-dev -python3-yaml uuid-dev xvfb diff --git a/.github/workflows/package_xml.yml b/.github/workflows/package_xml.yml new file mode 100644 index 00000000..4bd4a9aa --- /dev/null +++ b/.github/workflows/package_xml.yml @@ -0,0 +1,11 @@ +name: Validate package.xml + +on: + pull_request: + +jobs: + package-xml: + runs-on: ubuntu-latest + name: Validate package.xml + steps: + - uses: gazebo-tooling/action-gz-ci/validate_package_xml@jammy diff --git a/package.xml b/package.xml new file mode 100644 index 00000000..bb45074e --- /dev/null +++ b/package.xml @@ -0,0 +1,42 @@ + + + + gz-launch7 + 7.1.0 + Gazebo Launch : Run and manage programs and plugins + Nate Koenig + Apache License 2.0 + https://github.com/gazebosim/gz-launch + + cmake + + binutils + gz-cmake3 + gz-common5 + gz-fuel-tools9 + gz-gui8 + gz-math7 + gz-msgs10 + gz-physics7 + gz-plugin2 + gz-rendering8 + gz-sensors8 + gz-sim8 + gz-tools2 + gz-transport13 + libgflags-dev + libwebsockets-dev + libxi-dev + libxmu-dev + libyaml-dev + sdformat14 + tinyxml2 + uuid + + xvfb + + + cmake + + + diff --git a/src/Manager_TEST.cc b/src/Manager_TEST.cc index 0a8ed9ba..d50ba964 100644 --- a/src/Manager_TEST.cc +++ b/src/Manager_TEST.cc @@ -112,7 +112,7 @@ TEST_F(ManagerTest, RunBadXml) } ///////////////////////////////////////////////// -TEST_F(ManagerTest, RunLs) +TEST_F(ManagerTest, GZ_UTILS_TEST_DISABLED_ON_WIN32(RunLs)) { std::string cmd; @@ -137,7 +137,7 @@ TEST_F(ManagerTest, RunLs) } ///////////////////////////////////////////////// -TEST_F(ManagerTest, RunEnvPre) +TEST_F(ManagerTest, GZ_UTILS_TEST_DISABLED_ON_WIN32(RunEnvPre)) { // Test that environment is applied regardless of order #ifndef _WIN32 @@ -175,7 +175,7 @@ TEST_F(ManagerTest, RunEnvPre) } ///////////////////////////////////////////////// -TEST_F(ManagerTest, RunEnvPost) +TEST_F(ManagerTest, GZ_UTILS_TEST_DISABLED_ON_WIN32(RunEnvPost)) { // Test that environment is applied regardless of order #ifndef _WIN32 From 668374441cee798afc4ce2d59855df2400ef0784 Mon Sep 17 00:00:00 2001 From: Crola1702 Date: Fri, 24 May 2024 11:56:11 -0500 Subject: [PATCH 12/12] Update package versions Signed-off-by: Crola1702 --- package.xml | 20 ++++++++++---------- 1 file changed, 10 insertions(+), 10 deletions(-) diff --git a/package.xml b/package.xml index bb45074e..361208a1 100644 --- a/package.xml +++ b/package.xml @@ -1,8 +1,8 @@ - gz-launch7 - 7.1.0 + gz-launch8 + 8.0.0 Gazebo Launch : Run and manage programs and plugins Nate Koenig Apache License 2.0 @@ -11,19 +11,19 @@ cmake binutils - gz-cmake3 - gz-common5 + gz-cmake4 + gz-common6 gz-fuel-tools9 - gz-gui8 - gz-math7 - gz-msgs10 + gz-gui9 + gz-math8 + gz-msgs11 gz-physics7 - gz-plugin2 + gz-plugin3 gz-rendering8 gz-sensors8 - gz-sim8 + gz-sim9 gz-tools2 - gz-transport13 + gz-transport14 libgflags-dev libwebsockets-dev libxi-dev