| 1 | // Copyright © SixtyFPS GmbH <info@slint.dev> |
| 2 | // SPDX-License-Identifier: MIT |
| 3 | |
| 4 | #![cfg_attr (feature = "mcu-board-support" , no_std)] |
| 5 | #![cfg_attr (all(feature = "mcu-board-support" , not(feature = "simulator" )), no_main)] |
| 6 | |
| 7 | #[cfg (feature = "mcu-board-support" )] |
| 8 | extern crate alloc; |
| 9 | |
| 10 | #[cfg (feature = "mcu-board-support" )] |
| 11 | #[allow (unused_imports)] |
| 12 | use mcu_board_support::prelude::*; |
| 13 | |
| 14 | #[cfg (target_arch = "wasm32" )] |
| 15 | use wasm_bindgen::prelude::*; |
| 16 | |
| 17 | slint::include_modules!(); |
| 18 | |
| 19 | #[cfg (not(feature = "mcu-board-support" ))] |
| 20 | #[cfg_attr (target_arch = "wasm32" , wasm_bindgen(start))] |
| 21 | pub fn main() { |
| 22 | // This provides better error messages in debug mode. |
| 23 | // It's disabled in release mode so it doesn't bloat up the file size. |
| 24 | #[cfg (all(debug_assertions, target_arch = "wasm32" ))] |
| 25 | console_error_panic_hook::set_once(); |
| 26 | |
| 27 | MainWindow::new().unwrap().run().unwrap(); |
| 28 | } |
| 29 | |
| 30 | #[cfg (any(feature = "mcu-board-support" , feature = "simulator" ))] |
| 31 | #[mcu_board_support::entry] |
| 32 | fn main() -> ! { |
| 33 | mcu_board_support::init(); |
| 34 | MainWindow::new().unwrap().run().unwrap(); |
| 35 | |
| 36 | panic!("The MCU demo should not quit" ) |
| 37 | } |
| 38 | |