OpenGL教程:11. 利用assimp库导入模型

对于mac而言,我们只需要在homebrew里install就好了:

image-20221111204850526

添加assimp路径的环境变量,以便给cmake使用(我这里用zsh):

1
vim ~/.zprofile	#如果是Linux,那么请在.zshrc里配置

键入:

1
export ASSIMP_HOME="/opt/homebrew/Cellar/assimp/5.2.5"

之后在CMakeLists.txt里写上寻找assimp库的代码:

1
2
3
4
5
# 寻找assimp
add_library(assimp SHARED IMPORTED)
SET_TARGET_PROPERTIES(assimp PROPERTIES IMPORTED_LOCATION "${ASSIMP_HOME}/lib/libassimp.5.2.4.dylib")
# 链接assimp库
link_libraries(assimp)

这样我们的assimp库就安装好了。

Author

InverseDa

Posted on

2022-11-10

Updated on

2023-03-30

Licensed under

Comments

Your browser is out-of-date!

Update your browser to view this website correctly.&npsb;Update my browser now

×