Building OpenSceneGraph for Android [3.3.x - 3.4]
- Details
- Category: Android
- Published: 12 March 2015
- Written by Rafael Gaitán
- Hits: 24709
This file contents can be applied for version OpenSceneGraph(OSG) 3.3.2 or newer.
Prerequisites for build process
To compile OSG as a standalone library you'll only need the Android NDK. To develop applications with the library you'll also need the Android SDK
- Android SDK: http://developer.android.com/sdk/index.html
- Android NDK: http://developer.android.com/sdk/ndk/index.html
Once downloaded the NDK a new Toolchain has been provided in OSG to build using CMake:
mkdir build_android_static_gles2 && cd build_android_static_gles2
cmake .. -DANDROID_NDK=<path-to-the-android-ndk> -DCMAKE_TOOLCHAIN_FILE=../PlatformSpecifics/Android/android.toolchain.cmake \
-DOPENGL_PROFILE="GLES2" -DDYNAMIC_OPENTHREADS=OFF -DDYNAMIC_OPENSCENEGRAPH=OFF \
-DANDROID_NATIVE_API_LEVEL=15 \
-DANDROID_ABI=armeabi \
-DCMAKE_INSTALL_PREFIX=<path-to-the-install-path>
make -j 8
make install
- The OPENGL_PROFILE works as expected, changing it to "GLES1" it builds and links OSG using GLES1
- The DYNAMIC_OPENTHREADS/DYNAMIC_OPENSCENEGRAPH parameters also allows to build the dynamic libraries
- ANDROID_NATIVE_API_LEVEL, ANDROID_ABI are optional and should be changed accordingly to your target device