2
0

msvc_arm.patch 3.1 KB

12345678910111213141516171819202122232425262728293031323334353637383940414243444546474849505152535455565758596061626364656667686970717273747576
  1. From 86a8f27aba3968713196635d8ab5234c96b73dc9 Mon Sep 17 00:00:00 2001
  2. From: Jorrit Rouwe <[email protected]>
  3. Date: Sat, 8 Apr 2023 22:13:59 +0200
  4. Subject: [PATCH] ARM version compiles under MSVC2019 (#497)
  5. ---
  6. Build/cmake_vs2019_cl_arm.bat | 3 +++
  7. Build/cmake_vs2019_cl_arm_32bit.bat | 3 +++
  8. Jolt/Core/Core.h | 9 ++++++++-
  9. Jolt/Math/Math.h | 2 +-
  10. 4 files changed, 15 insertions(+), 2 deletions(-)
  11. create mode 100644 Build/cmake_vs2019_cl_arm.bat
  12. create mode 100644 Build/cmake_vs2019_cl_arm_32bit.bat
  13. diff --git a/Build/cmake_vs2019_cl_arm.bat b/Build/cmake_vs2019_cl_arm.bat
  14. new file mode 100644
  15. index 000000000..69cd8c390
  16. --- /dev/null
  17. +++ b/Build/cmake_vs2019_cl_arm.bat
  18. @@ -0,0 +1,3 @@
  19. +@echo off
  20. +cmake -S . -B VS2019_CL_ARM -G "Visual Studio 16 2019" -A ARM64 %*
  21. +echo Open VS2019_CL_ARM\JoltPhysics.sln to build the project.
  22. \ No newline at end of file
  23. diff --git a/Build/cmake_vs2019_cl_arm_32bit.bat b/Build/cmake_vs2019_cl_arm_32bit.bat
  24. new file mode 100644
  25. index 000000000..3f23509ad
  26. --- /dev/null
  27. +++ b/Build/cmake_vs2019_cl_arm_32bit.bat
  28. @@ -0,0 +1,3 @@
  29. +@echo off
  30. +cmake -S . -B VS2019_CL_ARM_32BIT -G "Visual Studio 16 2019" -A ARM %*
  31. +echo Open VS2019_CL_ARM_32BIT\JoltPhysics.sln to build the project.
  32. \ No newline at end of file
  33. diff --git a/Jolt/Core/Core.h b/Jolt/Core/Core.h
  34. index 7219123d5..4fec4809b 100644
  35. --- a/Jolt/Core/Core.h
  36. +++ b/Jolt/Core/Core.h
  37. @@ -145,8 +145,14 @@
  38. #define JPH_SUPPRESS_WARNING_PUSH JPH_PRAGMA(warning (push))
  39. #define JPH_SUPPRESS_WARNING_POP JPH_PRAGMA(warning (pop))
  40. #define JPH_MSVC_SUPPRESS_WARNING(w) JPH_PRAGMA(warning (disable : w))
  41. +#if _MSC_VER >= 1920 && _MSC_VER < 1930
  42. + #define JPH_MSVC2019_SUPPRESS_WARNING(w) JPH_MSVC_SUPPRESS_WARNING(w)
  43. +#else
  44. + #define JPH_MSVC2019_SUPPRESS_WARNING(w)
  45. +#endif
  46. #else
  47. #define JPH_MSVC_SUPPRESS_WARNING(w)
  48. +#define JPH_MSVC2019_SUPPRESS_WARNING(w)
  49. #endif
  50. // Disable common warnings triggered by Jolt when compiling with -Wall
  51. @@ -197,7 +203,8 @@
  52. JPH_MSVC_SUPPRESS_WARNING(4582) /* 'X': constructor is not implicitly called */ \
  53. JPH_MSVC_SUPPRESS_WARNING(5219) /* implicit conversion from 'X' to 'Y', possible loss of data */ \
  54. JPH_MSVC_SUPPRESS_WARNING(4826) /* Conversion from 'X *' to 'JPH::uint64' is sign-extended. This may cause unexpected runtime behavior. (32-bit) */ \
  55. - JPH_MSVC_SUPPRESS_WARNING(5264) /* 'X': 'const' variable is not used */
  56. + JPH_MSVC_SUPPRESS_WARNING(5264) /* 'X': 'const' variable is not used */ \
  57. + JPH_MSVC2019_SUPPRESS_WARNING(5246) /* the initialization of a subobject should be wrapped in braces */
  58. // OS-specific includes
  59. #if defined(JPH_PLATFORM_WINDOWS)
  60. diff --git a/Jolt/Math/Math.h b/Jolt/Math/Math.h
  61. index 5127f2d96..c37c04b1b 100644
  62. --- a/Jolt/Math/Math.h
  63. +++ b/Jolt/Math/Math.h
  64. @@ -159,7 +159,7 @@ inline uint CountBits(uint32 inValue)
  65. #elif defined(JPH_COMPILER_MSVC)
  66. #if defined(JPH_USE_SSE4_2)
  67. return _mm_popcnt_u32(inValue);
  68. - #elif defined(JPH_USE_NEON)
  69. + #elif defined(JPH_USE_NEON) && (_MSC_VER >= 1930) // _CountOneBits not available on MSVC2019
  70. return _CountOneBits(inValue);
  71. #else
  72. inValue = inValue - ((inValue >> 1) & 0x55555555);