12345678910111213141516171819202122232425262728293031323334353637383940414243444546474849505152535455565758596061626364656667686970717273747576 |
- From 86a8f27aba3968713196635d8ab5234c96b73dc9 Mon Sep 17 00:00:00 2001
- From: Jorrit Rouwe <[email protected]>
- 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);
|