Trouble building the Open Asset Import Library (Assimp)
Asked Answered
P

2

8

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. Doing so allows for much easier rendering of meshes using 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). It says I should use a program called CMake to build the library. I have downloaded CMake and tried to use it but it has not yet worked for me.

Has anyone here successfully built and installed Assimp using CMake or some other tool?

Pibgorn answered 29/1, 2013 at 23:55 Comment(4)
possible duplicate of Using assimp on xcodeMatrix
That other question was closed for being vague so I created this question in the hopes of clarifying what it was I was trying to ask prevously.Pibgorn
Question is still vague. Noone can help you if you don't tell us what you have done and what the output was. Have you read this?Reorganize
Yes, I have read that page. It didn't help. Specifically the pathnames used in the source code/binary links in that graphic don't exist in the actual package download and every thing I've tried fails.Pibgorn
C
10

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.

A few things before starting: make sure you have installed XCode Command Line Tools (that installs the GNU compiler). These are the steps I followed:

  1. Download the latest release of Assimp and extract it (I got the file from here, the one with source only: http://sourceforge.net/projects/assimp/files/assimp-3.0/)
  2. If you don't have it, install CMake (http://www.cmake.org/cmake/resources/software.html; I'm currently using an older version, but the latest one should work fine as well)
  3. Create a build directory (should be outside the source directory)
  4. Open CMake and point it to the folder you created at step 1 (where it says "Where is the source code"); the other folder ("Where to build the binaries") should point to the folder created at step 3
  5. Click "Configure" on the bottom; it will ask you which environment you'd like to use. I picked "Eclipse CDT 4 - Unix Makefiles"
  6. You should get a list of options; the two I selected were "BUILD_STATIC_LIB" and "ENABLE_BOOST_WORKAROUND"
  7. Click "Generate"
  8. Now you should move to the terminal and go to the folder created at step 3
  9. Type "make" and launch it; you should see the build progressing without issues
  10. When the build is finished, type "sudo make install"; it will ask for your password and install the library

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

Let me know if you have any issues with the steps above!

Capriola answered 20/9, 2013 at 17:38 Comment(3)
I get error in configuration process when I try the above.Rennarennane
"Error in Configuration process" I eventually solved it by following the steps in a different tutorial, enabling boost workaround and disabling assimp tools; but I still ended up with the problem it never actually generated any lib files after building the project in visual studio in the folder cited in said tutorial. So I used the current SDK instead but there's still some functions that don't work.Rennarennane
BUILD_STATIC_LIB is not a requirement just a preference really depending on what you are using it for. ENABLE_BOOST_WORKAROUND is only needed if you do not have boot installed. Where possible, it is probably better to install boost.Seem
D
0

I had a slightly different approach that worked for me building assimp on Mac. Here are the steps that I took if it helps anybody.

Step 1 - Install Libraries with Homebrew

brew install glm glew assimp

Step 2 - Update my CMake with the Following

FIND_PACKAGE(ASSIMP REQUIRED)
LINK_DIRECTORIES(/usr/local/lib)

add_executable(
    myExecutable
    ...
)

TARGET_LINK_LIBRARIES( myExecutable PRIVATE ${ASSIMP_LIBRARIES} )

Doggo answered 29/7, 2021 at 22:41 Comment(0)

© 2022 - 2024 — McMap. All rights reserved.