Article directory
[learnopengl] Assimp construction and compilation
1 Introduction
Recently, I am learning OpenGL from the LearnOpenGL website. This article records in detail the construction and compilation of Assimp in the tutorial. The link to the Chinese version of this tutorial: [Assimp - LearnOpenGL CN (learnopengl-cn.github.io)](https://learnopengl-cn.github.io/03 Model Loading/01 Assimp/).
test environment:
- Windows 11
- VS2022
- CMake
- Example 5.2.5
2 Assimp build and compile
2.1 Download source code
-
Clone the repository locally.
git clone https://github.com/assimp/assimp.git
2.2 CMake build
-
build
Create a new folder in the source code directory . -
Run CMake-gui (those who are familiar with the cmake command can also use the command line) and configure the source code folder path and the build folder path.
Then click
Configure
, because it is compiled using VS2022, so here you need to select the corresponding version of the compiler, and click after the configuration is completedFinish
.At this point, a list of variables and values should appear in the middle of the interface with a red background, which is normal. Then click again
Configure
, it will be displayeddone
without reporting an error, and finally clickGenerate
to complete the build, it will also be displayeddone
without reporting an error, success.
2.3 VS2022 compilation
-
After the build is completed,
build
a VS solution will be generated in the folderAssimp.sln
, double-click to open it. As shown in the figure below, click生成解决方案
to start compilation, and no errors will be reported after compilation is completed.
3 Configure the Assimp library in VS
-
Copy all the contents of the
assimp/include
and directory to the include folder of your project.assimp/build/include
-
Copy
assimp/contrib
the entire folder to the include folder of your project. -
Copy the file to the lib folder
assimp/build/lib/Debug/assimp-vc143-mtd.lib
of your project . -
Copy
assimp/build/bin/Debug/assimp-vc143-mtd.dll
the file to your project folder (the folder where the project source code is located). -
Configure the linker input in the project property manager and add it
assimp-vc143-mtd.lib
. -
Configuration completed!
4 Verification
Use the source code provided by the LearnOpenGL website: LearnOpenGL/src/3.model_loading/1.model_loading at master · JoeyDeVries/LearnOpenGL (github.com) for verification.
No error is reported and the verification is successful.