Compile Assimp Open Source Library For Android Compile Assimp Open Source Library For Android

Compile Assimp Open Source Library For Android

Compile Assimp Open Source Library For Android Compile Assimp Open Source Library For Android

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
export NDK_PATH=/path/to/your/android/ndk/
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
export ANDROID_NDK_TOOLCHAIN=$HOME/Android/sdk/android-toolchain
and also
export ANDTOOLCHAIN=$HOME/Android/android-cmake/toolchain/android.toolchain.cmake
to the path need to add :
export PATH=$PATH:$HOME/Android/sdk/tools
export PATH=$PATH:$HOME/Android/sdk/platform-tools
export PATH=$PATH:$HOME/Android/sdk/android-toolchain/bin

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 :
mkdir buildandroid
cd buildandroid
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 :
make
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

评论
添加红包

请填写红包祝福语或标题

红包个数最小为10个

红包金额最低5元

当前余额3.43前往充值 >
需支付:10.00
成就一亿技术人!
领取后你会自动成为博主和红包主的粉丝 规则
hope_wisdom
发出的红包
实付
使用余额支付
点击重新获取
扫码支付
钱包余额 0

抵扣说明:

1.余额是钱包充值的虚拟货币,按照1:1的比例进行支付金额的抵扣。
2.余额无法直接购买下载,可以购买VIP、付费专栏及课程。

余额充值