Some cleanup

This commit is contained in:
Pierre Krieger 2016-10-23 20:36:08 +02:00
parent 2a61e32c81
commit 9cafcb2088
6 changed files with 34 additions and 23 deletions

View File

@ -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]

View File

@ -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),

View File

@ -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"

View File

@ -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"

21
vulkano/build.rs Normal file
View File

@ -0,0 +1,21 @@
// Copyright (c) 2016 The vulkano developers
// Licensed under the Apache License, Version 2.0
// <LICENSE-APACHE or
// http://www.apache.org/licenses/LICENSE-2.0> or the MIT
// license <LICENSE-MIT or http://opensource.org/licenses/MIT>,
// 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");
}
}

View File

@ -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<vk::Static, LoadingError> {
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)
}