diff --git a/examples/Cargo.toml b/examples/Cargo.toml index b11ed8a5..fa4b2776 100644 --- a/examples/Cargo.toml +++ b/examples/Cargo.toml @@ -9,7 +9,7 @@ vulkano = { path = "../vulkano" } vulkano-win = { path = "../vulkano-win" } cgmath = "0.7.0" image = "0.6.1" -winit = { git = "https://github.com/tomaka/winit" } +winit = "0.5.3" time = "0.1.35" [build-dependencies] diff --git a/examples/build.rs b/examples/build.rs index dc893d77..37d1adfd 100644 --- a/examples/build.rs +++ b/examples/build.rs @@ -1,7 +1,6 @@ extern crate vulkano_shaders; fn main() { - println!("cargo:rustc-link-search=framework={}", "/Library/Frameworks"); // building the shaders used in the examples vulkano_shaders::build_glsl_shaders([ ("src/bin/triangle_vs.glsl", vulkano_shaders::ShaderType::Vertex), diff --git a/vulkano-win/Cargo.toml b/vulkano-win/Cargo.toml index 44c44722..28b446d5 100644 --- a/vulkano-win/Cargo.toml +++ b/vulkano-win/Cargo.toml @@ -8,4 +8,4 @@ license = "MIT/Apache-2.0" [dependencies] vulkano = { version = "0.3.0", path = "../vulkano" } -winit = { git = "https://github.com/tomaka/winit" } +winit = "0.5.3" diff --git a/vulkano/Cargo.toml b/vulkano/Cargo.toml index 42df3706..5a38005b 100644 --- a/vulkano/Cargo.toml +++ b/vulkano/Cargo.toml @@ -6,6 +6,7 @@ repository = "https://github.com/tomaka/vulkano" description = "Safe wrapper for the Vulkan graphics API" license = "MIT/Apache-2.0" documentation = "https://docs.rs/vulkano" +build = "build.rs" [dependencies] crossbeam = "0.2.5" diff --git a/vulkano/build.rs b/vulkano/build.rs new file mode 100644 index 00000000..0e7e64a3 --- /dev/null +++ b/vulkano/build.rs @@ -0,0 +1,21 @@ +// Copyright (c) 2016 The vulkano developers +// Licensed under the Apache License, Version 2.0 +// or the MIT +// license , +// at your option. All files in the project carrying such +// notice may not be copied, modified, or distributed except +// according to those terms. + +use std::env; + +fn main() { + let target = env::var("TARGET").unwrap(); + if target.contains("apple-darwin") { + println!("cargo:rustc-link-search=framework={}", "/Library/Frameworks"); // TODO: necessary? + println!("cargo:rustc-link-lib=c++"); + println!("cargo:rustc-link-lib=framework=MoltenVK"); + println!("cargo:rustc-link-lib=framework=QuartzCore"); + println!("cargo:rustc-link-lib=framework=Metal"); + } +} diff --git a/vulkano/src/instance/loader.rs b/vulkano/src/instance/loader.rs index a812d6e6..05116cec 100644 --- a/vulkano/src/instance/loader.rs +++ b/vulkano/src/instance/loader.rs @@ -16,28 +16,18 @@ use std::ptr; use shared_library; use vk; - -#[cfg(any(target_os = "macos", target_os = "ios"))] -#[link(name = "c++")] -extern {} - -#[cfg(any(target_os = "macos", target_os = "ios"))] -#[link(name = "Metal", kind = "framework")] -extern {} - -#[cfg(any(target_os = "macos", target_os = "ios"))] -#[link(name = "QuartzCore", kind = "framework")] -extern {} - -#[cfg(any(target_os = "macos", target_os = "ios"))] -#[link(name = "MoltenVK", kind = "framework")] -extern { - fn vkGetInstanceProcAddr(instance: vk::Instance, pName: *const ::std::os::raw::c_char) -> vk::PFN_vkVoidFunction; -} - #[cfg(any(target_os = "macos", target_os = "ios"))] fn load_static() -> Result { - extern "system" fn wrapper(instance: vk::Instance, pName: *const ::std::os::raw::c_char) -> vk::PFN_vkVoidFunction { + use std::os::raw::c_char; + + extern { + fn vkGetInstanceProcAddr(instance: vk::Instance, pName: *const c_char) + -> vk::PFN_vkVoidFunction; + } + + extern "system" fn wrapper(instance: vk::Instance, pName: *const c_char) + -> vk::PFN_vkVoidFunction + { unsafe { vkGetInstanceProcAddr(instance, pName) }