diff --git a/lib/build.rs b/lib/build.rs index 8745ff0..2cb25c7 100644 --- a/lib/build.rs +++ b/lib/build.rs @@ -1,6 +1,24 @@ fn main() -> Result<(), Box> { #[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";