Przeglądaj źródła

ARM version compiles under MSVC2019 (#497)

Jorrit Rouwe 2 lat temu
rodzic
commit
86a8f27aba

+ 3 - 0
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.

+ 3 - 0
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.

+ 8 - 1
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)

+ 1 - 1
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);