Skip to content

Commit

Permalink
Fix windows 32 and web build (#21)
Browse files Browse the repository at this point in the history
Update godot-rapier2d.gdextension
  • Loading branch information
Ughuuu committed Oct 29, 2023
1 parent ac0cac6 commit 249280e
Show file tree
Hide file tree
Showing 8 changed files with 55 additions and 23 deletions.
15 changes: 12 additions & 3 deletions .github/actions/build/action.yml
Original file line number Diff line number Diff line change
Expand Up @@ -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.
Expand Down Expand Up @@ -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

Expand Down
7 changes: 6 additions & 1 deletion .github/workflows/android_builds.yml
Original file line number Diff line number Diff line change
Expand Up @@ -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]

Expand Down
9 changes: 9 additions & 0 deletions .github/workflows/linux_builds.yml
Original file line number Diff line number Diff line change
Expand Up @@ -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 <bits/c++config.h>
arch: [{arch: "x86_64", rust: "x86_64-unknown-linux-gnu"}]
precision: [single, double]
features: [simd-stable, enhanced-determinism]
Expand All @@ -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:
Expand Down
10 changes: 5 additions & 5 deletions .github/workflows/runner.yml
Original file line number Diff line number Diff line change
Expand Up @@ -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
10 changes: 9 additions & 1 deletion .github/workflows/web_builds.yml
Original file line number Diff line number Diff line change
Expand Up @@ -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]

Expand All @@ -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
Expand Down
2 changes: 1 addition & 1 deletion .github/workflows/windows_builds.yml
Original file line number Diff line number Diff line change
Expand Up @@ -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]

Expand Down
21 changes: 9 additions & 12 deletions README.md
Original file line number Diff line number Diff line change
Expand Up @@ -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

Expand All @@ -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.
Expand Down
4 changes: 4 additions & 0 deletions bin/addons/godot-rapier2d/godot-rapier2d.gdextension
Original file line number Diff line number Diff line change
Expand Up @@ -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"
Expand All @@ -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"

0 comments on commit 249280e

Please sign in to comment.