[英]Trouble building the Open Asset Import Library (Assimp)
I have just downloaded the Open Asset Import Library (Assimp) which is an API used to import 3D file formats such as .3DS and .Obj into source code.我刚刚下载了 Open Asset Import Library (Assimp),它是一个 API,用于将 .3DS 和 .Obj 等 3D 文件格式导入源代码。 Doing so allows for much easier rendering of meshes using openGL.
这样做可以更轻松地使用 openGL 渲染网格。
The problem is, I can't get the Library to build.问题是,我无法建立图书馆。 It comes with very vague and cryptic directions on how to build it and connect to a compiler such as XCode (which I am using).
它附带了关于如何构建它并连接到诸如 XCode(我正在使用的编译器)之类的编译器的非常模糊和神秘的说明。 It says I should use a program called CMake to build the library.
它说我应该使用一个名为 CMake 的程序来构建库。 I have downloaded CMake and tried to use it but it has not yet worked for me.
我已经下载了 CMake 并尝试使用它,但它尚未对我有用。
Has anyone here successfully built and installed Assimp using CMake or some other tool?这里有没有人使用 CMake 或其他工具成功构建和安装 Assimp?
I totally agree that the documentation for Mac is a bit lacking, but I have managed (after several attempts) to build and install the library.我完全同意 Mac 的文档有点缺乏,但我已经设法(经过多次尝试)构建和安装库。
A few things before starting: make sure you have installed XCode Command Line Tools (that installs the GNU compiler).开始之前的一些事情:确保您已经安装了 XCode 命令行工具(安装了 GNU 编译器)。 These are the steps I followed:
这些是我遵循的步骤:
After the last step you should be able to include the library in your code:在最后一步之后,您应该能够在代码中包含该库:
#include <assimp/cimport.h>
#include <assimp/scene.h>
#include <assimp/postprocess.h>
Make sure you also include the library for linking;确保您还包含用于链接的库; when linking you should add -lassimp to the list
链接时,您应该将 -lassimp 添加到列表中
Let me know if you have any issues with the steps above!如果您对上述步骤有任何问题,请告诉我!
I had a slightly different approach that worked for me building assimp on Mac.我有一种稍微不同的方法,它适用于我在 Mac 上构建 assimp。 Here are the steps that I took if it helps anybody.
如果对任何人有帮助,以下是我采取的步骤。
brew install glm glew assimp
FIND_PACKAGE(ASSIMP REQUIRED)
LINK_DIRECTORIES(/usr/local/lib)
add_executable(
myExecutable
...
)
TARGET_LINK_LIBRARIES( myExecutable PRIVATE ${ASSIMP_LIBRARIES} )
声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.