Skip to content

Commit f28835e

Browse files
committed
Improve library finding + custom profile name + updated readme
Improves library finding by pretending to compile a c file (dummy.c must exist). Now that rust-lang/cargo#6988 is in stable, use "colcon" as a custom profile name. Closes #2. Use of IDL_PACKAGE_FILTER exemplified in README.md. Closes #3
1 parent f15e51f commit f28835e

File tree

7 files changed

+102
-86
lines changed

7 files changed

+102
-86
lines changed

.gitignore

Lines changed: 5 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1 +1,6 @@
11
r2r_minimal_node/target
2+
3+
# colcon stuff
4+
build/
5+
install/
6+
log/

README.md

Lines changed: 4 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -24,10 +24,14 @@ cargo clean can be invoked by passing `-DCARGO_CLEAN=ON` to cmake, eg.
2424
colcon build --cmake-args -DCARGO_CLEAN=ON
2525
```
2626

27+
To keep builds performed by colcon separate, `r2r_cargo` *expects a custom profile called `colcon` to exist*. See <https://github.com/m-dahl/r2r_minimal_node/blob/master/r2r_minimal_node/Cargo.toml> for an example.
28+
2729
## Building using only cargo
2830

2931
Another option is to build the message package first, then sourcing the resulting workspace. When `r2r_minimal_node_msgs` is sourced, the r2r build script will automatically pick up the custom messages (it defaults to building everything).
3032

33+
To avoid building everything, it is possible to declare only the messages needed using the environment variable `IDL_PACKAGE_FILTER`. Setting this can be done in `.cargo/config.toml` for convenience, e.g. <https://github.com/m-dahl/r2r_minimal_node/blob/master/r2r_minimal_node/.cargo/config.toml>
34+
3135
``` sh
3236
mkdir src
3337
cd src

r2r_minimal_node/CMakeLists.txt

Lines changed: 1 addition & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -14,13 +14,11 @@ r2r_cargo(std_msgs # just to test that it works
1414
rcl # we need the c ros2 api
1515
rcl_action # as of r2r 0.1.0, we also need the action api
1616
r2r_minimal_node_msgs # our custom message types
17-
rmw_fastrtps_cpp # (needed to build with RMW_IMPLEMENTATION=rmw_fastrtps_cpp)
18-
FastRTPS # (needed to build with RMW_IMPLEMENTATION=rmw_fastrtps_cpp)
1917
)
2018

2119
# install binaries
2220
install(PROGRAMS
23-
${CMAKE_SOURCE_DIR}/target/release/${PROJECT_NAME}
21+
${CMAKE_SOURCE_DIR}/target/colcon/${PROJECT_NAME}
2422
DESTINATION lib/${PROJECT_NAME}
2523
)
2624

r2r_minimal_node/Cargo.lock

Lines changed: 50 additions & 50 deletions
Some generated files are not rendered by default. Learn more about customizing how changed files appear on GitHub.

r2r_minimal_node/Cargo.toml

Lines changed: 6 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -4,7 +4,12 @@ version = "0.1.0"
44
authors = ["Martin Dahl <[email protected]>"]
55
edition = "2021"
66

7+
# We use a custom profile to keep colcon
8+
# separate from "normal" rust building.
9+
[profile.colcon]
10+
inherits = "release"
11+
712
[dependencies]
8-
r2r = "0.6.3"
13+
r2r = "0.6.4"
914
futures = "0.3.15"
1015
tokio = { version = "1", features = ["full"] }

r2r_minimal_node/dummy.c

Whitespace-only changes.

0 commit comments

Comments
 (0)