From a28b60578d55d2331753552775c1cae61a97d48e Mon Sep 17 00:00:00 2001 From: Austin Lasher Date: Thu, 25 Jul 2019 14:56:24 -0400 Subject: [PATCH] Fix run_return example build error on non-desktop platforms (#1067) --- examples/window_run_return.rs | 29 ++++++++++++++++++++++------- 1 file changed, 22 insertions(+), 7 deletions(-) diff --git a/examples/window_run_return.rs b/examples/window_run_return.rs index d2516c7a..374703e1 100644 --- a/examples/window_run_return.rs +++ b/examples/window_run_return.rs @@ -1,11 +1,21 @@ -use winit::{ - event::{Event, WindowEvent}, - event_loop::{ControlFlow, EventLoop}, - platform::desktop::EventLoopExtDesktop, - window::WindowBuilder, -}; - +// Limit this example to only compatible platforms. +#[cfg(any( + target_os = "windows", + target_os = "macos", + target_os = "linux", + target_os = "dragonfly", + target_os = "freebsd", + target_os = "netbsd", + target_os = "openbsd" +))] fn main() { + use winit::{ + event::{Event, WindowEvent}, + event_loop::{ControlFlow, EventLoop}, + platform::desktop::EventLoopExtDesktop, + window::WindowBuilder, + }; + let mut event_loop = EventLoop::new(); let window = WindowBuilder::new() @@ -39,3 +49,8 @@ fn main() { println!("Okay we're done now for real."); } + +#[cfg(any(target_os = "ios", target_os = "android", target_os = "emscripten"))] +fn main() { + println!("This platform doesn't support run_return."); +}