cleanup + cfg-if

This commit is contained in:
Simon Gardling
2022-03-03 13:23:52 -05:00
parent 65b0ce7db6
commit 8e30e146e0
3 changed files with 20 additions and 21 deletions

View File

@@ -27,6 +27,7 @@ eframe = { git = "https://github.com/Titaniumtown/egui", default-features = fals
include-flate = { git = "https://github.com/Titaniumtown/include-flate.git" }
shadow-rs = { version = "0.9", default-features = false }
const_format = { version = "0.2.22", default-features = false, features = ["fmt"] }
cfg-if = "1.0.0"
[build-dependencies]
shadow-rs = "0.9"

View File

@@ -1,21 +1,18 @@
#![allow(clippy::unused_unit)] // Fixes clippy keep complaining about wasm_bindgen
#![feature(const_mut_refs)]
#![feature(total_cmp)]
mod egui_app;
mod function;
mod misc;
#[cfg(target_arch = "wasm32")]
cfg_if::cfg_if! {
if #[cfg(target_arch = "wasm32")] {
use misc::log_helper;
#[cfg(target_arch = "wasm32")]
use wasm_bindgen::prelude::*;
#[cfg(target_arch = "wasm32")]
#[global_allocator]
static ALLOC: wee_alloc::WeeAlloc = wee_alloc::WeeAlloc::INIT;
#[cfg(target_arch = "wasm32")]
#[wasm_bindgen]
pub fn start(canvas_id: &str) -> Result<(), wasm_bindgen::JsValue> {
log_helper("Initializing...");
@@ -31,3 +28,5 @@ pub fn start(canvas_id: &str) -> Result<(), wasm_bindgen::JsValue> {
let app = egui_app::MathApp::default();
eframe::start_web(canvas_id, Box::new(app))
}
}
}

View File

@@ -1,5 +1,4 @@
#![feature(const_mut_refs)]
#![feature(total_cmp)]
mod egui_app;
mod function;