[reporter="Mako_energy", created="Mon, 24 Nov 2014 03:29:25 +0100"]
At around line 150 of the root CMakeLists.txt file in the Ogre 2.0 trunk (I suspect this applies to all other versions of Ogre as well), there is a condition that checks for MinGW and if found would force the CMake architecture to i686 using "-march=i686". This is not a 64-bit architecture and thus will cause any MinGW64 compiler configured to actually build 64-bit libraries to fail.
From doing some research it seems this line for the architecture was added to resolve a linking bug on MinGW a while back. It should stay for 32-bit builds, but shouldn't exist for 64-bit builds. For example, replace:
set(CMAKE_CXX_FLAGS "${CMAKE_CXX_FLAGS} -march=i686")
with...
if( CMAKE_SIZEOF_VOID_P EQUAL 8 ) set(CMAKE_CXX_FLAGS "${CMAKE_CXX_FLAGS} -march=athlon64") else( CMAKE_SIZEOF_VOID_P EQUAL 8 ) set(CMAKE_CXX_FLAGS "${CMAKE_CXX_FLAGS} -march=i686") endif( CMAKE_SIZEOF_VOID_P EQUAL 8 )
This should preserve the previous bugfix while enable compilation on 64-bit MinGW builds.
该提问来源于开源项目:OGRECave/ogre