use std::env;
use std::error::Error;
use std::fs;
use std::path::PathBuf;
fn main() -> Result<(), Box<dyn Error>> {
let out_dir = PathBuf::from(env::var("OUT_DIR")?);
let install_dir = out_dir.join("install");
fs::create_dir_all(&install_dir)?;
autotools::Config::new("protobuf")
.disable("maintainer-mode", None)
.out_dir(&install_dir)
.build();
let _ = fs::remove_dir_all(out_dir.join("build"));
fs::rename(install_dir.join("build"), out_dir.join("build"))?;
println!("cargo:rustc-env=INSTALL_DIR={}", install_dir.display());
println!("cargo:CXXBRIDGE_DIR0={}/include", install_dir.display());
Ok(())
}