Silence cfg and ffi warnings. Fixes #108.
This commit is contained in:
parent
d8fe90b61d
commit
4cb5bd362e
12
r2r/build.rs
12
r2r/build.rs
|
|
@ -36,6 +36,18 @@ use filenames::*;
|
|||
|
||||
fn main() {
|
||||
r2r_common::print_cargo_watches();
|
||||
// Declare all the custom cfg directives we use
|
||||
// to silence cargo warnings.
|
||||
r2r_common::print_cargo_used_cfgs(&[
|
||||
"r2r__rosgraph_msgs__msg__Clock",
|
||||
"r2r__action_msgs__msg__GoalStatus",
|
||||
"r2r__test_msgs__msg__Defaults",
|
||||
"r2r__test_msgs__msg__Arrays",
|
||||
"r2r__test_msgs__msg__WStrings",
|
||||
"r2r__example_interfaces__srv__AddTwoInts",
|
||||
"r2r__std_srvs__srv__Empty",
|
||||
"r2r__example_interfaces__action__Fibonacci",
|
||||
]);
|
||||
r2r_common::print_cargo_ros_distro();
|
||||
|
||||
let out_dir = PathBuf::from(env::var_os("OUT_DIR").unwrap());
|
||||
|
|
|
|||
|
|
@ -150,6 +150,19 @@ pub fn print_cargo_ros_distro() {
|
|||
}
|
||||
}
|
||||
|
||||
pub fn print_cargo_used_cfgs(message_cfgs: &[&str]) {
|
||||
// Declare all supported ros distros as cfg directives for cargo
|
||||
for d in SUPPORTED_ROS_DISTROS {
|
||||
println!("cargo::rustc-check-cfg=cfg(r2r__ros__distro__{d})");
|
||||
}
|
||||
|
||||
// additionally we have conditional tests and features based on some
|
||||
// optional ros message packages.
|
||||
for c in message_cfgs {
|
||||
println!("cargo::rustc-check-cfg=cfg({c})");
|
||||
}
|
||||
}
|
||||
|
||||
pub fn print_cargo_link_search() {
|
||||
let ament_prefix_var_name = "AMENT_PREFIX_PATH";
|
||||
if let Some(paths) = env::var_os(ament_prefix_var_name) {
|
||||
|
|
|
|||
|
|
@ -3,6 +3,10 @@
|
|||
#![allow(non_snake_case)]
|
||||
#![allow(improper_ctypes)]
|
||||
#![allow(dead_code)]
|
||||
// Silence "`extern` fn uses type `u128`, which is not FFI-safe"
|
||||
// As of rustc 1.78, this has been fixed.
|
||||
// It could be good to still warn if building with an older rust version.
|
||||
#![allow(improper_ctypes)]
|
||||
include!(concat!(env!("OUT_DIR"), "/rcl_bindings.rs"));
|
||||
|
||||
use std::ffi::{CStr, CString};
|
||||
|
|
|
|||
|
|
@ -1,6 +1,7 @@
|
|||
#!/bin/bash
|
||||
|
||||
# Use the local version of r2r when building the minimal node.
|
||||
rm /r2r/r2r_minimal_node/r2r_minimal_node/Cargo.lock
|
||||
cat >> /r2r/r2r_minimal_node/r2r_minimal_node/Cargo.toml << EOF
|
||||
|
||||
[patch.crates-io]
|
||||
|
|
|
|||
Loading…
Reference in New Issue