cross compile libs

This commit is contained in:
Alex Janka 2023-10-07 10:10:24 +11:00
parent 16a3328c42
commit 8129b9f840

View file

@ -1,6 +1,24 @@
fn main() -> Result<(), Box<dyn std::error::Error>> {
#[cfg(feature = "vulkan-renderer")]
{
let host_triple = std::env::var("HOST").unwrap();
let target_triple = std::env::var("TARGET").unwrap();
if host_triple != target_triple {
// cross compile
if !host_triple.contains("windows") && target_triple.contains("x86_64-pc-windows") {
println!(
"cargo:rustc-link-search={}",
std::env::var("VULKAN_SDK_WIN")
.expect("Could not find windows vulkan sdk path")
);
println!(
"cargo:rustc-link-search={}",
std::env::var("SHADERC_WIN").expect("Could not find windows shaderc path")
);
}
}
const SHADER_SRC_DIR: &str = "src/renderer/vulkan/shaders";
const SHADER_OUT_DIR: &str = "shaders";