Remove mingw-w64 errors from loss of precision by converting 64bit pointers to ints...
authorAntony Riakiotakis <kalast@gmail.com>
Tue, 24 Apr 2012 14:33:44 +0000 (14:33 +0000)
committerAntony Riakiotakis <kalast@gmail.com>
Tue, 24 Apr 2012 14:33:44 +0000 (14:33 +0000)
CMakeLists.txt
build_files/scons/config/win64-mingw-config.py
extern/bullet2/patches/MinGW64-nopermissive.patch [new file with mode: 0644]
extern/bullet2/src/LinearMath/btSerializer.h
intern/audaspace/intern/AUD_Buffer.cpp
intern/audaspace/patches/mingw64-nopermissive.patch [new file with mode: 0644]
intern/elbeem/intern/ntl_geometrymodel.cpp
intern/elbeem/patches/mingw64_nopermissive.patch [new file with mode: 0644]
source/gameengine/Expressions/KX_HashedPtr.cpp
source/gameengine/Ketsji/KX_GameObject.cpp
source/gameengine/Ketsji/KX_IPO_SGController.cpp

index a2926182c5a7ddf41c4b0e86272bcb31d15bd15b..9250dae9ad8e58c0603e377e98751c7d6efd5080 100644 (file)
@@ -1008,8 +1008,9 @@ elseif(WIN32)
 
                if(WITH_MINGW64)
                        #Yes, the point for MinGW64 is moar optimization by default :)
-                       set(PLATFORM_CFLAGS "${PLATFORM_CFLAGS} -mmmx -msse -msse2 -O3")
-                       set(CMAKE_CXX_FLAGS "${CMAKE_CXX_FLAGS} -fpermissive")
+                       set(PLATFORM_CFLAGS "${PLATFORM_CFLAGS} -mmmx -msse -msse2")
+                       set(CMAKE_C_FLAGS_RELEASE "-O3 -DNDEBUG")
+                       #set(CMAKE_CXX_FLAGS "${CMAKE_CXX_FLAGS} -fpermissive")
                        set(PLATFORM_LINKLIBS "${PLATFORM_LINKLIBS} -lpthread")
                        
                        add_definitions(-DFREE_WINDOWS64 -DMS_WIN64)
index 0379ea480883924c077d057acb2efea746c447c9..98d45ae2054e88634e883ffaa4a0fcf2d2e17935 100644 (file)
@@ -176,7 +176,7 @@ CC = 'gcc'
 CXX = 'g++'
 
 CCFLAGS = [ '-pipe', '-funsigned-char', '-fno-strict-aliasing' ]
-CXXFLAGS = [ '-fpermissive' ]
+#CXXFLAGS = [ '-fpermissive' ]
 
 CPPFLAGS = ['-DWIN32', '-DMS_WIN64', '-DFREE_WINDOWS', '-DFREE_WINDOWS64', '-D_LARGEFILE_SOURCE', '-D_FILE_OFFSET_BITS=64', '-D_LARGEFILE64_SOURCE', '-DBOOST_ALL_NO_LIB', '-DBOOST_THREAD_USE_LIB', '-DGLEW_STATIC', '-D_SSIZE_T_']
 REL_CFLAGS = ['-O3', '-mmmx', '-msse', '-msse2']
diff --git a/extern/bullet2/patches/MinGW64-nopermissive.patch b/extern/bullet2/patches/MinGW64-nopermissive.patch
new file mode 100644 (file)
index 0000000..915f232
--- /dev/null
@@ -0,0 +1,39 @@
+Index: LinearMath/btSerializer.h
+===================================================================
+--- LinearMath/btSerializer.h  (revision 45919)
++++ LinearMath/btSerializer.h  (working copy)
+@@ -25,8 +25,15 @@
+ #endif
+ #include <string.h>
++#if defined(_WIN64)
++#  ifdef __MINGW64__
++#    include <basetsd.h>
++#  endif
++typedef __int64 int_ptr;
++#else
++typedef long int_ptr;
++#endif
+-
+ ///only the 32bit versions for now
+ extern unsigned char sBulletDNAstr[];
+ extern int sBulletDNAlen;
+@@ -247,7 +254,7 @@
+                               cp++;
+                       }
+                       {
+-                              nr= (long)cp;
++                              nr= (int_ptr)cp;
+                       //      long mask=3;
+                               nr= ((nr+3)&~3)-nr;
+                               while (nr--)
+@@ -282,7 +289,7 @@
+                       }
+               {
+-                              nr= (long)cp;
++                              nr= (int_ptr)cp;
+                       //      long mask=3;
+                               nr= ((nr+3)&~3)-nr;
+                               while (nr--)
index 8a89374c61256144cb6fcc75d8fe3b7312dba378..a1e766c95cee82225c16164f063aad5e6dbafae6 100644 (file)
@@ -25,7 +25,14 @@ subject to the following restrictions:
 #endif
 #include <string.h>
 
-
+#if defined(_WIN64)
+#  ifdef __MINGW64__
+#    include <basetsd.h>
+#  endif
+typedef __int64 int_ptr;
+#else
+typedef long int_ptr;
+#endif
 
 ///only the 32bit versions for now
 extern unsigned char sBulletDNAstr[];
@@ -247,7 +254,7 @@ protected:
                                cp++;
                        }
                        {
-                               nr= (long)cp;
+                               nr= (int_ptr)cp;
                        //      long mask=3;
                                nr= ((nr+3)&~3)-nr;
                                while (nr--)
@@ -282,7 +289,7 @@ protected:
                        }
 
                {
-                               nr= (long)cp;
+                               nr= (int_ptr)cp;
                        //      long mask=3;
                                nr= ((nr+3)&~3)-nr;
                                while (nr--)
index b7157f672b4a945386052996d0f31b6f216c932c..624a4d0b2c80060ca650a19a571a3facac2e7cea 100644 (file)
 #include <cstring>
 #include <cstdlib>
 
-#define AUD_ALIGN(a) (a + 16 - ((long)a & 15))
+#if defined(_WIN64)
+#  ifdef __MINGW64__
+#    include <basetsd.h>
+#  endif
+typedef unsigned __int64 uint_ptr;
+#else
+typedef unsigned long uint_ptr;
+#endif
+
+#define AUD_ALIGN(a) (a + 16 - ((uint_ptr)a & 15))
 
 AUD_Buffer::AUD_Buffer(int size)
 {
diff --git a/intern/audaspace/patches/mingw64-nopermissive.patch b/intern/audaspace/patches/mingw64-nopermissive.patch
new file mode 100644 (file)
index 0000000..64420d2
--- /dev/null
@@ -0,0 +1,23 @@
+Index: intern/AUD_Buffer.cpp
+===================================================================
+--- intern/AUD_Buffer.cpp      (revision 45919)
++++ intern/AUD_Buffer.cpp      (working copy)
+@@ -33,8 +33,17 @@
+ #include <cstring>
+ #include <cstdlib>
+-#define AUD_ALIGN(a) (a + 16 - ((long)a & 15))
++#if defined(_WIN64)
++#  ifdef __MINGW64__
++#    include <basetsd.h>
++#  endif
++typedef unsigned __int64 uint_ptr;
++#else
++typedef unsigned long uint_ptr;
++#endif
++#define AUD_ALIGN(a) (a + 16 - ((uint_ptr)a & 15))
++
+ AUD_Buffer::AUD_Buffer(int size)
+ {
+       m_size = size;
index 13220736b8eac6a1069becf0e2a860ca94ceb756..b518416b63972b6b9cfd7665b3269aa3f1bfaabe 100644 (file)
 #endif
 #endif // WIN32
 
-
+#if defined(_WIN64)
+#  ifdef __MINGW64__
+#    include <basetsd.h>
+#  endif
+typedef __int64 int_ptr;
+#else
+typedef long int_ptr;
+#endif
 /******************************************************************************
  * Default Constructor 
  *****************************************************************************/
@@ -164,7 +171,7 @@ int ntlGeometryObjModel::initModel(int numVertices, float *vertices, int numTria
        }
 
        //fprintf(stderr,"initModel DEBUG %d \n",channelSize);
-       debMsgStd("ntlGeometryObjModel::initModel",DM_MSG, "Csize:"<<channelSize<<", Cvert:"<<(long)(channelVertices) ,10);
+       debMsgStd("ntlGeometryObjModel::initModel",DM_MSG, "Csize:"<<channelSize<<", Cvert:"<<(int_ptr)(channelVertices) ,10);
        if(channelVertices && (channelSize>0)) {
                vector<ntlSetVec3f> aniverts;
                vector<ntlSetVec3f> aninorms;
diff --git a/intern/elbeem/patches/mingw64_nopermissive.patch b/intern/elbeem/patches/mingw64_nopermissive.patch
new file mode 100644 (file)
index 0000000..a01e65d
--- /dev/null
@@ -0,0 +1,29 @@
+Index: intern/ntl_geometrymodel.cpp
+===================================================================
+--- intern/ntl_geometrymodel.cpp       (revision 45919)
++++ intern/ntl_geometrymodel.cpp       (working copy)
+@@ -21,7 +21,14 @@
+ #endif
+ #endif // WIN32
+-
++#if defined(_WIN64)
++#  ifdef __MINGW64__
++#    include <basetsd.h>
++#  endif
++typedef __int64 int_ptr;
++#else
++typedef long int_ptr;
++#endif
+ /******************************************************************************
+  * Default Constructor 
+  *****************************************************************************/
+@@ -164,7 +171,7 @@
+       }
+       //fprintf(stderr,"initModel DEBUG %d \n",channelSize);
+-      debMsgStd("ntlGeometryObjModel::initModel",DM_MSG, "Csize:"<<channelSize<<", Cvert:"<<(long)(channelVertices) ,10);
++      debMsgStd("ntlGeometryObjModel::initModel",DM_MSG, "Csize:"<<channelSize<<", Cvert:"<<(int_ptr)(channelVertices) ,10);
+       if(channelVertices && (channelSize>0)) {
+               vector<ntlSetVec3f> aniverts;
+               vector<ntlSetVec3f> aninorms;
index 51550d52636bf7bc736c83728ada163034edc0ea..84488e3641d3fcc532bdc0507a86da2f07ed6d11 100644 (file)
 /** \file gameengine/Expressions/KX_HashedPtr.cpp
  *  \ingroup expressions
  */
-
+#ifdef __MINGW64__
+#include <basetsd.h>
+#endif
 
 #include "KX_HashedPtr.h"
 
 unsigned int KX_Hash(void * inDWord)
 {
-#if defined(_WIN64) && !defined(FREE_WINDOWS64)
+#ifdef _WIN64
        unsigned __int64 key = (unsigned __int64)inDWord;
 #else
        unsigned long key = (unsigned long)inDWord;
index c5145ef2171badcf0cdfe67950e6dbc1e6cc6ce5..bdb586b24749de82e4852f65eae649f5993ca01d 100644 (file)
  */
 
 
-#if defined(_WIN64) && !defined(FREE_WINDOWS64)
+#if defined(_WIN64)
+#  ifdef __MINGW64__
+#    include <basetsd.h>
+#  endif
 typedef unsigned __int64 uint_ptr;
 #else
 typedef unsigned long uint_ptr;
index 950e3c88a9e939f1a1e356de292fe56780c71504..b8872f5ddc37a31f08c7cfbc88448c1c2c21675f 100644 (file)
  */
 
 
-#if defined(_WIN64) && !defined(FREE_WINDOWS64)
+#if defined(_WIN64)
+#  ifdef __MINGW64__
+#    include <basetsd.h>
+#  endif
 typedef unsigned __int64 uint_ptr;
 #else
 typedef unsigned long uint_ptr;