Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
4 changes: 2 additions & 2 deletions .github/ci/packages.apt
Original file line number Diff line number Diff line change
@@ -1,3 +1,3 @@
libgz-cmake4-dev
libgz-cmake5-dev
libgz-tools2-dev
libgz-utils3-cli-dev
libgz-utils4-cli-dev
12 changes: 1 addition & 11 deletions .github/workflows/ci.yml
Original file line number Diff line number Diff line change
Expand Up @@ -9,17 +9,6 @@ on:
- 'main'

jobs:
jammy-ci:
runs-on: ubuntu-latest
name: Ubuntu Jammy CI
steps:
- name: Checkout
uses: actions/checkout@v4
- name: Compile and test
id: ci
uses: gazebo-tooling/action-gz-ci@jammy
with:
codecov-enabled: true
noble-ci:
runs-on: ubuntu-latest
name: Ubuntu Noble CI
Expand All @@ -30,6 +19,7 @@ jobs:
id: ci
uses: gazebo-tooling/action-gz-ci@noble
with:
# codecov-enabled: true
cppcheck-enabled: true
cpplint-enabled: true
doxygen-enabled: true
8 changes: 3 additions & 5 deletions CMakeLists.txt
Original file line number Diff line number Diff line change
Expand Up @@ -3,13 +3,12 @@ cmake_minimum_required(VERSION 3.22.1 FATAL_ERROR)
#============================================================================
# Initialize the project
#============================================================================
project(gz-plugin4 VERSION 4.0.0)
project(gz-plugin VERSION 4.0.0)

#============================================================================
# Find gz-cmake
#============================================================================
find_package(gz-cmake4 REQUIRED)
set(GZ_CMAKE_VER ${gz-cmake4_VERSION_MAJOR})
find_package(gz-cmake REQUIRED)

#============================================================================
# Configure the project
Expand Down Expand Up @@ -49,8 +48,7 @@ set(GZ_TOOLS_VER 2)

#--------------------------------------
# Find gz-utils
gz_find_package(gz-utils3 REQUIRED COMPONENTS cli)
set(GZ_UTILS_VER ${gz-utils3_VERSION_MAJOR})
gz_find_package(gz-utils REQUIRED COMPONENTS cli)

#============================================================================
# Configure the build
Expand Down
10 changes: 5 additions & 5 deletions MigrationFromCommon.md
Original file line number Diff line number Diff line change
Expand Up @@ -11,15 +11,15 @@ framework. Some of the instructions here may also be useful to new adopters of
just wants to use `PluginPtr` objects can link to `core`, e.g.:

```
target_link_libraries(my_target PUBLIC gz-plugin3::core)
target_link_libraries(my_target PUBLIC gz-plugin::core)
```

However, if your code wants to be able to load plugins, it should link to the
`loader` component. In most cases, it should probably link privately, unless you
need the `gz::plugin::Loader` class to be part of your library's API:

```
target_link_libraries(my_target PRIVATE gz-plugin3::loader)
target_link_libraries(my_target PRIVATE gz-plugin::loader)
```

If `gz::plugin::PluginPtr` objects are part of your library's API, then
Expand All @@ -28,9 +28,9 @@ you may want `loader` to be private while `core` is public:
```
target_link_libraries(my_target
PUBLIC
gz-plugin3::core
gz-plugin::core
PRIVATE
gz-plugin3::loader
gz-plugin::loader
)
```

Expand All @@ -39,7 +39,7 @@ then you should link against the `register` component. This should almost always
be a private link, since plugin registration is purely internal for a library:

```
target_link_libraries(my_plugin PRIVATE gz-plugin3::register)
target_link_libraries(my_plugin PRIVATE gz-plugin::register)
```

# Registering a plugin
Expand Down
2 changes: 1 addition & 1 deletion core/CMakeLists.txt
Original file line number Diff line number Diff line change
Expand Up @@ -8,7 +8,7 @@ gz_create_core_library(
)

target_link_libraries(${PROJECT_LIBRARY_TARGET_NAME}
PUBLIC gz-utils${GZ_UTILS_VER}::gz-utils${GZ_UTILS_VER})
PUBLIC gz-utils::gz-utils)

# Build the unit tests
gz_build_tests(
Expand Down
15 changes: 6 additions & 9 deletions examples/CMakeLists.txt
Original file line number Diff line number Diff line change
Expand Up @@ -2,14 +2,11 @@ cmake_minimum_required(VERSION 3.22.1 FATAL_ERROR)

project(examples)

find_package(gz-plugin4 QUIET REQUIRED COMPONENTS all)
set(GZ_PLUGIN_VER ${gz-plugin4_VERSION_MAJOR})
find_package(gz-plugin QUIET REQUIRED COMPONENTS all)

find_package(gz-common6 QUIET)
set(GZ_COMMON_VER ${gz-common6_VERSION_MAJOR})
find_package(gz-common QUIET)

find_package(gz-math8 QUIET)
set(GZ_MATH_VER ${gz-math8_VERSION_MAJOR})
find_package(gz-math QUIET)

add_subdirectory(plugins)

Expand All @@ -30,9 +27,9 @@ foreach(example_file ${example_files})

target_link_libraries(${example}
PRIVATE
gz-plugin${GZ_PLUGIN_VER}::loader
gz-common${GZ_COMMON_VER}::core
gz-math${GZ_MATH_VER}::core
gz-plugin::loader
gz-common::core
gz-math::core
)

# This is only needed for the examples that use plugins, but it doesn't hurt
Expand Down
4 changes: 2 additions & 2 deletions examples/plugins/CMakeLists.txt
Original file line number Diff line number Diff line change
Expand Up @@ -13,8 +13,8 @@ foreach(plugin_file ${plugin_files})

target_link_libraries(${plugin}
PRIVATE
gz-plugin${GZ_PLUGIN_VER}::register
gz-math${GZ_MATH_VER}::core)
gz-plugin::register
gz-math::core)

# All these libraries will go into the same directory, so it's sufficient for
# us to grab the last one.
Expand Down
10 changes: 8 additions & 2 deletions loader/src/cmd/CMakeLists.txt
Original file line number Diff line number Diff line change
Expand Up @@ -4,11 +4,17 @@ target_link_libraries(gz PUBLIC
${PROJECT_LIBRARY_TARGET_NAME}
)

set(plugin_executable gz-plugin)
# Define the desired output name of the executable
set(plugin_executable_output_name gz-plugin)
# Append "-exe" to cmake target name to differ from the library target name
set(plugin_executable gz-plugin-exe)
add_executable(${plugin_executable} plugin_main.cc)
set_target_properties(${plugin_executable}
PROPERTIES OUTPUT_NAME ${plugin_executable_output_name})

target_link_libraries(${plugin_executable}
gz
gz-utils${GZ_UTILS_VER}::cli
gz-utils::cli
${loader}
)

Expand Down
40 changes: 27 additions & 13 deletions loader/src/gz_TEST.cc
Original file line number Diff line number Diff line change
Expand Up @@ -57,27 +57,41 @@ std::string custom_exec_str(std::string _cmd)
return result;
}

//////////////////////////////////////////////////
/// \brief Verify that two substrings are found within a larger string,
/// separated only by spaces
void verifySpaceSeparatedSubstrings(const std::string &_stringToSearch,
const std::string &_substring1,
const std::string &_substring2)
{
auto iterator1 = _stringToSearch.find(_substring1);
EXPECT_NE(std::string::npos, iterator1)
<< " failed to find \"" << _substring1 << "\" in:\n" << _stringToSearch;
ASSERT_LE(iterator1 + _substring1.size(), _stringToSearch.size());
auto iterator2 =
_stringToSearch.find_first_not_of(' ', iterator1 + _substring1.size());
EXPECT_NE(std::string::npos, iterator2);
ASSERT_LE(iterator2 + _substring2.size(), _stringToSearch.size());
EXPECT_EQ(_substring2, _stringToSearch.substr(iterator2, _substring2.size()));
}

//////////////////////////////////////////////////
/// \brief Check 'gz plugin --help'.
TEST(gzTest, IgnPluginHelp)
TEST(gzTest, GzPluginHelp)
{
// Path to gz executable
std::string gz = std::string(GZ_PATH);
std::string output = custom_exec_str(gz + " plugin --help");
EXPECT_NE(std::string::npos,
output.find("-i [--info] Get info about a plugin."))
<< output;
EXPECT_NE(std::string::npos,
output.find("-p [--plugin] TEXT Path to a plugin."))
<< output;
verifySpaceSeparatedSubstrings(
output, "-i [--info]", "Get info about a plugin.");
verifySpaceSeparatedSubstrings(
output, "-p [--plugin] TEXT", "Path to a plugin.");

output = custom_exec_str(gz + " plugin");
EXPECT_NE(std::string::npos,
output.find("-i [--info] Get info about a plugin."))
<< output;
EXPECT_NE(std::string::npos,
output.find("-p [--plugin] TEXT Path to a plugin."))
<< output;
verifySpaceSeparatedSubstrings(
output, "-i [--info]", "Get info about a plugin.");
verifySpaceSeparatedSubstrings(
output, "-p [--plugin] TEXT", "Path to a plugin.");
}

//////////////////////////////////////////////////
Expand Down
6 changes: 3 additions & 3 deletions package.xml
Original file line number Diff line number Diff line change
@@ -1,7 +1,7 @@
<?xml version="1.0"?>
<?xml-model href="http://download.ros.org/schema/package_format2.xsd" schematypens="http://www.w3.org/2001/XMLSchema"?>
<package format="2">
<name>gz-plugin4</name>
<name>gz-plugin</name>
<version>4.0.0</version>
<description>Gazebo Plugin : Cross-platform C++ library for dynamically loading plugins.</description>
<maintainer email="ahcorde@gmail.com">Alejandro Hernández Cordero</maintainer>
Expand All @@ -10,10 +10,10 @@

<buildtool_depend>cmake</buildtool_depend>

<build_depend>gz-cmake4</build_depend>
<build_depend>gz-cmake</build_depend>

<depend>gz-tools2</depend>
<depend>gz-utils3</depend>
<depend>gz-utils</depend>

<export>
<build_type>cmake</build_type>
Expand Down
2 changes: 1 addition & 1 deletion tutorials/02_installation.md
Original file line number Diff line number Diff line change
Expand Up @@ -42,7 +42,7 @@ sudo apt install libgz-plugin4-dev

1. Install Gazebo dependencies
```
sudo apt-get install libgz-cmake4-dev libgz-tools2-dev libgz-utils3-cli-dev
sudo apt-get install libgz-cmake5-dev libgz-tools2-dev libgz-utils4-cli-dev
```

1. Install Gazebo Tools if you want to use the `gz plugin` command line tool:
Expand Down