content: # ref: https://github.com/pykeio/ort/blob/main/examples/wasm-emscripten/.cargo/config.toml
  [unstable]
  build-std = ["std"]
  
  [build]
  target = "wasm32-unknown-emscripten"
  rustflags = [
      "-Clink-args=-Os -flto -fno-rtti -pthread -msse4.2 -msimd128 -sEXPORT_ALL -sSTACK_SIZE=5MB -sDEFAULT_PTHREAD_STACK_SIZE=2MB -sPTHREAD_POOL_SIZE=20 -sINITIAL_MEMORY=1GB -sEXPORT_ES6 --no-entry",
      "-Ctarget-feature=+atomics,+bulk-memory,+mutable-globals"
  ]
  
  [target.'cfg(target_env="msvc")']
  rustflags = [
      "-C", "link-arg=/entry:main"
  ]
  
  [target.'cfg(all(unix, not(target_os = "emscripten")))']
  rustflags = ["-C", "link-arg=-e main"]
  
  [env]
  CXXFLAGS_wasm32_unknown_emscripten = "-Os -flto -fexceptions -fno-rtti -pthread -msse4.2 -msimd128"
  
  [profile.release]
  debug = false
  opt-level = "s"
  
  # Debug build might benefit from further flags, but one cannot yet set debug-only rustflags.
  # See: https://github.com/rust-lang/cargo/issues/10271
  # -fexceptions, -gsource-map, -sASSERTIONS, -sNO_DISABLE_EXCEPTION_CATCHING
  # Observing emscripten's generation/linking:
  # (rustflags): --emit=llvm-ir
  # (env): RUSTC_LOG=rustc_codegen_ssa::back::link=info; EMCC_DEBUG=2