diff --git a/.github/actions/build/action.yml b/.github/actions/build/action.yml index aee2233a..4945ee83 100644 --- a/.github/actions/build/action.yml +++ b/.github/actions/build/action.yml @@ -9,6 +9,14 @@ inputs: required: true default: '' description: Rust target platform. + rust_extra_flags: + required: false + default: '' + description: Rust extra flags. + rust_env_flags: + required: false + default: '' + descriptio: RUSTFLAGS env var. arch: default: '' description: Target architecture. @@ -60,11 +68,12 @@ runs: run: | cd src/rapier2d-wrapper && \ rustup target add ${{ inputs.rust_target }} && \ - cargo build --target=${{ inputs.rust_target }} --release --features="${{ inputs.features }},${{ inputs.precision }}" && \ + cargo build --target=${{ inputs.rust_target }} --release --features="${{ inputs.features }},${{ inputs.precision }}" ${{ inputs.rust_extra_flags}} && \ mkdir -p target/release && \ rm -rf target/release && \ - cp -rf target/${{ inputs.rust_target }}/release target/release && \ - ls -l target/release + cp -rf target/${{ inputs.rust_target }}/release target/release + env: + RUSTFLAGS: ${{ inputs.rust_env_flags }} - name: Build Rapier Macos Universal shell: sh diff --git a/.github/workflows/android_builds.yml b/.github/workflows/android_builds.yml index a99e415b..2e7e2825 100644 --- a/.github/workflows/android_builds.yml +++ b/.github/workflows/android_builds.yml @@ -9,7 +9,12 @@ jobs: strategy: fail-fast: false matrix: - arch: [{arch: "x86_64", rust: "x86_64-linux-android"}, {arch: "arm64",rust: "aarch64-linux-android"}] + # TODO add these as well {arch: "x86_32", rust: "i686-linux-android"}, {arch: "arm32", rust: "armv7-linux-androideabi"}] + # Right now it's giving these errors: + # ld: error: cannot open crtbegin_so.o: No such file or directory + # ld: error: unable to find library -lc++ + # ld: error: cannot open crtend_so.o: No such file or directory + arch: [{arch: "x86_64", rust: "x86_64-linux-android"}, {arch: "arm64",rust: "aarch64-linux-android"},] precision: [single, double] features: [simd-stable, enhanced-determinism] diff --git a/.github/workflows/linux_builds.yml b/.github/workflows/linux_builds.yml index b7ab3f61..29e33564 100644 --- a/.github/workflows/linux_builds.yml +++ b/.github/workflows/linux_builds.yml @@ -9,6 +9,11 @@ jobs: strategy: fail-fast: false matrix: + # TODO , {arch: "x86_32", rust: "i686-unknown-linux-gnu"}, {arch: "arm64", rust: "aarch64-unknown-linux-gnu"}] + # Right now it's giving this error (arm64): + # cc1plus: error: bad value ('armv8-a') for '-march=' switch + # Right now it's giving this error (x64_32): + # /usr/include/c++/9/cstddef:49:10: fatal error: bits/c++config.h: No such file or directory 49 | #include arch: [{arch: "x86_64", rust: "x86_64-unknown-linux-gnu"}] precision: [single, double] features: [simd-stable, enhanced-determinism] @@ -19,6 +24,10 @@ jobs: submodules: true fetch-depth: 0 + - name: Fix 32bit and arm64 libs + run: | + sudo apt-get install gcc-multilib g++-multilib + - name: Build ${{ matrix.arch.arch }} ${{ matrix.precision }} ${{ matrix.features }} uses: ./.github/actions/build with: diff --git a/.github/workflows/runner.yml b/.github/workflows/runner.yml index c9bc818d..d9753906 100644 --- a/.github/workflows/runner.yml +++ b/.github/workflows/runner.yml @@ -38,8 +38,8 @@ jobs: name: 🏁 Windows needs: static-checks uses: ./.github/workflows/windows_builds.yml - # Needs nightly toolchain, todo investigate more. - #web-build: - # name: 🌐 Web Builds - # needs: static-checks - # uses: ./.github/workflows/web_builds.yml + + web-build: + name: 🌐 Web Builds + needs: static-checks + uses: ./.github/workflows/web_builds.yml diff --git a/.github/workflows/web_builds.yml b/.github/workflows/web_builds.yml index 9c4a0770..11c745e4 100644 --- a/.github/workflows/web_builds.yml +++ b/.github/workflows/web_builds.yml @@ -9,7 +9,7 @@ jobs: strategy: fail-fast: false matrix: - arch: [{arch: "wasm32", rust: "wasm32-unknown-emscripten"}] + arch: [{arch: "wasm32", rust: "wasm32-unknown-emscripten", rust_extra_flags: "-Z build-std=panic_abort,std"}] precision: [single, double] features: [simd-stable, enhanced-determinism] @@ -29,14 +29,22 @@ jobs: run: | emcc -v + - name: Rust Install Nightly + run: | + rustup toolchain install nightly + rustup override set nightly + rustup component add rust-src --toolchain nightly-x86_64-unknown-linux-gnu + - name: Build ${{ matrix.arch.arch }} ${{ matrix.precision }} ${{ matrix.features }} uses: ./.github/actions/build with: arch: ${{ matrix.arch.arch }} rust_target: ${{ matrix.arch.rust }} + rust_extra_flags: ${{ matrix.arch.rust_extra_flags }} platform: web precision: ${{ matrix.precision }} features: ${{ matrix.features }},wasm-bindgen + rust_env_flags: "-C target-feature=+atomics,+bulk-memory" - name: Upload ${{ matrix.arch.arch }} ${{ matrix.precision }} ${{ matrix.features }} uses: ./.github/actions/upload diff --git a/.github/workflows/windows_builds.yml b/.github/workflows/windows_builds.yml index 5079f830..ea87046c 100644 --- a/.github/workflows/windows_builds.yml +++ b/.github/workflows/windows_builds.yml @@ -9,7 +9,7 @@ jobs: strategy: fail-fast: false matrix: - arch: [{arch: "x86_64", rust: "x86_64-pc-windows-msvc"}] + arch: [{arch: "x86_64", rust: "x86_64-pc-windows-msvc"}, {arch: "x86_32", rust: "i686-pc-windows-msvc"}] precision: [single, double] features: [simd-stable, enhanced-determinism] diff --git a/README.md b/README.md index e39a490f..b2e3a5f1 100644 --- a/README.md +++ b/README.md @@ -25,22 +25,11 @@ A 2d [rapier](https://github.com/dimforge/rapier) physics server for [Godot Engi ## Supported Platforms -Curently the Godot Box2d addon builds for: - -- Windows (x86_64) +- Windows (x86_64, x86_32) - macOS (x86-64 + arm64 Universal) - Linux (x86_64) - Android (x86_64, arm64) - iOS (arm64) without signing -- Web (wasm32) - -# Limitations - -- One way direction for CharacterBody2D missing. -- Static Body Constant Speed for CharacterBody2D and RigidBody2D missing. -- Spring Joint missing. -- Shape skewing missing. -- Shape Cast Margin isn't supported. # Features @@ -50,6 +39,14 @@ Curently the Godot Box2d addon builds for: [More on different rapier features](https://rapier.rs/docs/user_guides/rust/getting_started) +# Limitations + +- One way direction for CharacterBody2D missing. +- Static Body Constant Speed for CharacterBody2D and RigidBody2D missing. +- Spring Joint missing. +- Shape skewing missing. +- Shape Cast Margin isn't supported. + # Installation - Automatic (Recommended): Download the plugin from the official [Godot Asset Store](https://godotengine.org/asset-library/asset/2267) using the `AssetLib` tab in Godot. diff --git a/bin/addons/godot-rapier2d/godot-rapier2d.gdextension b/bin/addons/godot-rapier2d/godot-rapier2d.gdextension index a07cada0..d778eba6 100644 --- a/bin/addons/godot-rapier2d/godot-rapier2d.gdextension +++ b/bin/addons/godot-rapier2d/godot-rapier2d.gdextension @@ -10,6 +10,8 @@ macos.debug = "res://addons/godot-rapier2d/bin/libphysics_server_rapier2d.macos. macos.release = "res://addons/godot-rapier2d/bin/libphysics_server_rapier2d.macos.template_release.framework" windows.debug.x86_64 = "res://addons/godot-rapier2d/bin/libphysics_server_rapier2d.windows.template_debug.x86_64.dll" windows.release.x86_64 = "res://addons/godot-rapier2d/bin/libphysics_server_rapier2d.windows.template_release.x86_64.dll" +windows.debug.x86_32 = "res://addons/godot-rapier2d/bin/libphysics_server_rapier2d.windows.template_debug.x86_32.dll" +windows.release.x86_32 = "res://addons/godot-rapier2d/bin/libphysics_server_rapier2d.windows.template_release.x86_32.dll" linux.debug.x86_64 = "res://addons/godot-rapier2d/bin/libphysics_server_rapier2d.linux.template_debug.x86_64.so" linux.release.x86_64 = "res://addons/godot-rapier2d/bin/libphysics_server_rapier2d.linux.template_release.x86_64.so" android.debug.x86_64 = "res://addons/godot-rapier2d/bin/libphysics_server_rapier2d.android.template_debug.x86_64.so" @@ -18,3 +20,5 @@ android.debug.arm64 = "res://addons/godot-rapier2d/bin/libphysics_server_rapier2 android.release.arm64 = "res://addons/godot-rapier2d/bin/libphysics_server_rapier2d.android.template_release.arm64.so" ios.debug = "res://addons/godot-rapier2d/bin/libphysics_server_rapier2d.ios.template_debug.arm64.dylib" ios.release = "res://addons/godot-rapier2d/bin/libphysics_server_rapier2d.ios.template_release.arm64.dylib" +web.debug.wasm32 = "res://addons/godot-rapier2d/bin/libphysics_server_rapier2d.web.template_debug.wasm32.wasm" +web.release.wasm32 = "res://addons/godot-rapier2d/bin/libphysics_server_rapier2d.web.template_release.wasm32.wasm"