Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

attempt to fix #314 #315

Open
wants to merge 3 commits into
base: master
Choose a base branch
from
Open
Show file tree
Hide file tree
Changes from 2 commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
3 changes: 3 additions & 0 deletions builds/prepare_builds/templates/build_rust.sh.tera
Original file line number Diff line number Diff line change
@@ -1,5 +1,8 @@
#!/bin/sh

# Cleaning rust because changing rust flags may lead to different build results.
cargo clean

{{ additional_rust_flags }} npx wasm-pack build
sed -i.bak 's#dimforge_rapier#@dimforge/rapier#g' pkg/package.json
sed -i.bak 's/"rapier_wasm{{ dimension }}d_bg.wasm"/"*"/g' pkg/package.json
Expand Down
8 changes: 7 additions & 1 deletion rapier-compat/build-rust.sh
Original file line number Diff line number Diff line change
Expand Up @@ -41,4 +41,10 @@ fi

# Working dir in wasm-pack is the project root so we need that "../../"

wasm-pack build --target web --out-dir "../../rapier-compat/builds/${dimension}d${feature_postfix}/wasm-build" "$rust_source_directory"
if [[ $feature == "simd" ]]; then
export additional_rustflags='-C target-feature=+simd128'
Copy link
Contributor Author

@Vrixyz Vrixyz Mar 25, 2025

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I tried export RUSTFLAGS=[...] but this didn't work (wasn't used by wasm-pack), I think my shell expertise is needing an update, there's probably a slightly cleaner way to achieve this.

in the meantime just removing the export in the only self-improvement I can come up with.

else
export additional_rustflags=''
fi

RUSTFLAGS="${additional_rustflags}" wasm-pack --verbose build --target web --out-dir "../../rapier-compat/builds/${dimension}d${feature_postfix}/wasm-build" "$rust_source_directory"