From 64bc3dcab6b96b96a0c41de85eb9121ef7b69151 Mon Sep 17 00:00:00 2001 From: Martin Dahl Date: Tue, 20 Jun 2023 08:40:59 +0200 Subject: [PATCH] Don't include function pointers when building with cfg doc-only. --- r2r_msg_gen/build.rs | 11 +++++++++-- 1 file changed, 9 insertions(+), 2 deletions(-) diff --git a/r2r_msg_gen/build.rs b/r2r_msg_gen/build.rs index 66430ce..de4443d 100644 --- a/r2r_msg_gen/build.rs +++ b/r2r_msg_gen/build.rs @@ -84,8 +84,15 @@ fn generate_bindings(bindgen_dir: &Path, msg_list: &[RosMsg]) { let bindings_file = bindgen_dir.join(BINDINGS_FILENAME); let mut includes = String::new(); - let mut introspecion_map = String::from( - "\ + let mut introspecion_map = String::from(" + #[cfg(feature = \"doc-only\")] + lazy_static! { + static ref INTROSPECTION_FNS: HashMap<&'static str, usize> = { + HashMap::new() + }; + } + + #[cfg(not(feature = \"doc-only\"))] lazy_static! { static ref INTROSPECTION_FNS: HashMap<&'static str, usize> = { let mut m = HashMap::new();