allow to compile using clang-cl on visual studio (disable SSE)

This commit is contained in:
Erwin Coumans
2019-12-11 13:07:53 -08:00
parent 9a981f4736
commit 202cf18995
7 changed files with 37 additions and 25 deletions

View File

@@ -199,7 +199,6 @@ project "App_BulletExampleBrowser"
"../RigidBody/RigidBodySoftContact.cpp", "../RigidBody/RigidBodySoftContact.cpp",
"../ThirdPartyLibs/stb_image/stb_image.cpp", "../ThirdPartyLibs/stb_image/stb_image.cpp",
"../ThirdPartyLibs/Wavefront/tiny_obj_loader.*", "../ThirdPartyLibs/Wavefront/tiny_obj_loader.*",
"../ThirdPartyLibs/BussIK/*",
"../GyroscopicDemo/GyroscopicSetup.cpp", "../GyroscopicDemo/GyroscopicSetup.cpp",
"../GyroscopicDemo/GyroscopicSetup.h", "../GyroscopicDemo/GyroscopicSetup.h",
"../ThirdPartyLibs/tinyxml2/tinyxml2.cpp", "../ThirdPartyLibs/tinyxml2/tinyxml2.cpp",

View File

@@ -72,8 +72,6 @@ myfiles =
"plugins/collisionFilterPlugin/collisionFilterPlugin.cpp", "plugins/collisionFilterPlugin/collisionFilterPlugin.cpp",
"plugins/pdControlPlugin/pdControlPlugin.cpp", "plugins/pdControlPlugin/pdControlPlugin.cpp",
"plugins/pdControlPlugin/pdControlPlugin.h", "plugins/pdControlPlugin/pdControlPlugin.h",
"../OpenGLWindow/SimpleCamera.cpp",
"../OpenGLWindow/SimpleCamera.h",
"../Importers/ImportURDFDemo/ConvertRigidBodies2MultiBody.h", "../Importers/ImportURDFDemo/ConvertRigidBodies2MultiBody.h",
"../Importers/ImportURDFDemo/MultiBodyCreationInterface.h", "../Importers/ImportURDFDemo/MultiBodyCreationInterface.h",
"../Importers/ImportURDFDemo/MyMultiBodyCreator.cpp", "../Importers/ImportURDFDemo/MyMultiBodyCreator.cpp",
@@ -115,6 +113,8 @@ myfiles =
files { files {
myfiles, myfiles,
"../OpenGLWindow/SimpleCamera.cpp",
"../OpenGLWindow/SimpleCamera.h",
"main.cpp", "main.cpp",
} }

View File

@@ -109,8 +109,6 @@ if not _OPTIONS["no-enet"] then
"../../examples/SharedMemory/plugins/tinyRendererPlugin/tinyRendererPlugin.h", "../../examples/SharedMemory/plugins/tinyRendererPlugin/tinyRendererPlugin.h",
"../../examples/SharedMemory/plugins/tinyRendererPlugin/TinyRendererVisualShapeConverter.cpp", "../../examples/SharedMemory/plugins/tinyRendererPlugin/TinyRendererVisualShapeConverter.cpp",
"../../examples/SharedMemory/plugins/tinyRendererPlugin/TinyRendererVisualShapeConverter.h", "../../examples/SharedMemory/plugins/tinyRendererPlugin/TinyRendererVisualShapeConverter.h",
"../../examples/OpenGLWindow/SimpleCamera.cpp",
"../../examples/OpenGLWindow/SimpleCamera.h",
"../../examples/TinyRenderer/geometry.cpp", "../../examples/TinyRenderer/geometry.cpp",
"../../examples/TinyRenderer/model.cpp", "../../examples/TinyRenderer/model.cpp",
"../../examples/TinyRenderer/tgaimage.cpp", "../../examples/TinyRenderer/tgaimage.cpp",
@@ -157,8 +155,6 @@ if not _OPTIONS["no-enet"] then
"../../examples/SharedMemory/PosixSharedMemory.h", "../../examples/SharedMemory/PosixSharedMemory.h",
"../../examples/SharedMemory/SharedMemoryCommands.h", "../../examples/SharedMemory/SharedMemoryCommands.h",
"../../examples/SharedMemory/SharedMemoryPublic.h", "../../examples/SharedMemory/SharedMemoryPublic.h",
"../../examples/Utils/b3ResourcePath.cpp",
"../../examples/Utils/b3ResourcePath.h",
"../../examples/Utils/RobotLoggingUtil.cpp", "../../examples/Utils/RobotLoggingUtil.cpp",
"../../examples/Utils/RobotLoggingUtil.h", "../../examples/Utils/RobotLoggingUtil.h",
"../../examples/ThirdPartyLibs/tinyxml2/tinyxml2.cpp", "../../examples/ThirdPartyLibs/tinyxml2/tinyxml2.cpp",

View File

@@ -14,7 +14,20 @@ extern "C"
//#define b3Printf b3OutputPrintfVarArgsInternal //#define b3Printf b3OutputPrintfVarArgsInternal
//#define b3Printf(...) printf(__VA_ARGS__) //#define b3Printf(...) printf(__VA_ARGS__)
//#define b3Printf(...) //#define b3Printf(...)
#ifdef __clang__
#define b3Warning(...) \
do \
{ \
b3OutputWarningMessageVarArgsInternal("b3Warning[%s,%d]:\n", __FILE_NAME__, __LINE__); \
b3OutputWarningMessageVarArgsInternal(__VA_ARGS__); \
} while (0)
#define b3Error(...) \
do \
{ \
b3OutputErrorMessageVarArgsInternal("b3Error[%s,%d]:\n", __FILE_NAME__, __LINE__); \
b3OutputErrorMessageVarArgsInternal(__VA_ARGS__); \
} while (0)
#else//__clang__
#define b3Warning(...) \ #define b3Warning(...) \
do \ do \
{ \ { \
@@ -27,7 +40,7 @@ extern "C"
b3OutputErrorMessageVarArgsInternal("b3Error[%s,%d]:\n", __FILE__, __LINE__); \ b3OutputErrorMessageVarArgsInternal("b3Error[%s,%d]:\n", __FILE__, __LINE__); \
b3OutputErrorMessageVarArgsInternal(__VA_ARGS__); \ b3OutputErrorMessageVarArgsInternal(__VA_ARGS__); \
} while (0) } while (0)
#endif //__clang__
#ifndef B3_NO_PROFILE #ifndef B3_NO_PROFILE
void b3EnterProfileZone(const char* name); void b3EnterProfileZone(const char* name);

View File

@@ -71,7 +71,17 @@ inline int b3GetVersion()
#if (defined(_WIN32) && (_MSC_VER) && _MSC_VER >= 1400) && (!defined(B3_USE_DOUBLE_PRECISION)) #if (defined(_WIN32) && (_MSC_VER) && _MSC_VER >= 1400) && (!defined(B3_USE_DOUBLE_PRECISION))
#if (defined(_M_IX86) || defined(_M_X64)) #if (defined(_M_IX86) || defined(_M_X64))
#ifdef __clang__
//#define B3_NO_SIMD_OPERATOR_OVERLOADS
#define B3_DISABLE_SSE
#endif //__clang__
#ifndef B3_DISABLE_SSE
#define B3_USE_SSE #define B3_USE_SSE
#endif //B3_DISABLE_SSE
#ifdef B3_USE_SSE #ifdef B3_USE_SSE
//B3_USE_SSE_IN_API is disabled under Windows by default, because //B3_USE_SSE_IN_API is disabled under Windows by default, because
//it makes it harder to integrate Bullet into your application under Windows //it makes it harder to integrate Bullet into your application under Windows
@@ -92,17 +102,7 @@ inline int b3GetVersion()
#ifdef B3_DEBUG #ifdef B3_DEBUG
#ifdef _MSC_VER #ifdef _MSC_VER
#include <stdio.h> #include <stdio.h>
#define b3Assert(x) \ #define b3Assert(x) { if(!(x)){b3Error("Assert " __FILE__ ":%u (%s)\n", __LINE__, #x);__debugbreak(); }}
{ \
if (!(x)) \
{ \
b3Error( \
"Assert "__FILE__ \
":%u (" #x ")\n", \
__LINE__); \
__debugbreak(); \
} \
}
#else //_MSC_VER #else //_MSC_VER
#include <assert.h> #include <assert.h>
#define b3Assert assert #define b3Assert assert
@@ -297,7 +297,7 @@ static int b3NanMask = 0x7F800001;
static int b3InfinityMask = 0x7F800000; static int b3InfinityMask = 0x7F800000;
#define B3_INFINITY_MASK (*(float *)&b3InfinityMask) #define B3_INFINITY_MASK (*(float *)&b3InfinityMask)
#endif #endif
#ifndef B3_NO_SIMD_OPERATOR_OVERLOADS
inline __m128 operator+(const __m128 A, const __m128 B) inline __m128 operator+(const __m128 A, const __m128 B)
{ {
return _mm_add_ps(A, B); return _mm_add_ps(A, B);
@@ -312,7 +312,7 @@ inline __m128 operator*(const __m128 A, const __m128 B)
{ {
return _mm_mul_ps(A, B); return _mm_mul_ps(A, B);
} }
#endif //B3_NO_SIMD_OPERATOR_OVERLOADS
#define b3CastfTo128i(a) (_mm_castps_si128(a)) #define b3CastfTo128i(a) (_mm_castps_si128(a))
#define b3CastfTo128d(a) (_mm_castps_pd(a)) #define b3CastfTo128d(a) (_mm_castps_pd(a))
#define b3CastiTo128f(a) (_mm_castsi128_ps(a)) #define b3CastiTo128f(a) (_mm_castsi128_ps(a))

View File

@@ -110,11 +110,16 @@ inline int btIsDoublePrecision()
#if defined (_M_ARM) #if defined (_M_ARM)
//Do not turn SSE on for ARM (may want to turn on BT_USE_NEON however) //Do not turn SSE on for ARM (may want to turn on BT_USE_NEON however)
#elif (defined (_WIN32) && (_MSC_VER) && _MSC_VER >= 1400) && (!defined (BT_USE_DOUBLE_PRECISION)) #elif (defined (_WIN32) && (_MSC_VER) && _MSC_VER >= 1400) && (!defined (BT_USE_DOUBLE_PRECISION))
#ifdef __clang__
#define __BT_DISABLE_SSE__
#endif
#ifndef __BT_DISABLE_SSE__
#if _MSC_VER>1400 #if _MSC_VER>1400
#define BT_USE_SIMD_VECTOR3 #define BT_USE_SIMD_VECTOR3
#endif #endif
#define BT_USE_SSE #define BT_USE_SSE
#endif//__BT_DISABLE_SSE__
#ifdef BT_USE_SSE #ifdef BT_USE_SSE
#if (_MSC_FULL_VER >= 170050727)//Visual Studio 2012 can compile SSE4/FMA3 (but SSE4/FMA3 is not enabled by default) #if (_MSC_FULL_VER >= 170050727)//Visual Studio 2012 can compile SSE4/FMA3 (but SSE4/FMA3 is not enabled by default)
@@ -210,6 +215,7 @@ inline int btIsDoublePrecision()
#if (defined (__APPLE__) && (!defined (BT_USE_DOUBLE_PRECISION))) #if (defined (__APPLE__) && (!defined (BT_USE_DOUBLE_PRECISION)))
#if defined (__i386__) || defined (__x86_64__) #if defined (__i386__) || defined (__x86_64__)
#error bla
#define BT_USE_SIMD_VECTOR3 #define BT_USE_SIMD_VECTOR3
#define BT_USE_SSE #define BT_USE_SSE
//BT_USE_SSE_IN_API is enabled on Mac OSX by default, because memory is automatically aligned on 16-byte boundaries //BT_USE_SSE_IN_API is enabled on Mac OSX by default, because memory is automatically aligned on 16-byte boundaries

View File

@@ -413,8 +413,6 @@ project ("Test_PhysicsServerInProcessExampleBrowser")
"../../examples/TinyRenderer/tgaimage.cpp", "../../examples/TinyRenderer/tgaimage.cpp",
"../../examples/TinyRenderer/our_gl.cpp", "../../examples/TinyRenderer/our_gl.cpp",
"../../examples/TinyRenderer/TinyRenderer.cpp", "../../examples/TinyRenderer/TinyRenderer.cpp",
"../../examples/Utils/b3ResourcePath.cpp",
"../../examples/Utils/b3ResourcePath.h",
"../../examples/Utils/RobotLoggingUtil.cpp", "../../examples/Utils/RobotLoggingUtil.cpp",
"../../examples/Utils/RobotLoggingUtil.h", "../../examples/Utils/RobotLoggingUtil.h",
"../../examples/ThirdPartyLibs/tinyxml2/tinyxml2.cpp", "../../examples/ThirdPartyLibs/tinyxml2/tinyxml2.cpp",