Skip to content

Commit 6bb9b95

Browse files
committed
🔧 Add Rust WebAssembly configuration
- Created Cargo.toml with SIMD optimization flags - Configured for high-performance WebAssembly compilation - Added dependencies for wasm-bindgen, SIMD, and serialization - Enabled LTO and size optimizations for production builds
1 parent 04b684a commit 6bb9b95

File tree

1 file changed

+42
-0
lines changed

1 file changed

+42
-0
lines changed

wasm/Cargo.toml

Lines changed: 42 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,42 @@
1+
[package]
2+
name = "js-chess-engine-wasm"
3+
version = "2.0.0"
4+
edition = "2021"
5+
authors = ["Jane Alesi <ja@satware.ai>"]
6+
description = "High-performance WebAssembly chess engine with NNUE evaluation"
7+
license = "MIT"
8+
repository = "https://github.com/jane-alesi/js-chess-engine"
9+
10+
[lib]
11+
crate-type = ["cdylib"]
12+
13+
[dependencies]
14+
wasm-bindgen = "0.2"
15+
js-sys = "0.3"
16+
wee_alloc = "0.4"
17+
serde = { version = "1.0", features = ["derive"] }
18+
serde-wasm-bindgen = "0.6"
19+
console_error_panic_hook = "0.1"
20+
21+
[dependencies.web-sys]
22+
version = "0.3"
23+
features = [
24+
"console",
25+
"Performance",
26+
"Window",
27+
]
28+
29+
[profile.release]
30+
# Optimize for size and speed
31+
opt-level = 3
32+
lto = true
33+
codegen-units = 1
34+
panic = "abort"
35+
36+
# Enable SIMD optimizations
37+
[target.'cfg(target_arch = "wasm32")']
38+
rustflags = ["-C", "target-feature=+simd128"]
39+
40+
[package.metadata.wasm-pack.profile.release]
41+
# wasm-opt optimizations
42+
wasm-opt = ["-O4", "--enable-simd"]

0 commit comments

Comments
 (0)