Skip to content

Commit f9e7263

Browse files
authored
- Upgraded bindgen to 0.66.1 (#323)
- Upgraded libloading to 0.8 - Added instructions to rerun build scripts if dependent files have changed - Enabled bindgen to invalidate the built crate whenever any transitively included header files from the wrapper change - Removed some default true options from our bindgen builder Co-authored-by: Sam Privett <[email protected]>
1 parent 11b0ff4 commit f9e7263

File tree

3 files changed

+13
-6
lines changed

3 files changed

+13
-6
lines changed

rclrs/Cargo.toml

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -19,7 +19,7 @@ ament_rs = { version = "0.2", optional = true }
1919
# Needed for clients
2020
futures = "0.3"
2121
# Needed for dynamic messages
22-
libloading = { version = "0.7", optional = true }
22+
libloading = { version = "0.8", optional = true }
2323
# Needed for the Message trait, among others
2424
rosidl_runtime_rs = "0.3"
2525

@@ -29,7 +29,7 @@ tempfile = "3.3.0"
2929

3030
[build-dependencies]
3131
# Needed for FFI
32-
bindgen = "0.59.1"
32+
bindgen = "0.66.1"
3333

3434
[features]
3535
dyn_msg = ["ament_rs", "libloading"]

rclrs/build.rs

Lines changed: 8 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -4,6 +4,7 @@ use std::path::{Path, PathBuf};
44

55
const AMENT_PREFIX_PATH: &str = "AMENT_PREFIX_PATH";
66
const ROS_DISTRO: &str = "ROS_DISTRO";
7+
const BINDGEN_WRAPPER: &str = "src/rcl_wrapper.h";
78

89
fn get_env_var_or_abort(env_var: &'static str) -> String {
910
if let Ok(value) = env::var(env_var) {
@@ -21,9 +22,8 @@ fn main() {
2122
println!("cargo:rustc-cfg=ros_distro=\"{ros_distro}\"");
2223

2324
let mut builder = bindgen::Builder::default()
24-
.header("src/rcl_wrapper.h")
25+
.header(BINDGEN_WRAPPER)
2526
.derive_copy(false)
26-
.allowlist_recursively(true)
2727
.allowlist_type("rcl_.*")
2828
.allowlist_type("rmw_.*")
2929
.allowlist_type("rcutils_.*")
@@ -37,10 +37,14 @@ fn main() {
3737
.allowlist_var("rcutils_.*")
3838
.allowlist_var("rosidl_.*")
3939
.layout_tests(false)
40-
.size_t_is_usize(true)
4140
.default_enum_style(bindgen::EnumVariation::Rust {
4241
non_exhaustive: false,
43-
});
42+
})
43+
.parse_callbacks(Box::new(bindgen::CargoCallbacks));
44+
45+
// Invalidate the built crate whenever this script or the wrapper changes
46+
println!("cargo:rerun-if-changed=build.rs");
47+
println!("cargo:rerun-if-changed={BINDGEN_WRAPPER}");
4448

4549
// #############
4650
// # ALGORITHM #

rosidl_runtime_rs/build.rs

Lines changed: 3 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -20,4 +20,7 @@ fn main() {
2020
let library_path = Path::new(ament_prefix_path).join("lib");
2121
println!("cargo:rustc-link-search=native={}", library_path.display());
2222
}
23+
24+
// Invalidate the built crate whenever this script changes
25+
println!("cargo:rerun-if-changed=build.rs");
2326
}

0 commit comments

Comments
 (0)