Clean up generated C++ include directory handling

Don't generate the headers by default in the source directory, put them
into a sub-directory in OUT_DIR instead and convey that location via
links to the C++ test driver.
This commit is contained in:
Simon Hausmann 2021-09-17 09:25:33 +02:00 committed by Simon Hausmann
parent 499ab6645c
commit 324fb48499
5 changed files with 19 additions and 10 deletions

View file

@ -20,8 +20,12 @@ fn main() -> Result<(), anyhow::Error> {
manifest_dir.to_string_lossy()
));
let output_dir = std::env::var_os("SIXTYFPS_GENERATED_INCLUDE_DIR")
.unwrap_or_else(|| Path::new(&manifest_dir).join("generated_include").into());
let output_dir = std::env::var_os("SIXTYFPS_GENERATED_INCLUDE_DIR").unwrap_or_else(|| {
Path::new(&std::env::var_os("OUT_DIR").unwrap()).join("generated_include").into()
});
let output_dir = Path::new(&output_dir);
cbindgen::gen_all(&root_dir, &Path::new(&output_dir))
println!("cargo:GENERATED_INCLUDE_DIR={}", output_dir.display());
cbindgen::gen_all(&root_dir, &output_dir)
}