Skip to content

Commit

Permalink
Extensions to get working
Browse files Browse the repository at this point in the history
  • Loading branch information
carter committed Nov 8, 2023
1 parent db7d7e9 commit e4b251b
Show file tree
Hide file tree
Showing 4 changed files with 26 additions and 15 deletions.
5 changes: 3 additions & 2 deletions rclrs/Cargo.toml
Original file line number Diff line number Diff line change
Expand Up @@ -34,8 +34,9 @@ bindgen = "0.66.1"

[features]
dyn_msg = ["ament_rs", "libloading"]
generate_docs = []
# This feature is solely for the purpose of being able to generate documetation without a ROS installation
# The only intended usage of this feature is for docs.rs builders to work.
generate_docs = ["rosidl_runtime_rs/generate_docs"]

[package.metadata.docs.rs]

features = ["generate_docs"]
18 changes: 9 additions & 9 deletions rclrs/src/rcl_bindings.rs
Original file line number Diff line number Diff line change
Expand Up @@ -130,18 +130,18 @@ cfg_if::cfg_if! {
pub fn rcl_context_is_valid(context: *const rcl_context_t) -> bool;
}
} else {
#![allow(dead_code)]
#![allow(deref_nullptr)]
#![allow(non_upper_case_globals)]
#![allow(non_camel_case_types)]
#![allow(non_snake_case)]
#[allow(dead_code)]
#[allow(deref_nullptr)]
#[allow(non_upper_case_globals)]
#[allow(non_camel_case_types)]
#[allow(non_snake_case)]
// Added to avoid clippy complaining about u128 types not being FFI safe
// Caused by https://github.com/ros2/ros2/issues/1374 in iron and newer
// See https://github.com/ros2-rust/ros2_rust/issues/320
#![allow(improper_ctypes)]
#![allow(improper_ctypes_definitions)]
#![allow(clippy::all)]
#![allow(missing_docs)]
#[allow(improper_ctypes)]
#[allow(improper_ctypes_definitions)]
#[allow(clippy::all)]
#[allow(missing_docs)]
include!(concat!(env!("OUT_DIR"), "/rcl_bindings_generated.rs"));

pub const RMW_GID_STORAGE_SIZE: usize = rmw_gid_storage_size_constant;
Expand Down
7 changes: 7 additions & 0 deletions rosidl_runtime_rs/Cargo.toml
Original file line number Diff line number Diff line change
Expand Up @@ -17,8 +17,15 @@ path = "src/lib.rs"
# formats such as JSON, YAML, Pickle, etc.
serde = { version = "1", optional = true }

[features]
# Used solely to enable docs generate with docs.rs that does not have a ROS installation
generate_docs = []

[dev-dependencies]
# Needed for writing property tests
quickcheck = "1"
# Needed for testing serde support
serde_json = "1"

[package.metadata.docs.rs]
features = ["generate_docs"]
11 changes: 7 additions & 4 deletions rosidl_runtime_rs/build.rs
Original file line number Diff line number Diff line change
Expand Up @@ -15,10 +15,13 @@ fn get_env_var_or_abort(env_var: &'static str) -> String {
}

fn main() {
let ament_prefix_path_list = get_env_var_or_abort(AMENT_PREFIX_PATH);
for ament_prefix_path in ament_prefix_path_list.split(':') {
let library_path = Path::new(ament_prefix_path).join("lib");
println!("cargo:rustc-link-search=native={}", library_path.display());
#[cfg(not(feature = "generate_docs"))]
{
let ament_prefix_path_list = get_env_var_or_abort(AMENT_PREFIX_PATH);
for ament_prefix_path in ament_prefix_path_list.split(':') {
let library_path = Path::new(ament_prefix_path).join("lib");
println!("cargo:rustc-link-search=native={}", library_path.display());
}
}

// Invalidate the built crate whenever this script changes
Expand Down

0 comments on commit e4b251b

Please sign in to comment.