Skip to content
Merged
Show file tree
Hide file tree
Changes from all 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
13 changes: 11 additions & 2 deletions common/build.gradle
Original file line number Diff line number Diff line change
Expand Up @@ -57,14 +57,22 @@ tasks.register('compileRust', Exec) {
finalizedBy copyRustNativesDev
}

tasks.register('compileRustMac', Exec) {
tasks.register('compileRustMacAArch64', Exec) {
group = 'rust'
workingDir rustProjectDir
commandLine dockerCommand
args 'cargo', 'zigbuild', '--release', '--target', 'aarch64-apple-darwin'
dependsOn createContainersDirectory
}

tasks.register('compileRustMacX86', Exec) {
group = 'rust'
workingDir rustProjectDir
commandLine dockerCommand
args 'cargo', 'zigbuild', '--release', '--target', 'x86_64-apple-darwin'
dependsOn createContainersDirectory
}

tasks.register('compileRustLinuxAArch64', Exec) {
group = 'rust'
workingDir rustProjectDir
Expand Down Expand Up @@ -93,7 +101,7 @@ tasks.register('buildRustNatives') {
group = 'build'
description = 'Compiles all Rust natives and moves them to resources.'

dependsOn compileRustMac, compileRustLinux, compileRustLinuxAArch64, compileRustWindows
dependsOn compileRustMacAArch64, compileRustMacX86, compileRustLinux, compileRustLinuxAArch64, compileRustWindows
finalizedBy copyRustNatives
}

Expand All @@ -105,6 +113,7 @@ tasks.register('copyRustNatives', Copy) {

def moves = [
[src: "target/aarch64-apple-darwin/release/libsable_rapier.dylib", dest: "sable_rapier_aarch64_macos.dylib"],
[src: "target/x86_64-apple-darwin/release/libsable_rapier.dylib", dest: "sable_rapier_x86_64_macos.dylib"],
[src: "target/x86_64-unknown-linux-gnu/release/libsable_rapier.so", dest: "sable_rapier_x86_64_linux.so"],
[src: "target/aarch64-unknown-linux-gnu/release/libsable_rapier.so", dest: "sable_rapier_aarch64_linux.so"],
[src: "target/x86_64-pc-windows-gnu/release/sable_rapier.dll", dest: "sable_rapier_x86_64_windows.dll"]
Expand Down
1 change: 1 addition & 0 deletions common/src/main/rust/Dockerfile
Original file line number Diff line number Diff line change
Expand Up @@ -8,5 +8,6 @@ RUN rustup target add x86_64-pc-windows-gnu
RUN rustup target add aarch64-apple-darwin
RUN rustup target add x86_64-unknown-linux-gnu
RUN rustup target add aarch64-unknown-linux-gnu
RUN rustup target add x86_64-apple-darwin

WORKDIR /
4 changes: 4 additions & 0 deletions common/src/main/rust/rapier/.cargo/config.toml
Original file line number Diff line number Diff line change
@@ -1,2 +1,6 @@
[target.x86_64-pc-windows-gnu]
rustflags = ["-C", "link-arg=-Wl,-Brepro"]

[target.x86_64-apple-darwin]
# Required to avoid a rustc hang when building for this target.
rustflags = ["-C", "codegen-units=2"]
6 changes: 5 additions & 1 deletion common/src/main/rust/rapier/Cargo.toml
Original file line number Diff line number Diff line change
Expand Up @@ -5,7 +5,10 @@ edition = "2021"

[dependencies]
jni = "0.21.1"
rapier3d = { git = "https://github.com/ryanhcode/rapier", rev = "a728067629d4f85cef99f388e12c9b0ee8cd1164", features = ["simd-nightly", "parallel"] }
rapier3d = { git = "https://github.com/ryanhcode/rapier", rev = "a728067629d4f85cef99f388e12c9b0ee8cd1164", features = [
"simd-nightly",
"parallel",
] }
#rapier3d = { version = "0.26.1", features = [ "simd-stable" ] }
log = "0.4.22"
fern = { version = "0.6.2", features = ["colored"] }
Expand All @@ -31,4 +34,5 @@ harness = false
criterion = "0.8.2"

[profile.release]
lto = "thin"
codegen-units = 1