Browse Source

* Add notes on MinGW compiler version requirements
* Add check on MinGW compiler version to force compliance.
* Closes #2315 ?

Charlie Gettys 6 years ago
parent
commit
6a373d55c7
2 changed files with 10 additions and 2 deletions
  1. 4 1
      Build.md
  2. 6 1
      CMakeLists.txt

+ 4 - 1
Build.md

@@ -35,6 +35,9 @@ The option -j descripes the number of parallel processes for the build. In this
 If you want to use a IDE for linux you can try QTCreator for instance. 
 
 # Build instructions for MinGW
+ Older versions of MinGW's compiler (e.g. 5.1.0) do not support the -mbig_obj flag 
+required to compile some of assimp's files, especially for debug builds.
+Version 7.3.0 of g++-mingw-w64 & gcc-mingw-w64 appears to work.
 
 Please see [CMake Cross Compiling](https://cmake.org/cmake/help/latest/manual/cmake-toolchains.7.html#cross-compiling) for general information on CMake Toolchains.
 
@@ -43,7 +46,7 @@ Some users have had success building assimp using MinGW on Linux using the follo
 The following toolchain may or may not be helpful for building assimp using MinGW on Windows (untested):
  [mingw-cxx17.cmake](https://github.com/ruslo/polly/blob/master/mingw-cxx17.cmake)
 
-Besides the toolchain, compilation should be the same as for Linux / Unix
+Besides the toolchain, compilation should be the same as for Linux / Unix.
 
 # CMake build options
 The cmake-build-environment provides options to configure the build. The following options can be used:

+ 6 - 1
CMakeLists.txt

@@ -234,7 +234,12 @@ ELSEIF ( "${CMAKE_CXX_COMPILER_ID}" MATCHES "Clang" )
   SET(CMAKE_CXX_FLAGS "-g -fvisibility=hidden -fPIC -fno-strict-aliasing -Wall -Wno-long-long -std=c++11 ${CMAKE_CXX_FLAGS}" )
   SET(CMAKE_C_FLAGS "-fPIC -fno-strict-aliasing ${CMAKE_C_FLAGS}")
 ELSEIF( CMAKE_COMPILER_IS_MINGW )
-  SET( CMAKE_CXX_FLAGS "-fvisibility=hidden -fno-strict-aliasing -Wall -Wno-long-long -std=c++11 -Wa,-mbig-obj ${CMAKE_CXX_FLAGS}" )
+  IF (CMAKE_CXX_COMPILER_VERSION VERSION_LESS 7.0)
+    message(FATAL_ERROR "MinGW is too old")
+  ELSEIF(CMAKE_CXX_COMPILER_VERSION VERSION_LESS 7.3)
+    message(WARNING "MinGW is old, if you experience errors, update MinGW")
+  ENDIF()
+  SET( CMAKE_CXX_FLAGS "-fvisibility=hidden -fPIC -fno-strict-aliasing -Wall -Wno-long-long -std=c++11 -Wa,-mbig-obj ${CMAKE_CXX_FLAGS}" )
   SET(CMAKE_C_FLAGS "-fPIC -fno-strict-aliasing ${CMAKE_C_FLAGS} ")
   ADD_DEFINITIONS( -U__STRICT_ANSI__ )
 ENDIF()