Using MinGW to statically compile Assimp
By the May, did not write a log, so I took an article from the Knowledge Base sucks it. This time will explain how to use MinGW statically compiled assimp under Windows.
Assimp is now more than the full 3D format parsing library, familiar with 3D game development peers know that 3D format is very chaotic, various 3D format in different situations have their specific application, the game engine can only parse a small number of 3D format, many other useful formats from the game company's own definition of the format. In the field of open source, Assimp is a relatively full 3D format import library. It has a deep understanding of the 3D format and is ideal for integration into the 3D graphics engine, allowing your program to support many other 3D formats.
To compile the Assimp statically, you first need to prepare the Assimp source code, CMake, and MinGW. MinGW I use the QT comes with the library, we can choose the appropriate MinGW or TDM-MINGW. Here I will assimp the source code and CMake share, so that I can consult later.
Assimp: Here (extract code: 60C5)
CMake: Here (extract code :46ac)
After downloading Assimp, unzip it, put it in the right place, I put it in e:/develop.
Download CMake at the same time, unzip it, put it in the right place. I put it in the e:/develop.
Then cmd goes to the command line, and we compile it primarily on the command line.
1. First environment variable settings, which I set here:
Set path=%path%; E:/develop/cmake-2.8.12.1-win32-x86/bin; E:/develop/qt5.3/tools/mingw482_32/bin
2. Then go to the root folder of the Assimp library
CD $${assimp folder}
3, using CMake to build
Cmake-g "MinGW makefiles" ^-denable_boost_workaround=on-dbuild_static_lib=on ^-dcmake_rc_compiler=e:/develop/qt5.3 /tools/mingw482_32/bin/windres.exe ^-dcmake_make_program=e:/develop/qt5.3/tools/mingw482_32/bin/ Mingw32-make.exe ^-dcmake_lflags=-static ^-dcmake_lflags_dll=-static ^-ddx9_include_path=e:/develop/qt5.3/tools/ Mingw482_32/i686-w64-mingw32/include ^-dd3d9_library=e:/develop/qt5.3/tools/mingw482_32/i686-w64-mingw32/lib/ Libd3d9.a ^-dd3dx9_library=e:/develop/qt5.3/tools/mingw482_32/i686-w64-mingw32/lib/libd3dx9.a.
Assuming your computer has a DirectX library installed, CMake looks for header files and library files without having to set up Dx9_include_path, D3d9_library, and D3dx9_library.
4, before the Mingw32-make, change the source code. Error due to compilation:
Changes in the $${assimp folder}/include/assimp/types.h:
Add # include <string.h> after 52 lines;
5, change the $${assimp folder}/tools/assimp_view/cmakefiles/assimp_viewer.dir/build.make 418 lines, delete $ (rc_flags); Change $${assimp folder} /tools/assimp_cmd/cmakefiles/assimp_cmd.dir/build.make in 58 rows, delete $ (rc_flags)
6, Mingw32-make-j 4 to build. Assuming it goes well, libassimp.a and Assimp_cmd.exe and Assimp_viewer.exe will be built smoothly.
Finally, if you want to use Assimp_cmd.exe and assimp_viewer.exe, you need to Libgcc_s_dw2-1.dll, libstdc++-6. DLL and Libwinpthread-1.dll, which can be found in the MinGW folder, you need to have d3dx9_43.dll if you want to use Assimp_viewer. Of course, I also share a copy of Assimp_viewer here.