Use #[cfg] for the OSX code in vulkano-win

This commit is contained in:
Pierre Krieger 2017-05-26 20:26:05 +02:00
parent 40e0b24127
commit c6fb7a84bd
2 changed files with 11 additions and 4 deletions

View File

@ -10,6 +10,8 @@ categories = ["rendering::graphics-api"]
[dependencies]
vulkano = { version = "0.3.0", path = "../vulkano" }
winit = "0.6.4"
metal-rs = "0.3"
[target.'cfg(target_os = "macos")'.dependencies]
metal-rs = "0.3.0"
cocoa = "0.8.1"
objc = ""
objc = "0.2"

View File

@ -1,8 +1,11 @@
extern crate vulkano;
extern crate winit;
#[cfg(target_os = "macos")]
extern crate objc;
#[cfg(target_os = "macos")]
extern crate cocoa;
#[cfg(target_os = "macos")]
extern crate metal_rs as metal;
use std::error;
@ -17,11 +20,13 @@ use vulkano::swapchain::SurfaceCreationError;
use winit::{EventsLoop, WindowBuilder};
use winit::CreationError as WindowCreationError;
#[cfg(target_os = "macos")]
use objc::runtime::{YES};
#[cfg(target_os = "macos")]
use cocoa::base::id as cocoa_id;
#[cfg(target_os = "macos")]
use cocoa::appkit::{NSWindow, NSView};
#[cfg(target_os = "macos")]
use metal::*;
use std::mem;