Use MinGW to statically compile assimp under Windows

Source: Internet
Author: User
Tags knowledge base

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 is going to explain how to use MinGW to statically compile assimp under Windows.

Assimp is currently a relatively full 3D format Analysis 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 few 3D format, more practical format from the game company custom 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 more 3D formats.
To statically compile the assimp, you first need to prepare the assimp source, CMake, and MinGW. MinGW I choose 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.
At the same time download CMake, unzip it, put in the appropriate location. 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 set the environment variables, 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 to the root directory of the Assimp library
CD $${assimp Directory}
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.
If you have a DirectX library installed on your computer, CMake will look for header files and library files without having to set Dx9_include_path, D3d9_library, and D3dx9_library.
4, before the Mingw32-make, modify the source code. Because the compilation will have an error:
In the $${assimp directory}/include/assimp/types.h, modify:
Add # include <string.h&gt after 52 lines;
5, modify the $${assimp directory}/tools/assimp_view/cmakefiles/assimp_viewer.dir/build.make 418 Lines, delete $ (rc_flags); modify $${assimp directory}/ Tools/assimp_cmd/cmakefiles/assimp_cmd.dir/build.make in 58 rows, delete $ (rc_flags)
6, Mingw32-make-j 4 to build. If it goes well, libassimp.a and Assimp_cmd.exe and Assimp_viewer.exe will build smoothly.

Finally, if you want to use Assimp_cmd.exe and Assimp_viewer.exe, you need Libgcc_s_dw2-1.dll, libstdc++-6. DLLs as well as Libwinpthread-1.dll, which can be found in the MinGW directory and D3dx9_43.dll If you want to use Assimp_viewer. Of course, I also share a copy of Assimp_viewer here.

Related Article

Contact Us

The content source of this page is from Internet, which doesn't represent Alibaba Cloud's opinion; products and services mentioned on that page don't have any relationship with Alibaba Cloud. If the content of the page makes you feel confusing, please write us an email, we will handle the problem within 5 days after receiving your email.

If you find any instances of plagiarism from the community, please send an email to: info-contact@alibabacloud.com and provide relevant evidence. A staff member will contact you within 5 working days.

A Free Trial That Lets You Build Big!

Start building with 50+ products and up to 12 months usage for Elastic Compute Service

  • Sales Support

    1 on 1 presale consultation

  • After-Sales Support

    24/7 Technical Support 6 Free Tickets per Quarter Faster Response

  • Alibaba Cloud offers highly flexible support services tailored to meet your exact needs.