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();
|
let mut modules = String::new();
|
||||||
|
|
||||||
for (module, prefixes) in &msgs {
|
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"));
|
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();
|
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<_>>();
|
let packages = cmake_includes.split(":").flat_map(|i| Path::new(i).parent()).collect::<Vec<_>>();
|
||||||
for p in cmake_includes.split(":") {
|
for p in cmake_includes.split(":") {
|
||||||
builder = builder.clang_arg(format!("-I{}", p));
|
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 = env::var("CMAKE_IDL_PACKAGES").unwrap_or(String::default());
|
||||||
let deps = deps.split(":").collect::<Vec<_>>();
|
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!");
|
let ament_prefix_var = env::var("AMENT_PREFIX_PATH").expect("Source your ROS!");
|
||||||
for p in ament_prefix_var.split(":") {
|
for p in ament_prefix_var.split(":") {
|
||||||
builder = builder.clang_arg(format!("-I{}/include", p));
|
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<_>>();
|
let paths = ament_prefix_var.split(":").map(|i| Path::new(i)).collect::<Vec<_>>();
|
||||||
|
|
|
||||||
21
rcl/build.rs
21
rcl/build.rs
|
|
@ -1,7 +1,7 @@
|
||||||
extern crate bindgen;
|
extern crate bindgen;
|
||||||
|
|
||||||
use std::env;
|
use std::env;
|
||||||
use std::path::PathBuf;
|
use std::path::{Path,PathBuf};
|
||||||
use itertools::Itertools;
|
use itertools::Itertools;
|
||||||
use common;
|
use common;
|
||||||
|
|
||||||
|
|
@ -18,12 +18,9 @@ fn main() {
|
||||||
|
|
||||||
if let Some(cmake_includes) = env::var("CMAKE_INCLUDE_DIRS").ok() {
|
if let Some(cmake_includes) = env::var("CMAKE_INCLUDE_DIRS").ok() {
|
||||||
// we are running from cmake, do special thing.
|
// 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<_>>();
|
let mut includes = cmake_includes.split(":").collect::<Vec<_>>();
|
||||||
includes.sort();
|
includes.sort();
|
||||||
includes.dedup();
|
includes.dedup();
|
||||||
includes.iter().for_each(|l| println!("CMAKE_INCLUDE: {}", l));
|
|
||||||
|
|
||||||
for x in &includes {
|
for x in &includes {
|
||||||
let clang_arg = format!("-I{}", x);
|
let clang_arg = format!("-I{}", x);
|
||||||
|
|
@ -31,22 +28,18 @@ fn main() {
|
||||||
builder = builder.clang_arg(clang_arg);
|
builder = builder.clang_arg(clang_arg);
|
||||||
}
|
}
|
||||||
|
|
||||||
let libs = cmake_libs.split(":")
|
env::var("CMAKE_LIBRARIES").unwrap_or(String::new()).split(":")
|
||||||
.into_iter()
|
.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()
|
.unique()
|
||||||
.collect::<Vec<_>>();
|
.for_each(|pp| {
|
||||||
|
println!("cargo:rustc-link-search=native={}", pp)
|
||||||
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.
|
// 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 filename = path.file_stem().and_then(|f| f.to_str()).unwrap();
|
||||||
// let without_lib = filename.strip_prefix("lib").unwrap();
|
// let without_lib = filename.strip_prefix("lib").unwrap();
|
||||||
// println!("cargo:rustc-link-lib=dylib={}", without_lib);
|
// println!("cargo:rustc-link-lib=dylib={}", without_lib);
|
||||||
}
|
});
|
||||||
);
|
|
||||||
} else {
|
} else {
|
||||||
let ament_prefix_var_name = "AMENT_PREFIX_PATH";
|
let ament_prefix_var_name = "AMENT_PREFIX_PATH";
|
||||||
let ament_prefix_var = env::var(ament_prefix_var_name).expect("Source your ROS!");
|
let ament_prefix_var = env::var(ament_prefix_var_name).expect("Source your ROS!");
|
||||||
|
|
|
||||||
Loading…
Reference in New Issue