Make code generation always re-run when msgs.txt is changed.
This commit is contained in:
parent
1ed8f3c38c
commit
9dc67bb2d1
2
build.rs
2
build.rs
|
|
@ -2,7 +2,7 @@ use msg_gen::*;
|
|||
use common::*;
|
||||
|
||||
fn main() {
|
||||
let msgs = read_file("./msgs.txt").unwrap();
|
||||
let msgs = read_file("./msgs.txt").expect("You need to create msgs.txt");
|
||||
let msgs = parse_msgs(&msgs);
|
||||
let msgs = as_map(&msgs);
|
||||
|
||||
|
|
|
|||
|
|
@ -6,9 +6,9 @@ use std::path::PathBuf;
|
|||
use common::*;
|
||||
|
||||
fn main() {
|
||||
println!("cargo:rerun-if-changed=../");
|
||||
println!("cargo:rerun-if-changed=../msgs.txt");
|
||||
|
||||
let msgs = read_file("../msgs.txt").unwrap();
|
||||
let msgs = read_file("../msgs.txt").expect("You need to create msgs.txt");
|
||||
let msg_list = parse_msgs(&msgs);
|
||||
let msg_map = as_map(&msg_list);
|
||||
|
||||
|
|
@ -48,7 +48,6 @@ fn main() {
|
|||
let mut f = File::create("src/introspection_functions.rs").unwrap();
|
||||
write!(f, "{}", introspecion_map).unwrap();
|
||||
|
||||
let headers_enabled = env::var_os("CARGO_FEATURE_HEADERS").is_some();
|
||||
let mut builder = bindgen::Builder::default()
|
||||
.header("src/msg_includes.h")
|
||||
.derive_copy(false)
|
||||
|
|
@ -83,15 +82,12 @@ fn main() {
|
|||
println!("cargo:rustc-link-search=native={}/lib", ament_prefix_path);
|
||||
}
|
||||
|
||||
// bindgen takes time so we dont want to do it always... must be a better way
|
||||
if headers_enabled {
|
||||
let bindings = builder.generate().expect("Unable to generate bindings");
|
||||
let bindings = builder.generate().expect("Unable to generate bindings");
|
||||
|
||||
let out_path = PathBuf::from(".");
|
||||
bindings
|
||||
.write_to_file(out_path.join("src/msg_bindings.rs"))
|
||||
.expect("Couldn't write bindings!");
|
||||
}
|
||||
let out_path = PathBuf::from(env::var("OUT_DIR").unwrap());
|
||||
bindings
|
||||
.write_to_file(out_path.join("msg_bindings.rs"))
|
||||
.expect("Couldn't write bindings!");
|
||||
|
||||
// assert!(false);
|
||||
}
|
||||
|
|
|
|||
|
|
@ -3,7 +3,7 @@
|
|||
#![allow(non_snake_case)]
|
||||
#![allow(improper_ctypes)]
|
||||
#![allow(dead_code)]
|
||||
include!("./msg_bindings.rs");
|
||||
include!(concat!(env!("OUT_DIR"), "/msg_bindings.rs"));
|
||||
include!("./introspection_functions.rs");
|
||||
|
||||
#[macro_use]
|
||||
|
|
|
|||
17
rcl/build.rs
17
rcl/build.rs
|
|
@ -4,9 +4,6 @@ use std::env;
|
|||
use std::path::PathBuf;
|
||||
|
||||
fn main() {
|
||||
println!("cargo:rerun-if-changed=../");
|
||||
|
||||
let headers_enabled = env::var_os("CARGO_FEATURE_HEADERS").is_some();
|
||||
let mut builder = bindgen::Builder::default()
|
||||
.header("src/rcl_wrapper.h")
|
||||
.derive_copy(false)
|
||||
|
|
@ -28,13 +25,11 @@ fn main() {
|
|||
println!("cargo:rustc-link-lib=dylib=rosidl_typesupport_c");
|
||||
println!("cargo:rustc-link-lib=dylib=rosidl_generator_c");
|
||||
|
||||
// bindgen takes time so we dont want to do it always... must be a better way
|
||||
if headers_enabled {
|
||||
let bindings = builder.generate().expect("Unable to generate bindings");
|
||||
let bindings = builder.generate().expect("Unable to generate bindings");
|
||||
|
||||
let out_path = PathBuf::from(env::var("OUT_DIR").unwrap());
|
||||
bindings
|
||||
.write_to_file(out_path.join("rcl_bindings.rs"))
|
||||
.expect("Couldn't write bindings!");
|
||||
|
||||
let out_path = PathBuf::from(".");
|
||||
bindings
|
||||
.write_to_file(out_path.join("src/rcl_bindings.rs"))
|
||||
.expect("Couldn't write bindings!");
|
||||
}
|
||||
}
|
||||
|
|
|
|||
|
|
@ -3,8 +3,7 @@
|
|||
#![allow(non_snake_case)]
|
||||
#![allow(improper_ctypes)]
|
||||
#![allow(dead_code)]
|
||||
pub mod rcl_bindings;
|
||||
pub use rcl_bindings::*;
|
||||
include!(concat!(env!("OUT_DIR"), "/rcl_bindings.rs"));
|
||||
|
||||
use std::ffi::CStr;
|
||||
use std::ffi::CString;
|
||||
|
|
|
|||
Loading…
Reference in New Issue