[r2r_common] Move link search prints to print_cargo_link_search()
This commit is contained in:
parent
c136d1400f
commit
55cce8caec
|
|
@ -3,6 +3,7 @@ use std::path::PathBuf;
|
|||
|
||||
fn main() {
|
||||
r2r_common::print_cargo_watches();
|
||||
r2r_common::print_cargo_link_search();
|
||||
|
||||
let mut builder = r2r_common::setup_bindgen_builder();
|
||||
builder = builder.header("src/action_wrapper.h");
|
||||
|
|
|
|||
|
|
@ -55,15 +55,6 @@ pub fn setup_bindgen_builder() -> bindgen::Builder {
|
|||
println!("adding clang arg: {}", clang_arg);
|
||||
builder = builder.clang_arg(clang_arg);
|
||||
}
|
||||
|
||||
env::var("CMAKE_LIBRARIES")
|
||||
.unwrap_or_default()
|
||||
.split(':')
|
||||
.into_iter()
|
||||
.filter(|s| s.contains(".so") || s.contains(".dylib"))
|
||||
.flat_map(|l| Path::new(l).parent().and_then(|p| p.to_str()))
|
||||
.unique()
|
||||
.for_each(|pp| println!("cargo:rustc-link-search=native={}", pp));
|
||||
} else {
|
||||
let ament_prefix_var_name = "AMENT_PREFIX_PATH";
|
||||
let ament_prefix_var = env::var(ament_prefix_var_name).expect("Source your ROS!");
|
||||
|
|
@ -114,17 +105,36 @@ pub fn setup_bindgen_builder() -> bindgen::Builder {
|
|||
}
|
||||
});
|
||||
}
|
||||
|
||||
let lib_path = Path::new(p).join("lib");
|
||||
if let Some(s) = lib_path.to_str() {
|
||||
println!("cargo:rustc-link-search=native={}", s)
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
builder
|
||||
}
|
||||
|
||||
pub fn print_cargo_link_search() {
|
||||
if env::var("CMAKE_INCLUDE_DIRS").is_ok() {
|
||||
if let Ok(paths) = env::var("CMAKE_LIBRARIES") {
|
||||
paths
|
||||
.split(':')
|
||||
.into_iter()
|
||||
.filter(|s| s.contains(".so") || s.contains(".dylib"))
|
||||
.flat_map(|l| Path::new(l).parent().and_then(|p| p.to_str()))
|
||||
.unique()
|
||||
.for_each(|pp| println!("cargo:rustc-link-search=native={}", pp));
|
||||
}
|
||||
} else {
|
||||
let ament_prefix_var_name = "AMENT_PREFIX_PATH";
|
||||
if let Ok(paths) = env::var(ament_prefix_var_name) {
|
||||
for path in paths.split(':') {
|
||||
let lib_path = Path::new(path).join("lib");
|
||||
if let Some(s) = lib_path.to_str() {
|
||||
println!("cargo:rustc-link-search=native={}", s)
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
pub fn get_wanted_messages() -> Vec<RosMsg> {
|
||||
let msgs = if let Ok(cmake_package_dirs) = env::var("CMAKE_IDL_PACKAGES") {
|
||||
// CMAKE_PACKAGE_DIRS should be a (cmake) list of "cmake" dirs
|
||||
|
|
|
|||
|
|
@ -7,6 +7,7 @@ use std::path::PathBuf;
|
|||
|
||||
fn main() {
|
||||
r2r_common::print_cargo_watches();
|
||||
r2r_common::print_cargo_link_search();
|
||||
|
||||
let mut builder = r2r_common::setup_bindgen_builder();
|
||||
|
||||
|
|
|
|||
|
|
@ -3,6 +3,7 @@ use std::path::PathBuf;
|
|||
|
||||
fn main() {
|
||||
r2r_common::print_cargo_watches();
|
||||
r2r_common::print_cargo_link_search();
|
||||
|
||||
let mut builder = r2r_common::setup_bindgen_builder();
|
||||
builder = builder.header("src/rcl_wrapper.h");
|
||||
|
|
|
|||
Loading…
Reference in New Issue