From 719944387762720286b1d9e6892d3c3363ff32cb Mon Sep 17 00:00:00 2001 From: dusk Date: Fri, 30 Aug 2024 21:51:12 +0300 Subject: [PATCH] build: configure some building stuffs --- addons/boids/boids.gdextension | 2 ++ rust/.cargo/config.toml | 7 +++++++ rust/Cargo.toml | 5 ++++- rust/rust-toolchain.toml | 3 +++ 4 files changed, 16 insertions(+), 1 deletion(-) create mode 100644 rust/.cargo/config.toml create mode 100644 rust/rust-toolchain.toml diff --git a/addons/boids/boids.gdextension b/addons/boids/boids.gdextension index f87e151..3a3f0c0 100644 --- a/addons/boids/boids.gdextension +++ b/addons/boids/boids.gdextension @@ -10,6 +10,8 @@ linux.release.x86_64 = "res://addons/boids/lib/libboids.x86.so" windows.release.x86_64 = "res://addons/boids/lib/boids.x86.dll" macos.release = "res://addons/boids/lib/libboids.x86.dylib" macos.release.arm64 = "res://addons/boids/lib/libboids.arm64.dylib" +web.debug.wasm32 = "res://rust/target/wasm32-unknown-emscripten/debug/boids.wasm" +web.release.wasm32 = "res://addons/boids/lib/boids.wasm" [icons] BoidProperties = "res://addons/boids/resources/boid_properties.svg" diff --git a/rust/.cargo/config.toml b/rust/.cargo/config.toml new file mode 100644 index 0000000..6e053ae --- /dev/null +++ b/rust/.cargo/config.toml @@ -0,0 +1,7 @@ +[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" +] \ No newline at end of file diff --git a/rust/Cargo.toml b/rust/Cargo.toml index 4805978..7b80ede 100644 --- a/rust/Cargo.toml +++ b/rust/Cargo.toml @@ -16,5 +16,8 @@ rayon = { version = "1.10" } rustc-hash = "2" indexmap = "2.4.0" +[target.wasm32-unknown-emscripten.dependencies] +godot = { git = "https://github.com/godot-rust/gdext", branch = "master", features = ["api-4-3", "experimental-threads", "register-docs", "experimental-wasm", "lazy-function-tables"] } + [profile.dev] -opt-level = 3 \ No newline at end of file +opt-level = 1 \ No newline at end of file diff --git a/rust/rust-toolchain.toml b/rust/rust-toolchain.toml new file mode 100644 index 0000000..8292992 --- /dev/null +++ b/rust/rust-toolchain.toml @@ -0,0 +1,3 @@ +[toolchain] +channel = "nightly" +targets = ["x86_64-unknown-linux-gnu", "aarch64-apple-darwin", "wasm32-unknown-emscripten"] \ No newline at end of file