Assimp is very strong library to load 3d models. the library supports various formats like 3DS, DAE, OBJ and many more formats and the library can be ported to the android platform using the native development kit for android.
After few days of fighting how to compile the library and use it, finally decided to post the tutorial for other developers with the same goal.
(the instructions involves running commands from command line, I used both windows and mac to run the scripts so examples will contain both, basic steps are the same)
The Compilation process will take from two phases :
– Compile using cmake (which will generate makefile)
– Compile using make (which will generate so shaed library file)
for preperation, android ndk, android sdk should be already installed, in addition need to download android toolchain scripts that cmake will use during the compilation so go to http://code.google.com/p/android-cmake/ and download zip file contains all the android-cmake files (extract to root folder with android sdk,ndk)
also need to download the cmake command line or gui tool ( http://www.cmake.org )
in addition in windows should use cygwin to run the scripts, I used both cygwin and mac terminal to achieve the goal.
1. Set up android toolchain
not go to android-ndk-r8c\build\tools
run the command:
sh make-standalone-toolchain.sh –platform=android-8 –ndk-dir=$NDK_PATH –install-dir=/Android/sdk/android-toolchain –toolchain=arm-linux-androideabi-4.4.3
which will build file scripts of the toolchain
now run the command
to the path need to add :
so lets begin, download the last source of assimp library from http://assimp.sourceforge.net and open terminal(cygwin or mac terminal) , go to assimp directory and type :
cmake -DCMAKE_TOOLCHAIN_FILE=$ANDTOOLCHAIN -DENABLE_BOOST_WORKAROUND=ON -DCMAKE_INSTALL_PREFIX=/assimp-2.0 -DANDROID_ABI=armeabi-v7a _DANDROID_NATIVE_API_LEVEL=android-8 -DANDROID_FORCE_ARM_BUILD=TRUE ..
this will create files and folders in the build directory, now go to the file link.txt inside : buildandroid => code => cMakeFiles => assimp.dir => link.txt
search for the string -soname, libassimp.so.3 and remove the .3 from the extension of the library (if not it will make problems in loading later from the android)
do the same thing with file name relink.txt
now go back to the root directory of buildandroid and run :
process of building will begin, the shared library will be in parent lib folder and wll consist from symbolic links and so library which will called libassimp.so.version_number. remove the version number makeing the file name only be libassimp.so
(already pre-compiled assimp 3.0 version for android download here