Open6

godot rust

pantheraleopantheraleo

godot側でrustを参照。
godot/lib.gdextension
[configuration]
entry_symbol = "gdext_rust_init"
compatibility_minimum = 4.1
reloadable = true

[libraries]
linux.debug.x86_64 = "res://../rust/target/debug/lib{YourCrate}.so"
linux.release.x86_64 = "res://../rust/target/release/lib{YourCrate}.so"
windows.debug.x86_64 = "res://../rust/target/debug/{YourCrate}.dll"
windows.release.x86_64 = "res://../rust/target/release/{YourCrate}.dll"
macos.debug = "res://../rust/target/debug/lib{YourCrate}.dylib"
macos.release = "res://../rust/target/release/lib{YourCrate}.dylib"
macos.debug.arm64 = "res://../rust/target/debug/lib{YourCrate}.dylib"
macos.release.arm64 = "res://../rust/target/release/lib{YourCrate}.dylib"
web.debug.wasm32 = "res://../rust/target/wasm32-unknown-emscripten/debug/{YourCrate}.wasm"
web.release.wasm32 = "res://../rust/target/wasm32-unknown-emscripten/release/{YourCrate}.wasm"

pantheraleopantheraleo

web向けのセットアップ
https://godot-rust.github.io/book/toolchain/export-web.html

cd godot-rust/rust
cargo add godot --features "experimental-wasm","lazy-function-tables"

.cargo/config.toml
[target.wasm32-unknown-emscripten]
rustflags = [
"-C", "link-args=-sSIDE_MODULE=2",
"-C", "link-args=-pthread", # was -sUSE_PTHREADS=1 in earlier emscripten versions
"-C", "target-feature=+atomics,+bulk-memory,+mutable-globals",
"-Zlink-native-libraries=no"
]

cargo +nightly build -Zbuild-std --target wasm32-unknown-emscripten

pantheraleopantheraleo

.cargo/config.toml
[target.wasm32-unknown-emscripten]
rustflags = [
"-C","link-args=-sSIDE_MODULE=2",
"-C","link-args=-pthread", # was -sUSE_PTHREADS=1 in earlier emscripten versions
"-C","target-feature=+atomics,+bulk-memory,+mutable-globals",
"-Cllvm-args=-enable-emscripten-cxx-exceptions=0",
"-Zlink-native-libraries=no",
"-Clink-arg=-fwasm-exceptions",
"-C","link-args=-sSUPPORT_LONGJMP=wasm",
"-Cllvm-args=-enable-emscripten-cxx-exceptions=0",
"-Cllvm-args=-wasm-enable-sjlj",
"-C","link-args=-sDISABLE_EXCEPTION_CATCHING=1",
]

https://github.com/godot-rust/gdext/issues/438