joltphysics: move patches to local files (#2260)

pull/2262/head
Jérôme Leclercq 2 years ago committed by GitHub
parent 55b319d09d
commit 5e16bc6e2b
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23
  1. 60
      packages/j/joltphysics/patches/v2.0.1/android_fixes.patch
  2. 93
      packages/j/joltphysics/patches/v2.0.1/armv7.patch
  3. 76
      packages/j/joltphysics/patches/v2.0.1/msvc_arm.patch
  4. 21
      packages/j/joltphysics/patches/v3.0.1/fix_fedora.patch
  5. 12
      packages/j/joltphysics/xmake.lua

@ -0,0 +1,60 @@
From 27b2c3293ea6bde6e3d6168b11d41c337f1a0913 Mon Sep 17 00:00:00 2001
From: Jorrit Rouwe <jrouwe@gmail.com>
Date: Sat, 18 Feb 2023 10:41:45 +0100
Subject: [PATCH] Upgrading android project (#437)
---
Build/Android/UnitTests/build.gradle | 1 +
Build/Android/UnitTests/src/main/AndroidManifest.xml | 3 +--
Build/Android/build.gradle | 2 +-
Build/Android/gradle/wrapper/gradle-wrapper.properties | 2 +-
4 files changed, 4 insertions(+), 4 deletions(-)
diff --git a/Build/Android/UnitTests/build.gradle b/Build/Android/UnitTests/build.gradle
index 1565ff485..d429825a6 100644
--- a/Build/Android/UnitTests/build.gradle
+++ b/Build/Android/UnitTests/build.gradle
@@ -43,6 +43,7 @@ android {
buildFeatures {
viewBinding true
}
+ namespace 'com.joltphysics.unittests'
}
dependencies {
diff --git a/Build/Android/UnitTests/src/main/AndroidManifest.xml b/Build/Android/UnitTests/src/main/AndroidManifest.xml
index f8662a355..e31e98364 100644
--- a/Build/Android/UnitTests/src/main/AndroidManifest.xml
+++ b/Build/Android/UnitTests/src/main/AndroidManifest.xml
@@ -1,6 +1,5 @@
<?xml version="1.0" encoding="utf-8"?>
-<manifest xmlns:android="http://schemas.android.com/apk/res/android"
- package="com.joltphysics.unittests">
+<manifest xmlns:android="http://schemas.android.com/apk/res/android">
<application
android:allowBackup="true"
diff --git a/Build/Android/build.gradle b/Build/Android/build.gradle
index 7b2734da3..04bc67d84 100644
--- a/Build/Android/build.gradle
+++ b/Build/Android/build.gradle
@@ -5,7 +5,7 @@ buildscript {
mavenCentral()
}
dependencies {
- classpath 'com.android.tools.build:gradle:7.2.2'
+ classpath 'com.android.tools.build:gradle:7.4.1'
// NOTE: Do not place your application dependencies here; they belong
// in the individual module build.gradle files
diff --git a/Build/Android/gradle/wrapper/gradle-wrapper.properties b/Build/Android/gradle/wrapper/gradle-wrapper.properties
index 8d8786327..7e62b17ac 100644
--- a/Build/Android/gradle/wrapper/gradle-wrapper.properties
+++ b/Build/Android/gradle/wrapper/gradle-wrapper.properties
@@ -1,5 +1,5 @@
distributionBase=GRADLE_USER_HOME
-distributionUrl=https\://services.gradle.org/distributions/gradle-7.3.3-bin.zip
+distributionUrl=https\://services.gradle.org/distributions/gradle-7.5-bin.zip
distributionPath=wrapper/dists
zipStorePath=wrapper/dists
zipStoreBase=GRADLE_USER_HOME

@ -0,0 +1,93 @@
From 4e457165ee019fb9002b53ffa9a5f95b99b22113 Mon Sep 17 00:00:00 2001
From: Jorrit Rouwe <jrouwe@gmail.com>
Date: Mon, 10 Apr 2023 16:46:28 +0200
Subject: [PATCH] Experimental linux armv7a support (#500)
---
Build/Android/build.gradle | 2 +-
Jolt/Core/FPControlWord.h | 33 ++++++++++++++++++++++++++++++++-
Jolt/Core/TickCounter.h | 4 +++-
3 files changed, 36 insertions(+), 3 deletions(-)
diff --git a/Build/Android/build.gradle b/Build/Android/build.gradle
index 04bc67d84..de0c8f88b 100644
--- a/Build/Android/build.gradle
+++ b/Build/Android/build.gradle
@@ -5,7 +5,7 @@ buildscript {
mavenCentral()
}
dependencies {
- classpath 'com.android.tools.build:gradle:7.4.1'
+ classpath 'com.android.tools.build:gradle:7.4.2'
// NOTE: Do not place your application dependencies here; they belong
// in the individual module build.gradle files
diff --git a/Jolt/Core/FPControlWord.h b/Jolt/Core/FPControlWord.h
index 9c47a040a..b66344da0 100644
--- a/Jolt/Core/FPControlWord.h
+++ b/Jolt/Core/FPControlWord.h
@@ -60,7 +60,7 @@ class FPControlWord : public NonCopyable
unsigned int mPrevState;
};
-#elif defined(JPH_CPU_ARM)
+#elif defined(JPH_CPU_ARM) && defined(JPH_USE_NEON)
/// Helper class that needs to be put on the stack to update the state of the floating point control word.
/// This state is kept per thread.
@@ -91,6 +91,37 @@ class FPControlWord : public NonCopyable
uint64 mPrevState;
};
+#elif defined(JPH_CPU_ARM)
+
+/// Helper class that needs to be put on the stack to update the state of the floating point control word.
+/// This state is kept per thread.
+template <uint32 Value, uint32 Mask>
+class FPControlWord : public NonCopyable
+{
+public:
+ FPControlWord()
+ {
+ uint32 val;
+ asm volatile("vmrs %0, fpscr" : "=r" (val));
+ mPrevState = val;
+ val &= ~Mask;
+ val |= Value;
+ asm volatile("vmsr fpscr, %0" : /* no output */ : "r" (val));
+ }
+
+ ~FPControlWord()
+ {
+ uint32 val;
+ asm volatile("vmrs %0, fpscr" : "=r" (val));
+ val &= ~Mask;
+ val |= mPrevState & Mask;
+ asm volatile("vmsr fpscr, %0" : /* no output */ : "r" (val));
+ }
+
+private:
+ uint32 mPrevState;
+};
+
#elif defined(JPH_CPU_WASM)
// Not supported
diff --git a/Jolt/Core/TickCounter.h b/Jolt/Core/TickCounter.h
index a9d1272a3..9a8967d31 100644
--- a/Jolt/Core/TickCounter.h
+++ b/Jolt/Core/TickCounter.h
@@ -27,10 +27,12 @@ JPH_INLINE uint64 GetProcessorTickCount()
return JPH_PLATFORM_BLUE_GET_TICKS();
#elif defined(JPH_CPU_X86)
return __rdtsc();
-#elif defined(JPH_CPU_ARM)
+#elif defined(JPH_CPU_ARM) && defined(JPH_USE_NEON)
uint64 val;
asm volatile("mrs %0, cntvct_el0" : "=r" (val));
return val;
+#elif defined(JPH_CPU_ARM)
+ return 0; // Not supported
#elif defined(JPH_CPU_WASM)
return 0; // Not supported
#else

@ -0,0 +1,76 @@
From 86a8f27aba3968713196635d8ab5234c96b73dc9 Mon Sep 17 00:00:00 2001
From: Jorrit Rouwe <jrouwe@gmail.com>
Date: Sat, 8 Apr 2023 22:13:59 +0200
Subject: [PATCH] ARM version compiles under MSVC2019 (#497)
---
Build/cmake_vs2019_cl_arm.bat | 3 +++
Build/cmake_vs2019_cl_arm_32bit.bat | 3 +++
Jolt/Core/Core.h | 9 ++++++++-
Jolt/Math/Math.h | 2 +-
4 files changed, 15 insertions(+), 2 deletions(-)
create mode 100644 Build/cmake_vs2019_cl_arm.bat
create mode 100644 Build/cmake_vs2019_cl_arm_32bit.bat
diff --git a/Build/cmake_vs2019_cl_arm.bat b/Build/cmake_vs2019_cl_arm.bat
new file mode 100644
index 000000000..69cd8c390
--- /dev/null
+++ b/Build/cmake_vs2019_cl_arm.bat
@@ -0,0 +1,3 @@
+@echo off
+cmake -S . -B VS2019_CL_ARM -G "Visual Studio 16 2019" -A ARM64 %*
+echo Open VS2019_CL_ARM\JoltPhysics.sln to build the project.
\ No newline at end of file
diff --git a/Build/cmake_vs2019_cl_arm_32bit.bat b/Build/cmake_vs2019_cl_arm_32bit.bat
new file mode 100644
index 000000000..3f23509ad
--- /dev/null
+++ b/Build/cmake_vs2019_cl_arm_32bit.bat
@@ -0,0 +1,3 @@
+@echo off
+cmake -S . -B VS2019_CL_ARM_32BIT -G "Visual Studio 16 2019" -A ARM %*
+echo Open VS2019_CL_ARM_32BIT\JoltPhysics.sln to build the project.
\ No newline at end of file
diff --git a/Jolt/Core/Core.h b/Jolt/Core/Core.h
index 7219123d5..4fec4809b 100644
--- a/Jolt/Core/Core.h
+++ b/Jolt/Core/Core.h
@@ -145,8 +145,14 @@
#define JPH_SUPPRESS_WARNING_PUSH JPH_PRAGMA(warning (push))
#define JPH_SUPPRESS_WARNING_POP JPH_PRAGMA(warning (pop))
#define JPH_MSVC_SUPPRESS_WARNING(w) JPH_PRAGMA(warning (disable : w))
+#if _MSC_VER >= 1920 && _MSC_VER < 1930
+ #define JPH_MSVC2019_SUPPRESS_WARNING(w) JPH_MSVC_SUPPRESS_WARNING(w)
+#else
+ #define JPH_MSVC2019_SUPPRESS_WARNING(w)
+#endif
#else
#define JPH_MSVC_SUPPRESS_WARNING(w)
+#define JPH_MSVC2019_SUPPRESS_WARNING(w)
#endif
// Disable common warnings triggered by Jolt when compiling with -Wall
@@ -197,7 +203,8 @@
JPH_MSVC_SUPPRESS_WARNING(4582) /* 'X': constructor is not implicitly called */ \
JPH_MSVC_SUPPRESS_WARNING(5219) /* implicit conversion from 'X' to 'Y', possible loss of data */ \
JPH_MSVC_SUPPRESS_WARNING(4826) /* Conversion from 'X *' to 'JPH::uint64' is sign-extended. This may cause unexpected runtime behavior. (32-bit) */ \
- JPH_MSVC_SUPPRESS_WARNING(5264) /* 'X': 'const' variable is not used */
+ JPH_MSVC_SUPPRESS_WARNING(5264) /* 'X': 'const' variable is not used */ \
+ JPH_MSVC2019_SUPPRESS_WARNING(5246) /* the initialization of a subobject should be wrapped in braces */
// OS-specific includes
#if defined(JPH_PLATFORM_WINDOWS)
diff --git a/Jolt/Math/Math.h b/Jolt/Math/Math.h
index 5127f2d96..c37c04b1b 100644
--- a/Jolt/Math/Math.h
+++ b/Jolt/Math/Math.h
@@ -159,7 +159,7 @@ inline uint CountBits(uint32 inValue)
#elif defined(JPH_COMPILER_MSVC)
#if defined(JPH_USE_SSE4_2)
return _mm_popcnt_u32(inValue);
- #elif defined(JPH_USE_NEON)
+ #elif defined(JPH_USE_NEON) && (_MSC_VER >= 1930) // _CountOneBits not available on MSVC2019
return _CountOneBits(inValue);
#else
inValue = inValue - ((inValue >> 1) & 0x55555555);

@ -0,0 +1,21 @@
From 2b418d38a36327e29f156b3c640e83f8c6caf067 Mon Sep 17 00:00:00 2001
From: =?UTF-8?q?J=C3=A9r=C3=B4me=20Leclercq?= <lynix680@gmail.com>
Date: Thu, 27 Apr 2023 17:51:09 +0200
Subject: [PATCH] Add missing standard include (#517)
---
Jolt/Core/Core.h | 1 +
1 file changed, 1 insertion(+)
diff --git a/Jolt/Core/Core.h b/Jolt/Core/Core.h
index 39c49fa71..a5b5aaac3 100644
--- a/Jolt/Core/Core.h
+++ b/Jolt/Core/Core.h
@@ -296,6 +296,7 @@ JPH_SUPPRESS_WARNINGS_STD_BEGIN
#include <sstream>
#include <functional>
#include <algorithm>
+#include <cstdint>
JPH_SUPPRESS_WARNINGS_STD_END
#include <limits.h>
#include <float.h>

@ -9,13 +9,13 @@ package("joltphysics")
add_versions("v3.0.0", "f8d756ae3471a32f2ee7e07475df2f7a34752f0fdd05e9a7ed2e7ce3dcdcd574")
add_versions("v2.0.1", "96ae2e8691c4802e56bf2587da30f2cc86b8abe82a78bc2398065bd87dd718af")
-- patch for missing standard include (fixes Fedora compilation)
add_patches("v3.0.1", "https://github.com/jrouwe/JoltPhysics/commit/2b418d38a36327e29f156b3c640e83f8c6caf067.patch", "4039ab991e4e847ec94517ce3bf459d6ee67f291116006d1bf9228f26f1dc86e")
add_patches("v3.0.0", "https://github.com/jrouwe/JoltPhysics/commit/2b418d38a36327e29f156b3c640e83f8c6caf067.patch", "4039ab991e4e847ec94517ce3bf459d6ee67f291116006d1bf9228f26f1dc86e")
add_patches("v2.0.1", "https://github.com/jrouwe/JoltPhysics/commit/2b418d38a36327e29f156b3c640e83f8c6caf067.patch", "4039ab991e4e847ec94517ce3bf459d6ee67f291116006d1bf9228f26f1dc86e")
add_patches("v3.0.1", path.join(os.scriptdir(), "patches", "v3.0.1", "fix_fedora.patch"), "12be1294669852a9f15cb01a636fde72fb5f36b59cbcc1d4f931d76c454c3150")
add_patches("v3.0.0", path.join(os.scriptdir(), "patches", "v3.0.1", "fix_fedora.patch"), "12be1294669852a9f15cb01a636fde72fb5f36b59cbcc1d4f931d76c454c3150")
add_patches("v2.0.1", path.join(os.scriptdir(), "patches", "v3.0.1", "fix_fedora.patch"), "12be1294669852a9f15cb01a636fde72fb5f36b59cbcc1d4f931d76c454c3150")
-- patches for Android/ARMv7 and VS2019 ARM64 support
add_patches("v2.0.1", "https://github.com/jrouwe/JoltPhysics/commit/27b2c3293ea6bde6e3d6168b11d41c337f1a0913.patch", "43b3d38ea5a01c281ad7b580859acaf0b30eac9a7bdc271a54199fcc88b8d491")
add_patches("v2.0.1", "https://github.com/jrouwe/JoltPhysics/commit/86a8f27aba3968713196635d8ab5234c96b73dc9.patch", "f6d368787ae7259dfbece7e8f1c1ba6af4d39f0f7c09a0f15186882bd827ed15")
add_patches("v2.0.1", "https://github.com/jrouwe/JoltPhysics/commit/4e457165ee019fb9002b53ffa9a5f95b99b22113.patch", "cbc59db0a0c786d473a05e84ed6f980c5288e531af44923864648c4471ccbd88")
add_patches("v2.0.1", path.join(os.scriptdir(), "patches", "v2.0.1", "android_fixes.patch"), "43b3d38ea5a01c281ad7b580859acaf0b30eac9a7bdc271a54199fcc88b8d491")
add_patches("v2.0.1", path.join(os.scriptdir(), "patches", "v2.0.1", "armv7.patch"), "cbc59db0a0c786d473a05e84ed6f980c5288e531af44923864648c4471ccbd88")
add_patches("v2.0.1", path.join(os.scriptdir(), "patches", "v2.0.1", "msvc_arm.patch"), "f6d368787ae7259dfbece7e8f1c1ba6af4d39f0f7c09a0f15186882bd827ed15")
add_configs("cross_platform_deterministic", { description = "Turns on behavior to attempt cross platform determinism", default = false, type = "boolean" })
add_configs("debug_renderer", { description = "Adds support to draw lines and triangles, used to be able to debug draw the state of the world", default = true, type = "boolean" })

Loading…
Cancel
Save