diff --git a/.github/ci/packages.apt b/.github/ci/packages.apt index 2477dfd1..bc55e5e8 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/ci.yml b/.github/workflows/ci.yml index d8baec81..83509df2 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: jammy-ci: @@ -8,7 +14,7 @@ jobs: name: Ubuntu Jammy CI steps: - name: Checkout - uses: actions/checkout@v3 + uses: actions/checkout@v4 - name: Compile and test id: ci uses: gazebo-tooling/action-gz-ci@jammy 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/.github/workflows/triage.yml b/.github/workflows/triage.yml index 2c94852d..2332244b 100644 --- a/.github/workflows/triage.yml +++ b/.github/workflows/triage.yml @@ -14,4 +14,3 @@ jobs: with: project-url: https://github.com/orgs/gazebosim/projects/7 github-token: ${{ secrets.TRIAGE_TOKEN }} - diff --git a/CMakeLists.txt b/CMakeLists.txt index b832ff74..eec03b78 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/Changelog.md b/Changelog.md index fcd22b04..45fa6ca3 100644 --- a/Changelog.md +++ b/Changelog.md @@ -4,6 +4,27 @@ ## 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 @@ -84,6 +105,29 @@ ## 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 @@ -235,6 +279,16 @@ ## 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 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. 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 192b3507..7a86b287 100644 --- a/include/gz/launch/config.hh.in +++ b/include/gz/launch/config.hh.in @@ -31,8 +31,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/package.xml b/package.xml new file mode 100644 index 00000000..361208a1 --- /dev/null +++ b/package.xml @@ -0,0 +1,42 @@ + + + + gz-launch8 + 8.0.0 + Gazebo Launch : Run and manage programs and plugins + Nate Koenig + Apache License 2.0 + https://github.com/gazebosim/gz-launch + + cmake + + binutils + gz-cmake4 + gz-common6 + gz-fuel-tools9 + gz-gui9 + gz-math8 + gz-msgs11 + gz-physics7 + gz-plugin3 + gz-rendering8 + gz-sensors8 + gz-sim9 + gz-tools2 + gz-transport14 + libgflags-dev + libwebsockets-dev + libxi-dev + libxmu-dev + libyaml-dev + sdformat14 + tinyxml2 + uuid + + xvfb + + + cmake + + + 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/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/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/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 42f51e1b..5ff73c00 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" @@ -381,7 +382,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]); } @@ -1083,7 +1084,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/Manager.hh b/src/Manager.hh index 83b89744..10808941 100644 --- a/src/Manager.hh +++ b/src/Manager.hh @@ -20,7 +20,7 @@ #include #include -// #include +#include #include #include @@ -53,9 +53,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/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 diff --git a/src/cmd/CMakeLists.txt b/src/cmd/CMakeLists.txt index a72159ba..a3ca3072 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) @@ -79,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. @@ -150,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) diff --git a/src/cmd/gz.cc b/src/cmd/gz.cc index d770541b..25109c9e 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 strdup(configPath.c_str()); } ////////////////////////////////////////////////// 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 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})