Build Assimp for Android NDK

1. Download Assimp-2.0 SDK complete source and extract it wherever you want (mine is ~/Desktop/assimp–2.0.863-sdk)
2. Enter into the extracted directory and type: mkdir BUILD and then cd BUILD
3. Run this command: cmake -DCMAKE_TOOLCHAIN_FILE=$ANDTOOLCHAIN -DENABLE_BOOST_WORKAROUND=ON -DCMAKE_INSTALL_PREFIX:PATH=/assimp-2.0 ..
4. Now run make
5. It will return a lot of errors, so here are the needed corrections:

  • “aiDefines.h” starting from line 237:
    #    if defined(__x86_32__) || defined(__i386__)
    #        define ASSIMP_BUILD_X86_32BIT_ARCHITECTURE
    #    elif defined(__x86_64__)
    #        define ASSIMP_BUILD_X86_64BIT_ARCHITECTURE
    #    elif defined(__ppc__)
    #        define ASSIMP_BUILD_PPC_32BIT_ARCHITECTURE
    #   elif defined(__arm__)
    #       define ASSIMP_ANDROID_ARM_ARCHITECTURE
    #    else
    #        error unknown architecture
    #    endif
    #else
    #    error unknown compiler
    #endif
  • “Importer.cpp” –> starting from line 901
    #if defined(ASSIMP_BUILD_X86_32BIT_ARCHITECTURE)
            << ” x86″
    #elif defined(ASSIMP_BUILD_X86_64BIT_ARCHITECTURE)
            << ” amd64″
    #elif defined(ASSIMP_BUILD_IA_64BIT_ARCHITECTURE)
            << ” itanium”
    #elif defined(ASSIMP_BUILD_PPC_32BIT_ARCHITECTURE)
            << ” ppc32″
    #elif defined(ASSIMP_ANDROID_ARM_ARCHITECTURE)
            << ” arm”
    #else
    #    error unknown architecture
    #endif 

    Once we have put this corrections run make again and it should work!
    Finally run make install!

Advertisements
This entry was posted in Android.

Leave a Reply

Fill in your details below or click an icon to log in:

WordPress.com Logo

You are commenting using your WordPress.com account. Log Out / Change )

Twitter picture

You are commenting using your Twitter account. Log Out / Change )

Facebook photo

You are commenting using your Facebook account. Log Out / Change )

Google+ photo

You are commenting using your Google+ account. Log Out / Change )

Connecting to %s