metaforce/Graphics/build.rs

55 lines
2.0 KiB
Rust
Raw Permalink Normal View History

2022-02-01 00:06:54 +00:00
fn main() {
let zeus_include = std::path::PathBuf::from(format!(
"{}/../extern/zeus/include",
std::env::var("CARGO_MANIFEST_DIR").unwrap()
))
.canonicalize()
.unwrap();
let imgui_include = std::path::PathBuf::from(format!(
"{}/../extern/imgui",
std::env::var("CARGO_MANIFEST_DIR").unwrap()
))
.canonicalize()
.unwrap();
let imgui_engine_include = std::path::PathBuf::from(format!(
"{}/../imgui",
std::env::var("CARGO_MANIFEST_DIR").unwrap()
))
.canonicalize()
.unwrap();
// let include_dir = include_path.to_string_lossy();
// let bindings = bindgen::Builder::default()
// .header(format!("{}/zeus/CVector3f.hpp", include_dir))
// .clang_arg(format!("-I{}", include_dir))
// .parse_callbacks(Box::new(bindgen::CargoCallbacks))
// .generate()
// .expect("Unable to generate bindings");
// let out_path = std::path::PathBuf::from(std::env::var("OUT_DIR").unwrap());
// bindings.write_to_file(out_path.join("zeus.rs")).expect("Couldn't write bindings!");
2022-02-05 04:25:35 +00:00
#[cfg(any(not(unix), target_os = "macos", target_os = "ios"))]
let cxx_flag = "-std=c++17";
#[cfg(all(unix, not(any(target_os = "macos", target_os = "ios"))))]
let cxx_flag = "-std=gnu++17";
cxx_build::bridge("src/cxxbridge.rs")
2022-02-01 00:06:54 +00:00
.include("include")
.include(zeus_include.clone())
2022-02-05 04:25:35 +00:00
.flag(cxx_flag)
2022-02-01 00:06:54 +00:00
.compile("aurora");
println!("cargo:rerun-if-changed=src/cxxbridge.rs");
cxx_build::bridge("src/shaders/cxxbridge.rs")
2022-02-01 00:06:54 +00:00
.include("include")
.include(zeus_include.clone())
2022-02-05 04:25:35 +00:00
.flag(cxx_flag)
2022-02-01 00:06:54 +00:00
.compile("aurora_shaders");
println!("cargo:rerun-if-changed=src/shaders/cxxbridge.rs");
cxx_build::bridge("src/imgui/cxxbridge.rs")
2022-02-01 00:06:54 +00:00
.include("include")
.include(zeus_include.clone())
.include(imgui_include.clone())
.include(imgui_engine_include.clone())
2022-02-05 04:25:35 +00:00
.flag(cxx_flag)
2022-02-01 00:06:54 +00:00
.compile("aurora_imgui");
println!("cargo:rerun-if-changed=src/imgui/cxxbridge.rs");
2022-02-01 00:06:54 +00:00
}