diff --git a/ash/Cargo.toml b/ash/Cargo.toml index 40837a5..1474cd3 100644 --- a/ash/Cargo.toml +++ b/ash/Cargo.toml @@ -14,5 +14,9 @@ shared_library = "0.1.5" lazy_static = "0.2.1" libc = "0.2.26" +[features] +default = [] +moltenvk = [] + [package.metadata.release] no-dev-version = true diff --git a/ash/src/entry.rs b/ash/src/entry.rs index 0e59883..9cebc8d 100644 --- a/ash/src/entry.rs +++ b/ash/src/entry.rs @@ -15,7 +15,7 @@ fn get_path() -> &'static Path { Path::new("vulkan-1.dll") } -#[cfg(all(unix, not(target_os = "android")))] +#[cfg(all(unix, not(any(feature = "moltenvk", target_os = "android"))))] fn get_path() -> &'static Path { Path::new("libvulkan.so.1") } @@ -25,6 +25,11 @@ fn get_path() -> &'static Path { Path::new("libvulkan.so") } +#[cfg(all(feature = "moltenvk", any(target_os = "macos", target_os = "ios")))] +fn get_path() -> &'static Path { + Path::new("libMoltenVK.dylib") +} + lazy_static!{ static ref VK_LIB: Result = DynamicLibrary::open(Some(get_path())); }