diff --git build.rs build.rs index f2099a0b..4682642a 100644 --- build.rs +++ build.rs @@ -41,12 +41,12 @@ pub fn dump_rust_sources(out_path: &std::path::Path) { } fn main() { - buildrs::opaque_types_generator::generate_opaque_types(); + // buildrs::opaque_types_generator::generate_opaque_types(); buildrs::cbindgen_generator::generate_c_headers(); - if let Some(out_path) = env::var_os("ZENOHC_DUMP_SRC_DIR") { - let out_path = std::path::Path::new(&out_path); - dump_rust_sources(out_path); - } + // if let Some(out_path) = env::var_os("ZENOHC_DUMP_SRC_DIR") { + // let out_path = std::path::Path::new(&out_path); + // dump_rust_sources(out_path); + // } println!("cargo:rerun-if-changed=build.rs"); println!("cargo:rerun-if-changed=buildrs"); println!("cargo:rerun-if-changed=src"); diff --git buildrs/cbindgen_generator.rs buildrs/cbindgen_generator.rs index e678799e..5e946a9b 100644 --- buildrs/cbindgen_generator.rs +++ buildrs/cbindgen_generator.rs @@ -36,18 +36,18 @@ static RUST_TO_C_FEATURES: phf::Map<&'static str, &'static str> = phf_map! { }; pub fn generate_c_headers() { - let crate_dir = std::env::var("CARGO_MANIFEST_DIR").unwrap(); - let config = cbindgen::Config::from_root_or_default(crate_dir.clone()); - cbindgen::Builder::new() - .with_config(config) - .with_crate(crate_dir) - .with_src(get_out_rs_path().join("./opaque_types.rs")) - .generate() - .expect("Unable to generate bindings") - .write_to_file(BUGGY_GENERATION_PATH); + // let crate_dir = std::env::var("CARGO_MANIFEST_DIR").unwrap(); + // let config = cbindgen::Config::from_root_or_default(crate_dir.clone()); + // cbindgen::Builder::new() + // .with_config(config) + // .with_crate(crate_dir) + // .with_src(get_out_rs_path().join("./opaque_types.rs")) + // .generate() + // .expect("Unable to generate bindings") + // .write_to_file(BUGGY_GENERATION_PATH); fix_cbindgen(BUGGY_GENERATION_PATH, GENERATION_PATH); - std::fs::remove_file(BUGGY_GENERATION_PATH).unwrap(); + // std::fs::remove_file(BUGGY_GENERATION_PATH).unwrap(); preprocess_header(GENERATION_PATH, PREPROCESS_PATH); create_generics_header(PREPROCESS_PATH, "include/zenoh_macros.h"); diff --git buildrs/common_helpers.rs buildrs/common_helpers.rs index 4f4dae7c..5c20f0e5 100644 --- buildrs/common_helpers.rs +++ buildrs/common_helpers.rs @@ -32,20 +32,22 @@ pub fn test_feature(feature: &str) -> bool { pub fn cargo_target_dir() -> PathBuf { // OUT_DIR is a path to the directory where the build script writes its output. let out_dir = PathBuf::from(env::var("OUT_DIR").expect("OUT_DIR should be set")); - // PROFILE is the profile that the build script is being run for. This will be one of "debug" or "release". - let profile = env::var("PROFILE").expect("PROFILE should be set"); + out_dir.to_path_buf() - let mut target_dir = None; - let mut out_dir_path = out_dir.as_path(); - while let Some(parent) = out_dir_path.parent() { - if parent.ends_with(&profile) { - target_dir = Some(parent); - break; - } - out_dir_path = parent; - } + // // PROFILE is the profile that the build script is being run for. This will be one of "debug" or "release". + // let profile = env::var("PROFILE").expect("PROFILE should be set"); - target_dir - .expect("OUT_DIR should be a child of a PROFILE directory") - .to_path_buf() + // let mut target_dir = None; + // let mut out_dir_path = out_dir.as_path(); + // while let Some(parent) = out_dir_path.parent() { + // if parent.ends_with(&profile) { + // target_dir = Some(parent); + // break; + // } + // out_dir_path = parent; + // } + + // target_dir + // .expect("OUT_DIR should be a child of a PROFILE directory") + // .to_path_buf() }