PDA

View Full Version : XCode, CMake and Assimp



Charogne
08-31-2017, 12:51 PM
Dear all,

I write you because I am currently coding a very basic videogame engine in OpenGL/GLUT/C++, and I would now like to add the chance to import a mesh realized in almost every modelling/sculpting software via Assimp.


I kind of understood how Assimp works, and how to implement it in my code. However, I cannot manage to build the libraries and corrently compile and link them to my project in XCode.


For instance, this is my project in XCode

2470

with a root in a folder containing a folder named "MyFirstGame", containing the source files of the project, as well as a glm folder containing the glm library.


Is it possible to have a step-by-step full-basic guide to add the Assimp library to this code via CMake?
Thanks in advance :)

Dark Photon
08-31-2017, 05:38 PM
I write you because I am currently coding a very basic videogame engine in OpenGL/GLUT/C++, and I would now like to add the chance to import a mesh realized in almost every modelling/sculpting software via Assimp.
...
Is it possible to have a step-by-step full-basic guide to add the Assimp library to this code via CMake?

Putting CMake aside for a second, take a look at:

* Tutorial 38: Skeletal Animation With Assimp (http://ogldev.atspace.co.uk/www/tutorial38/tutorial38.html)

As for CMake, it's just a tool used to generate build rules. You can find a number of generic tutorials on how to use it.

kaufenpreis
09-17-2017, 07:46 AM
CMake does not build the libraries, it "only" generates platform specific Makefiles (or equivalents). You still need to compile and install the compiled libraries and headers.

For the library you want to build the following steps are necessary (I am doing them on Linux, but this should be applicable to Mac OS X as well).

git clone https://github.com/assimp/assimp.git
cd assimp
mkdir build
cd build
cmake ..
The build folder now contains a Makefile, and when you run make, the library will be compiled.

After this step, the freshly built library is located at build/code/libassimp.so.

You could leave the library as well as the include files there and reference them when compiling/linking your project. Usually, you want to install them, so they are available systemwide and can be found automatically.