build: fix wasm builds

This commit is contained in:
dusk 2024-11-28 23:57:29 +03:00
parent 65fb134330
commit 5486bac429
Signed by: dusk
SSH Key Fingerprint: SHA256:Abmvag+juovVufZTxyWY8KcVgrznxvBjQpJesv071Aw
5 changed files with 20 additions and 12 deletions

View File

@ -20,7 +20,7 @@ it's just a standard rust project under `rust`, so make sure you have `rustup` i
also don't forget to have godot installed and available in your `PATH` (the extension currently targets 4.3).
- **cargo features**
- enable `stats` feature to let the extension log into godot console some times for how its processing the boids.
- enable `stats` feature to let the extension log into godot console timings for how long its processing the boids.
## todo

View File

@ -8,15 +8,15 @@ linux.debug.x86_64 = "res://addons/boids/lib/boids.x86_64.so"
linux.release.x86_64 = "res://addons/boids/lib/boids.x86_64.so"
windows.debug.x86_64 = "res://addons/boids/lib/boids.x86_64.dll"
windows.release.x86_64 = "res://addons/boids/lib/boids.x86_64.dll"
macos.release = "res://addons/boids/lib/libboids.x86_64.dylib"
macos.release.arm64 = "res://addons/boids/lib/libboids.arm64.dylib"
web.debug.wasm32 = "res://addons/boids/lib/boids.wasm32.wasm"
web.release.wasm32 = "res://addons/boids/lib/boids.wasm32.wasm"
macos.release = "res://addons/boids/lib/boids.x86_64.dylib"
macos.release.arm64 = "res://addons/boids/lib/boids.arm64.dylib"
web.debug.wasm32 = "res://addons/boids/lib/boids.wasm"
web.release.wasm32 = "res://addons/boids/lib/boids.wasm"
[icons]
BoidProperties = "res://addons/boids/resources/boid_properties.svg"
BoidProperties = "res://addons/boids/resources/boid_properties.svg"
FlockProperties = "res://addons/boids/resources/flock_properties.svg"
Flock2D = "res://addons/boids/resources/flock_2d.svg"
Boid2D = "res://addons/boids/resources/boid_2d.svg"
Flock3D = "res://addons/boids/resources/flock_3d.svg"
Boid3D = "res://addons/boids/resources/boid_3d.svg"
Flock2D = "res://addons/boids/resources/flock_2d.svg"
Boid2D = "res://addons/boids/resources/boid_2d.svg"
Flock3D = "res://addons/boids/resources/flock_3d.svg"
Boid3D = "res://addons/boids/resources/boid_3d.svg"

View File

@ -15,7 +15,7 @@ _just-cmd *FLAGS="":
build $target=(host-target) *FLAGS="": _setup-env
cd rust; cross build {{FLAGS}} --profile {{profile}} --target {{target}}
install $target=(host-target): _setup-env
mv -f rust/target/{{target}}/{{`$env.profiledir`}}/{{`$env.libprefix`}}boids.{{`$env.ext`}} {{artifact-dir}}/boids.{{`$env.arch`}}.{{`$env.ext`}}
mv -f rust/target/{{target}}/{{`$env.profiledir`}}/{{`$env.libprefix`}}boids.{{`$env.ext`}} {{artifact-dir}}/boids{{`$env.arch`}}.{{`$env.ext`}}
build-install target=(host-target) *FLAGS="": (build target FLAGS) (install target)
wasm: (build-install 'wasm32-unknown-emscripten' '+nightly' '-Zbuild-std')

View File

@ -6,7 +6,14 @@ let exts = {
def getext [] { $exts | get $env.target }
def getlibprefix [] { if ($env.target | str contains "linux") { "lib" } else { "" } }
def getarch [] { $env.target | split row - | first }
def getarch [] {
let arch = $env.target | split row - | first
if ($arch == "wasm32") {
""
} else {
"." + $arch
}
}
def getprofiledir [] { if ($env.profile == 'dev') { "debug" } else { $env.profile }}
def main [command: string] {

View File

@ -3,5 +3,6 @@ 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"
]