My changes:
-------------------
- I changed the cmake files and added a toolchain for building OSG in Android. The toolchain is based on the one used at OpenCV. For building OSG for android you just need to do:
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 # optional
-DANDROID_ABI=armeabim #optional
-DCMAKE_INSTALL_PREFIX=<path-to-the-install-path> #optional
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
- I also added some build fixes for android related to the texture formats and added some missing USE_OSG_SERIALIZER_WRAPPER in the osg serializer library to support loading osgb files in static."
git-svn-id: http://svn.openscenegraph.org/osg/OpenSceneGraph/trunk@14514 16af8721-9629-0410-8352-f15c8da7e697
android-ndk-r8d/build/gmsl/__
gmsl:512: *** non-numeric second argument to `wordlist' function: ''. Stop.
This is discussed in this thread[1].
The solution is to add <uses-sdk android:minSdkVersion="8" /> to the manifest as the OSG library will only run in devices with Android>=2.2 (Froyo) with API level 8 [2].
The fix does not affect to older sdk's.
Thanks to Jan Ciger for spotting the bug and find a possible solution. "
"- In order to build against GLES1 we execute:
$ mkdir build_android_gles1
$ cd build_android_gles1
$ cmake .. -DOSG_BUILD_PLATFORM_ANDROID=ON -DDYNAMIC_OPENTHREADS=OFF
-DDYNAMIC_OPENSCENEGRAPH=OFF -DANDROID_NDK=<path_to_android_ndk>/
-DOSG_GLES1_AVAILABLE=ON -DOSG_GL1_AVAILABLE=OFF
-DOSG_GL2_AVAILABLE=OFF -DOSG_GL_DISPLAYLISTS_AVAILABLE=OFF -DJ=2
-DOSG_CPP_EXCEPTIONS_AVAILABLE=OFF
$ make
If all is correct you will have and static OSG inside:
build_android_gles1/bin/ndk/local/armeabi.
- GLES2 is not tested/proved, but I think it could be possible build
it with the correct cmake flags.
- The flag -DJ=2 is used to pass to the ndk-build the number of
processors to speed up the building.
- make install is not yet supported."