Skip to content

Commit

Permalink
cfg dep detection
Browse files Browse the repository at this point in the history
  • Loading branch information
stelzo committed May 20, 2024
1 parent 67a5879 commit 3437f26
Show file tree
Hide file tree
Showing 10 changed files with 13 additions and 18 deletions.
2 changes: 1 addition & 1 deletion .github/workflows/r2r_galactic.yml
Original file line number Diff line number Diff line change
Expand Up @@ -18,4 +18,4 @@ jobs:
steps:
- uses: actions/checkout@v2
- run: docker build . --file ./rpcl2/tests/Dockerfile_r2r_galactic --tag r2r_galactic
- run: docker run r2r_galactic cargo test --features r2r_msg,derive,nalgebra,rayon
- run: docker run r2r_galactic cargo test
2 changes: 1 addition & 1 deletion .github/workflows/r2r_humble.yml
Original file line number Diff line number Diff line change
Expand Up @@ -18,4 +18,4 @@ jobs:
steps:
- uses: actions/checkout@v2
- run: docker build . --file ./rpcl2/tests/Dockerfile_r2r_humble --tag r2r_humble
- run: docker run r2r_humble cargo test --features r2r_msg,derive,nalgebra,rayon
- run: docker run r2r_humble cargo test
2 changes: 1 addition & 1 deletion .github/workflows/r2r_iron.yml
Original file line number Diff line number Diff line change
Expand Up @@ -18,4 +18,4 @@ jobs:
steps:
- uses: actions/checkout@v2
- run: docker build . --file ./rpcl2/tests/Dockerfile_r2r_iron --tag r2r_iron
- run: docker run r2r_iron cargo test --features r2r_msg,derive,nalgebra,rayon
- run: docker run r2r_iron cargo test
2 changes: 1 addition & 1 deletion .github/workflows/rclrs_humble.yml
Original file line number Diff line number Diff line change
Expand Up @@ -18,4 +18,4 @@ jobs:
steps:
- uses: actions/checkout@v2
- run: docker build . --file ./rpcl2/tests/Dockerfile_rclrs_humble --tag rclrs_humble
- run: docker run rclrs_humble cargo test --features derive,nalgebra,rayon
- run: docker run rclrs_humble cargo test
2 changes: 1 addition & 1 deletion .github/workflows/rclrs_iron.yml
Original file line number Diff line number Diff line change
Expand Up @@ -18,4 +18,4 @@ jobs:
steps:
- uses: actions/checkout@v2
- run: docker build . --file ./rpcl2/tests/Dockerfile_rclrs_iron --tag rclrs_iron
- run: docker run rclrs_iron cargo test --features derive,nalgebra,rayon
- run: docker run rclrs_iron cargo test
2 changes: 1 addition & 1 deletion .github/workflows/rosrust_noetic.yml
Original file line number Diff line number Diff line change
Expand Up @@ -105,4 +105,4 @@ jobs:
- name: test
run: |
source /opt/ros/$ROS_DISTRO/setup.bash
cargo test --features rosrust_msg,derive,nalgebra,rayon
cargo test
5 changes: 0 additions & 5 deletions rpcl2/Cargo.toml
Original file line number Diff line number Diff line change
Expand Up @@ -31,9 +31,6 @@ exclude = [
rust-version = "1.63"

[dependencies]
rosrust_msg = { version = "0.1", optional = true }
rosrust = { version = "0.9.11", optional = true }
r2r = { version = "0.9.0", optional = true }
rayon = { version = "1", optional = true }
nalgebra = { version = "0.32.5", optional = true, default-features = false }
rpcl2-derive = { version = "0.2.0", optional = true, path = "../rpcl2-derive" }
Expand All @@ -49,8 +46,6 @@ harness = false
path = "benches/roundtrip.rs"

[features]
rosrust_msg = ["dep:rosrust_msg", "dep:rosrust"]
r2r_msg = ["dep:r2r"]
rayon = ["dep:rayon"]
derive = ["dep:rpcl2-derive", "dep:memoffset"]
nalgebra = ["dep:nalgebra"]
Expand Down
10 changes: 5 additions & 5 deletions rpcl2/src/ros.rs
Original file line number Diff line number Diff line change
Expand Up @@ -32,7 +32,7 @@ pub struct TimeMsg {
pub nanosec: u32,
}

#[cfg(feature = "rosrust_msg")]
#[cfg(rosrust)]
impl From<rosrust::Time> for TimeMsg {
fn from(time: rosrust::Time) -> Self {
Self {
Expand Down Expand Up @@ -70,7 +70,7 @@ impl Default for PointFieldMsg {
}
}

#[cfg(feature = "r2r_msg")]
#[cfg(r2r)]
impl From<r2r::sensor_msgs::msg::PointCloud2> for crate::PointCloud2Msg {
fn from(msg: r2r::sensor_msgs::msg::PointCloud2) -> Self {
Self {
Expand Down Expand Up @@ -113,7 +113,7 @@ impl From<r2r::sensor_msgs::msg::PointCloud2> for crate::PointCloud2Msg {
}
}

#[cfg(feature = "r2r_msg")]
#[cfg(r2r)]
impl From<crate::PointCloud2Msg> for r2r::sensor_msgs::msg::PointCloud2 {
fn from(msg: crate::PointCloud2Msg) -> Self {
r2r::sensor_msgs::msg::PointCloud2 {
Expand Down Expand Up @@ -151,7 +151,7 @@ impl From<crate::PointCloud2Msg> for r2r::sensor_msgs::msg::PointCloud2 {
}
}

#[cfg(feature = "rosrust_msg")]
#[cfg(rosrust)]
impl From<rosrust_msg::sensor_msgs::PointCloud2> for crate::PointCloud2Msg {
fn from(msg: rosrust_msg::sensor_msgs::PointCloud2) -> Self {
Self {
Expand Down Expand Up @@ -194,7 +194,7 @@ impl From<rosrust_msg::sensor_msgs::PointCloud2> for crate::PointCloud2Msg {
}
}

#[cfg(feature = "rosrust_msg")]
#[cfg(rosrust)]
impl From<crate::PointCloud2Msg> for rosrust_msg::sensor_msgs::PointCloud2 {
fn from(msg: crate::PointCloud2Msg) -> Self {
rosrust_msg::sensor_msgs::PointCloud2 {
Expand Down
2 changes: 1 addition & 1 deletion rpcl2/tests/r2r_msg_test.rs
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
#[cfg(feature = "r2r_msg")]
#[cfg(r2r)]
#[test]
fn convertxyz_r2r_msg() {
use ros_pointcloud2::{points::PointXYZ, PointCloud2Msg};
Expand Down
2 changes: 1 addition & 1 deletion rpcl2/tests/rosrust_msg_test.rs
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
#[cfg(feature = "rosrust_msg")]
#[cfg(rosrust)]
#[test]
fn convertxyz_rosrust_msg() {
use ros_pointcloud2::{points::PointXYZ, PointCloud2Msg};
Expand Down

0 comments on commit 3437f26

Please sign in to comment.