#[cfg(all(feature = "VK_USE_PLATFORM_DEFAULT", target_os = "windows"))]
fn enable_default_platform() {
println!("cargo:rustc-cfg=feature=\"VK_USE_PLATFORM_WIN32_KHR\"");
println!("cargo:rustc-cfg=feature=\"VK_USE_PLATFORM_WIN32_KHX\"");
}
#[cfg(all(feature = "VK_USE_PLATFORM_DEFAULT", target_os = "linux"))]
fn enable_default_platform() {
println!("cargo:rustc-cfg=feature=\"VK_USE_PLATFORM_XLIB_KHR\"");
println!("cargo:rustc-cfg=feature=\"VK_USE_PLATFORM_XLIB_XRANDR_EXT\"");
println!("cargo:rustc-cfg=feature=\"VK_USE_PLATFORM_XCB_KHR\"");
println!("cargo:rustc-cfg=feature=\"VK_USE_PLATFORM_WAYLAND_KHR\"");
println!("cargo:rustc-cfg=feature=\"VK_USE_PLATFORM_MIR_KHR\"");
}
#[cfg(all(feature = "VK_USE_PLATFORM_DEFAULT", target_os = "android"))]
fn enable_default_platform() {
println!("cargo:rustc-cfg=feature=\"VK_USE_PLATFORM_ANDROID_KHR\"");
}
#[cfg(all(feature = "VK_USE_PLATFORM_DEFAULT", target_os = "ios"))]
fn enable_default_platform() {
println!("cargo:rustc-cfg=feature=\"VK_USE_PLATFORM_IOS_MVK\"");
}
#[cfg(all(feature = "VK_USE_PLATFORM_DEFAULT", target_os = "macos"))]
fn enable_default_platform() {
println!("cargo:rustc-cfg=feature=\"VK_USE_PLATFORM_MACOS_MVK\"");
}
#[cfg(not(feature = "VK_USE_PLATFORM_DEFAULT"))]
fn enable_default_platform() {}
fn main() {
let generator_path = ::std::path::Path::new("tools").join("generator");
let genvk_py_path = generator_path.join("genvk.py");
let vkdoc_path = ::std::path::Path::new("tools").join("vulkan_spec").join("Vulkan-Docs");
let out_dir = ::std::env::var("OUT_DIR").unwrap();
for path in generator_path.read_dir()
.unwrap()
.map(|p| p.unwrap().path())
.filter(|p| p.is_file() && p.extension().unwrap() == "py") {
println!("cargo:rerun-if-changed={}", path.to_str().unwrap());
}
enable_default_platform();
if !vkdoc_path.exists() {
let status = ::std::process::Command::new("git")
.arg("submodule")
.arg("update")
.arg("--init")
.arg(vkdoc_path)
.status()
.unwrap();
if !status.success() {
panic!("`git submodule update init [...]` exited with status code {}",
status)
}
}
let status = ::std::process::Command::new("python3")
.arg(genvk_py_path)
.arg("-o")
.arg(out_dir)
.arg("vulkan_types.rs")
.arg("vulkan_ffi.rs")
.arg("vulkan_safe.rs")
.arg("vulkan_alias.rs")
.arg("vulkan_utils.rs")
.status()
.unwrap();
if !status.success() {
panic!("`genvk.py vulkan.rs` exited with status code {}", status)
}
}