Skip to content
Open
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
3 changes: 2 additions & 1 deletion .gitignore
Original file line number Diff line number Diff line change
Expand Up @@ -54,6 +54,7 @@
*.toml
*.ubjson
*.xml
!package.xml
*.yml
*.yaml

Expand Down Expand Up @@ -94,4 +95,4 @@ share/python-wheels/
MANIFEST

# Docs
site/
site/
6 changes: 6 additions & 0 deletions CMakeLists.txt
Original file line number Diff line number Diff line change
Expand Up @@ -143,6 +143,8 @@ endif ()

project(reflectcpp VERSION 0.23.0 LANGUAGES CXX)

find_package(ament_cmake QUIET)

if (PROJECT_IS_TOP_LEVEL)
set(REFLECTCPP_INSTALL ON)
endif()
Expand Down Expand Up @@ -508,3 +510,7 @@ set(CPACK_RPM_PACKAGE_REQUIRES "")

include(CPack)

if (ament_cmake_FOUND)
ament_package()
endif()

39 changes: 39 additions & 0 deletions docs/install.md
Original file line number Diff line number Diff line change
Expand Up @@ -128,3 +128,42 @@ If you want to include all formats supported on Conan, do the following:
```bash
conan build . --build=missing -s compiler.cppstd=gnu20 -o *:with_cbor=True -o *:with_flatbuffers=True -o *:with_msgpack=True -o *:with_toml=True -o *:with_ubjson=True -o *:with_xml=True -o *:with_yaml=True
```

## Option 7: Integrate as a ROS2 package

reflect-cpp now ships with an `ament_cmake` package manifest so it can be
built directly in a ROS 2 workspace and consumed like any other
CMake-config package.

1. Fetch the sources with `vcs` using the `.repos` file from the
[tea-ros2](https://github.com/getml/tea-ros2) workspace, which already
tracks `reflect-cpp`:

```bash
mkdir -p ~/ros2_ws/src
cd ~/ros2_ws
# adding the entry to your vcs .repos file, or create one
# reflect-cpp:
# type: git
# url: git@github.com:getml/reflect-cpp.git
# version: main

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

high

Pinning the dependency to the main branch is not recommended for production use as it can lead to non-reproducible builds. It's better practice to pin to a specific release tag (e.g., v0.23.0) or a specific commit hash to ensure build stability.

Suggested change
# version: main
# version: v0.23.0

vcs import src < src/.repos
```

2. Build the package with `colcon` (package name: `reflectcpp`). The build
enables installation automatically when invoked from an ament workspace:

```bash
colcon build --packages-select reflectcpp
```

3. Link against reflect-cpp from your ROS 2 package via the exported CMake
config.

```cmake
find_package(reflectcpp REQUIRED)
target_link_libraries(${PROJECT_NAME} reflectcpp::reflectcpp)
```

This makes the `reflectcpp::reflectcpp` target available to your nodes
while keeping the ROS build flow unchanged.
15 changes: 15 additions & 0 deletions package.xml
Original file line number Diff line number Diff line change
@@ -0,0 +1,15 @@
<?xml version="1.0"?>
<?xml-model href="http://download.ros.org/schema/package_format3.xsd" schematypens="http://www.w3.org/2001/XMLSchema"?>
<package format="3">
<name>reflectcpp</name>
<version>0.23.0</version>
<description>C++ reflection library</description>
<maintainer email="liuzicheng1987@example.com">liuzicheng1987</maintainer>

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

medium

The maintainer email liuzicheng1987@example.com appears to be a placeholder. Please replace it with a valid contact email for the package maintainer.

<license>MIT</license>

<buildtool_depend>ament_cmake</buildtool_depend>

<export>
<build_type>ament_cmake</build_type>
</export>
</package>
Loading