From e6ab299f3721e541215e65d3a1779289b823ece7 Mon Sep 17 00:00:00 2001 From: deve Date: Fri, 12 Sep 2014 09:01:35 +0200 Subject: [PATCH] Fixed mingw compilation --- CMakeLists.txt | 14 +++++++------- lib/irrlicht/include/matrix4.h | 16 ++++++++-------- 2 files changed, 15 insertions(+), 15 deletions(-) diff --git a/CMakeLists.txt b/CMakeLists.txt index fd6fd4db7..d0017dc35 100644 --- a/CMakeLists.txt +++ b/CMakeLists.txt @@ -75,17 +75,17 @@ endif() include_directories(${STK_SOURCE_DIR}) # These variables enable MSVC to find libraries located in "dependencies" -if(MSVC) - set(ENV{PATH} ${PROJECT_SOURCE_DIR}/dependencies/include) +if(WIN32) + set(ENV{PATH} "$ENV{PATH};${PROJECT_SOURCE_DIR}/dependencies/include") set(ENV{LIB} ${PROJECT_SOURCE_DIR}/dependencies/lib) set(ENV{OPENALDIR} ${PROJECT_SOURCE_DIR}/dependencies) - add_definitions(/D_IRR_STATIC_LIB_) + if(MSVC) + add_definitions(/D_IRR_STATIC_LIB_) + elseif(MINGW) + add_definitions(-D_IRR_STATIC_LIB_) + endif() endif() -if(MINGW) - set(ENV{OPENALDIR} ${PROJECT_SOURCE_DIR}/dependencies) - add_definitions(-D_IRR_STATIC_LIB_) -endif() if(APPLE) set(CMAKE_C_FLAGS "${CMAKE_C_FLAGS} -arch i386") diff --git a/lib/irrlicht/include/matrix4.h b/lib/irrlicht/include/matrix4.h index 6c04a8308..f4af53da8 100644 --- a/lib/irrlicht/include/matrix4.h +++ b/lib/irrlicht/include/matrix4.h @@ -12,8 +12,8 @@ #include "aabbox3d.h" #include "rect.h" #include "irrString.h" -#if defined(WIN32) && (defined(__x86_64__) || defined(_M_X64) || defined(__i386) || defined(_M_IX86)) -#include +#if defined(WIN32) && !defined(__MINGW32__) && (defined(__x86_64__) || defined(_M_X64) || defined(__i386) || defined(_M_IX86)) + #include #endif // enable this to keep track of changes to the matrix @@ -48,7 +48,7 @@ namespace core class CMatrix4 { private: -#if defined(WIN32) && (defined(__x86_64__) || defined(_M_X64) || defined(__i386) || defined(_M_IX86)) +#if defined(WIN32) && !defined(__MINGW32__) && (defined(__x86_64__) || defined(_M_X64) || defined(__i386) || defined(_M_IX86)) float M_raw[24]; #endif public: @@ -409,7 +409,7 @@ namespace core bool equals(const core::CMatrix4& other, const T tolerance=(T)ROUNDING_ERROR_f64) const; private: -#if defined(WIN32) && (defined(__x86_64__) || defined(_M_X64) || defined(__i386) || defined(_M_IX86)) +#if defined(WIN32) && !defined(__MINGW32__) && (defined(__x86_64__) || defined(_M_X64) || defined(__i386) || defined(_M_IX86)) //! Matrix data, stored in row-major order T* M = (T*)((uintptr_t)&M_raw[4] & ~0xF); #else @@ -669,7 +669,7 @@ namespace core const T *m1 = other_a.M; const T *m2 = other_b.M; -#if defined(WIN32) && (defined(__x86_64__) || defined(_M_X64) || defined(__i386) || defined(_M_IX86)) +#if defined(WIN32) && !defined(__MINGW32__) && (defined(__x86_64__) || defined(_M_X64) || defined(__i386) || defined(_M_IX86)) // From http://drrobsjournal.blogspot.fr/2012/10/fast-simd-4x4-matrix-multiplication.html // Use unaligned load/store @@ -1019,13 +1019,13 @@ namespace core const f64 t = 1.0 - c; const f64 tx = t * axis.X; - const f64 ty = t * axis.Y; + const f64 ty = t * axis.Y; const f64 tz = t * axis.Z; const f64 sx = s * axis.X; const f64 sy = s * axis.Y; const f64 sz = s * axis.Z; - + M[0] = (T)(tx * axis.X + c); M[1] = (T)(tx * axis.Y + sz); M[2] = (T)(tx * axis.Z - sy); @@ -1385,7 +1385,7 @@ namespace core } #endif const CMatrix4 &m = *this; -#if defined(WIN32) && (defined(__x86_64__) || defined(_M_X64) || defined(__i386) || defined(_M_IX86)) +#if defined(WIN32) && !defined(__MINGW32__) && (defined(__x86_64__) || defined(_M_X64) || defined(__i386) || defined(_M_IX86)) float *src = (float*)m.pointer(); float *dst = (float*)out.pointer(); // from http://www.intel.com/design/pentiumiii/sml/245043.htm