[learnopengl] Assimp construction and compilation

[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

  • buildCreate 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.

    image-20230903165658832

    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 completed Finish.

    image-20230903170052532

    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 displayed donewithout reporting an error, and finally click Generateto complete the build, it will also be displayed donewithout reporting an error, success.

2.3 VS2022 compilation

  • After the build is completed, builda VS solution will be generated in the folder Assimp.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.

    image-20230903170746685

3 Configure the Assimp library in VS

  • Copy all the contents of the assimp/includeand directory to the include folder of your project.assimp/build/include

  • Copy assimp/contribthe entire folder to the include folder of your project.

  • Copy the file to the lib folder assimp/build/lib/Debug/assimp-vc143-mtd.libof your project .

  • Copy assimp/build/bin/Debug/assimp-vc143-mtd.dllthe 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.

    image-20230903172949716

  • 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.

image-20230903173246453

No error is reported and the verification is successful.

Guess you like

Origin blog.csdn.net/qq_39784672/article/details/132652562