aa7b429f4f
* Mark EntryCustom::new_custom as unsafe Passing a badly-behaved `load` function can invoke undefined behavior. * Document required feature for Entry * Support linking Vulkan directly This is the preferred pattern in most environments when an application cannot function without Vulkan, as it saves the libloading dependency, eliminates an error case, and makes the Vulkan dependency visible to the OS. * Rename libloading feature to "loaded" * Link by default * Guide users towards linking the loader directly * Remove unnecessary error type InstanceError::LoadError was never constructed. * Unify entry types Simplifies the interface and allows a bunch of code to become monomorphic.
24 lines
805 B
Rust
24 lines
805 B
Rust
fn main() {
|
|
#[cfg(feature = "linked")]
|
|
{
|
|
use std::env;
|
|
|
|
let target_family = env::var("CARGO_CFG_TARGET_FAMILY").unwrap();
|
|
let target_pointer_width = env::var("CARGO_CFG_TARGET_POINTER_WIDTH").unwrap();
|
|
|
|
println!("cargo:rerun-if-env-changed=VULKAN_SDK");
|
|
if let Ok(var) = env::var("VULKAN_SDK") {
|
|
let suffix = match (&*target_family, &*target_pointer_width) {
|
|
("windows", "32") => "Lib32",
|
|
("windows", "64") => "Lib",
|
|
_ => "lib",
|
|
};
|
|
println!("cargo:rustc-link-search={}/{}", var, suffix);
|
|
}
|
|
let lib = match &*target_family {
|
|
"windows" => "vulkan-1",
|
|
_ => "vulkan",
|
|
};
|
|
println!("cargo:rustc-link-lib={}", lib);
|
|
}
|
|
}
|