Skip to content

Commit f91ccf4

Browse files
committed
doc: ros2 install instruction
1 parent ea26397 commit f91ccf4

1 file changed

Lines changed: 39 additions & 0 deletions

File tree

docs/install.md

Lines changed: 39 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -128,3 +128,42 @@ If you want to include all formats supported on Conan, do the following:
128128
```bash
129129
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
130130
```
131+
132+
## Option 7: Integrate as a ROS2 package
133+
134+
reflect-cpp now ships with an `ament_cmake` package manifest so it can be
135+
built directly in a ROS 2 workspace and consumed like any other
136+
CMake-config package.
137+
138+
1. Fetch the sources with `vcs` using the `.repos` file from the
139+
[tea-ros2](https://github.com/getml/tea-ros2) workspace, which already
140+
tracks `reflect-cpp`:
141+
142+
```bash
143+
mkdir -p ~/ros2_ws/src
144+
cd ~/ros2_ws
145+
# adding the entry to your vcs .repos file, or create one
146+
# reflect-cpp:
147+
# type: git
148+
# url: git@github.com:getml/reflect-cpp.git
149+
# version: main
150+
vcs import src < src/.repos
151+
```
152+
153+
2. Build the package with `colcon` (package name: `reflect_cpp`). The build
154+
enables installation automatically when invoked from an ament workspace:
155+
156+
```bash
157+
colcon build --packages-select reflect_cpp
158+
```
159+
160+
3. Link against reflect-cpp from your ROS 2 package via the exported CMake
161+
config.
162+
163+
```cmake
164+
find_package(reflectcpp REQUIRED)
165+
target_link_libraries(${PROJECT_NAME} reflectcpp::reflectcpp)
166+
```
167+
168+
This makes the `reflectcpp::reflectcpp` target available to your nodes
169+
while keeping the ROS build flow unchanged.

0 commit comments

Comments
 (0)