From d1e89f9967ba372e863b32abcad7c2a56623fcd4 Mon Sep 17 00:00:00 2001 From: Simon Gardling Date: Tue, 26 Apr 2022 23:24:53 -0400 Subject: [PATCH] build changes --- .cargo/config.toml | 3 --- Cargo.toml | 10 ++-------- build.sh | 6 ++++-- 3 files changed, 6 insertions(+), 13 deletions(-) delete mode 100644 .cargo/config.toml diff --git a/.cargo/config.toml b/.cargo/config.toml deleted file mode 100644 index 06d0366..0000000 --- a/.cargo/config.toml +++ /dev/null @@ -1,3 +0,0 @@ -[target.wasm32-unknown-unknown] -rustflags = ["-C", "linker-plugin-lto=yes", "-C", "inline-threshold=275"] - diff --git a/Cargo.toml b/Cargo.toml index a3c4938..a199bdc 100644 --- a/Cargo.toml +++ b/Cargo.toml @@ -19,8 +19,6 @@ opt-level = "z" #optimize for size lto = "fat" strip = true panic = "abort" -overflow-checks = false -debug-assertions = false [profile.dev] debug = true @@ -39,9 +37,7 @@ epi = { git = "https://github.com/Titaniumtown/egui.git", default-features = fal emath = { git = "https://github.com/Titaniumtown/egui.git", default-features = false } shadow-rs = { version = "0.11", default-features = false } -const_format = { version = "0.2", default-features = false, features = [ - "fmt", -] } +const_format = { version = "0.2", default-features = false, features = ["fmt"] } cfg-if = "1" lazy_static = "1" tar = "0.4" @@ -71,9 +67,7 @@ async-lock = { version = "2.5", optional = true } instant = { version = "0.1", features = ["wasm-bindgen"] } console_error_panic_hook = "0.1" wee_alloc = "0.4" -wasm-bindgen = { version = "0.2", default-features = false, features = [ - "std", -] } +wasm-bindgen = { version = "0.2", default-features = false, features = ["std"] } web-sys = "0.3" tracing-wasm = "0.2" diff --git a/build.sh b/build.sh index da54839..9faf290 100755 --- a/build.sh +++ b/build.sh @@ -11,16 +11,18 @@ wasm_opt() { wasm-opt -Oz -o pkg/ytbn_graphing_software_bg_2.wasm pkg/ytbn_graphing_software_bg.wasm mv pkg/ytbn_graphing_software_bg_2.wasm pkg/ytbn_graphing_software_bg.wasm } +#export RUSTFLAGS="--cfg=web_sys_unstable_apis" +export COMMON_PACK="--target web --no-typescript -- -Z build-std=std,panic_abort -C linker-plugin-lto=yes -C inline-threshold=275" if test "$1" == "" || test "$1" == "release"; then - RUSTFLAGS=--cfg=web_sys_unstable_apis wasm-pack build --target web --release --no-typescript + wasm-pack build --release echo "Binary size (pre-wasm_opt): $(du -sb pkg/ytbn_graphing_software_bg.wasm)" wasm_opt #apply wasm optimizations echo "Binary size (pre-strip): $(du -sb pkg/ytbn_graphing_software_bg.wasm)" llvm-strip --strip-all pkg/ytbn_graphing_software_bg.wasm elif test "$1" == "debug"; then - RUSTFLAGS=--cfg=web_sys_unstable_apis wasm-pack build --target web --dev --no-typescript + wasm-pack build --dev $COMMON_PACK else echo "ERROR: build.sh, argument invalid" exit 1