macos fixes
This commit is contained in:
parent
caa77171fe
commit
c84bb67914
10
build.rs
10
build.rs
|
|
@ -26,16 +26,6 @@ fn main() {
|
|||
let mut modules = String::new();
|
||||
|
||||
for (module, prefixes) in &msgs {
|
||||
println!(
|
||||
"cargo:rustc-link-lib=dylib={}__rosidl_typesupport_c",
|
||||
module
|
||||
);
|
||||
println!(
|
||||
"cargo:rustc-link-lib=dylib={}__rosidl_typesupport_introspection_c",
|
||||
module
|
||||
);
|
||||
println!("cargo:rustc-link-lib=dylib={}__rosidl_generator_c", module);
|
||||
|
||||
modules.push_str(&format!(r#"pub mod {module}{{include!(concat!(env!("OUT_DIR"), "/{module}.rs"));}}{lf}"#, module=module, lf="\n"));
|
||||
|
||||
let mut codegen = String::new();
|
||||
|
|
|
|||
|
|
@ -14,7 +14,6 @@ fn main() {
|
|||
let packages = cmake_includes.split(":").flat_map(|i| Path::new(i).parent()).collect::<Vec<_>>();
|
||||
for p in cmake_includes.split(":") {
|
||||
builder = builder.clang_arg(format!("-I{}", p));
|
||||
println!("adding include path: {}", p);
|
||||
}
|
||||
let deps = env::var("CMAKE_IDL_PACKAGES").unwrap_or(String::default());
|
||||
let deps = deps.split(":").collect::<Vec<_>>();
|
||||
|
|
@ -25,7 +24,6 @@ fn main() {
|
|||
let ament_prefix_var = env::var("AMENT_PREFIX_PATH").expect("Source your ROS!");
|
||||
for p in ament_prefix_var.split(":") {
|
||||
builder = builder.clang_arg(format!("-I{}/include", p));
|
||||
println!("cargo:rustc-link-search=native={}/lib", p);
|
||||
}
|
||||
|
||||
let paths = ament_prefix_var.split(":").map(|i| Path::new(i)).collect::<Vec<_>>();
|
||||
|
|
@ -96,7 +94,7 @@ fn main() {
|
|||
builder = builder
|
||||
.header(msg_includes_fn.to_str().unwrap())
|
||||
.derive_copy(false)
|
||||
// blacklist types that are handled by rcl bindings
|
||||
// blacklist types that are handled by rcl bindings
|
||||
.blacklist_type("rosidl_message_type_support_t")
|
||||
.blacklist_type("rosidl_service_type_support_t")
|
||||
.blacklist_type("rosidl_runtime_c__String")
|
||||
|
|
|
|||
29
rcl/build.rs
29
rcl/build.rs
|
|
@ -1,7 +1,7 @@
|
|||
extern crate bindgen;
|
||||
|
||||
use std::env;
|
||||
use std::path::PathBuf;
|
||||
use std::path::{Path,PathBuf};
|
||||
use itertools::Itertools;
|
||||
use common;
|
||||
|
||||
|
|
@ -18,12 +18,9 @@ fn main() {
|
|||
|
||||
if let Some(cmake_includes) = env::var("CMAKE_INCLUDE_DIRS").ok() {
|
||||
// we are running from cmake, do special thing.
|
||||
let cmake_libs = env::var("CMAKE_LIBRARIES").unwrap_or(String::new());
|
||||
|
||||
let mut includes = cmake_includes.split(":").collect::<Vec<_>>();
|
||||
includes.sort();
|
||||
includes.dedup();
|
||||
includes.iter().for_each(|l| println!("CMAKE_INCLUDE: {}", l));
|
||||
|
||||
for x in &includes {
|
||||
let clang_arg = format!("-I{}", x);
|
||||
|
|
@ -31,22 +28,18 @@ fn main() {
|
|||
builder = builder.clang_arg(clang_arg);
|
||||
}
|
||||
|
||||
let libs = cmake_libs.split(":")
|
||||
env::var("CMAKE_LIBRARIES").unwrap_or(String::new()).split(":")
|
||||
.into_iter()
|
||||
.filter(|s| s.contains(".so"))
|
||||
.filter(|s| s.contains(".so") || s.contains(".dylib"))
|
||||
.flat_map(|l| Path::new(l).parent().and_then(|p| p.to_str()))
|
||||
.unique()
|
||||
.collect::<Vec<_>>();
|
||||
|
||||
libs.iter().for_each(|l| {
|
||||
let path = PathBuf::from(l);
|
||||
let pp = path.parent().and_then(|p| p.to_str()).unwrap();
|
||||
println!("cargo:rustc-link-search=native={}", pp);
|
||||
// we could potentially do the below instead of hardcoding which libs we rely on.
|
||||
// let filename = path.file_stem().and_then(|f| f.to_str()).unwrap();
|
||||
// let without_lib = filename.strip_prefix("lib").unwrap();
|
||||
// println!("cargo:rustc-link-lib=dylib={}", without_lib);
|
||||
}
|
||||
);
|
||||
.for_each(|pp| {
|
||||
println!("cargo:rustc-link-search=native={}", pp)
|
||||
// we could potentially do the below instead of hardcoding which libs we rely on.
|
||||
// let filename = path.file_stem().and_then(|f| f.to_str()).unwrap();
|
||||
// let without_lib = filename.strip_prefix("lib").unwrap();
|
||||
// println!("cargo:rustc-link-lib=dylib={}", without_lib);
|
||||
});
|
||||
} else {
|
||||
let ament_prefix_var_name = "AMENT_PREFIX_PATH";
|
||||
let ament_prefix_var = env::var(ament_prefix_var_name).expect("Source your ROS!");
|
||||
|
|
|
|||
Loading…
Reference in New Issue