From Rafa Gaitan, "I finally had some time to change the build system for Android using a Toolchain, which, I think, will be easier to maintain and uses cmake standard system to build it.

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
This commit is contained in:
Robert Osfield
2014-11-21 10:37:33 +00:00
parent 2986df22d6
commit b9a529148a
7 changed files with 1839 additions and 108 deletions

View File

@@ -39,7 +39,4 @@ IF ((QT4_FOUND OR Qt5Widgets_FOUND) AND NOT ANDROID)
ADD_SUBDIRECTORY(osgQt)
ENDIF()
IF(ANDROID)
configure_file("${OSG_ANDROID_TEMPLATES}/Android.mk.src.in" "${CMAKE_CURRENT_BINARY_DIR}/Android.mk")
ENDIF()

View File

@@ -25,7 +25,7 @@ IF(ANDROID)
SET(CMAKE_REQUIRED_DEFINITIONS "${CMAKE_REQUIRED_DEFINITIONS} -D_GNU_SOURCE")
SET(MODULE_USER_STATIC_OR_DYNAMIC ${OPENTHREADS_USER_DEFINED_DYNAMIC_OR_STATIC})
#SET(CPP_EXTENSION "c++")
SETUP_ANDROID_LIBRARY(${LIB_NAME})
SETUP_LIBRARY(${LIB_NAME})
ELSE()
# should check?

View File

@@ -109,5 +109,55 @@ USE_SERIALIZER_WRAPPER(UserDataContainer)
USE_SERIALIZER_WRAPPER(VertexProgram)
USE_SERIALIZER_WRAPPER(Viewport)
// Arrays
USE_SERIALIZER_WRAPPER(Array)
USE_SERIALIZER_WRAPPER(FloatArray)
USE_SERIALIZER_WRAPPER(Vec2Array)
USE_SERIALIZER_WRAPPER(Vec3Array)
USE_SERIALIZER_WRAPPER(Vec4Array)
USE_SERIALIZER_WRAPPER(DoubleArray)
USE_SERIALIZER_WRAPPER(Vec2dArray)
USE_SERIALIZER_WRAPPER(Vec3dArray)
USE_SERIALIZER_WRAPPER(Vec4dArray)
USE_SERIALIZER_WRAPPER(ByteArray)
USE_SERIALIZER_WRAPPER(Vec2bArray)
USE_SERIALIZER_WRAPPER(Vec3bArray)
USE_SERIALIZER_WRAPPER(Vec4bArray)
USE_SERIALIZER_WRAPPER(UByteArray)
USE_SERIALIZER_WRAPPER(Vec2ubArray)
USE_SERIALIZER_WRAPPER(Vec3ubArray)
USE_SERIALIZER_WRAPPER(Vec4ubArray)
USE_SERIALIZER_WRAPPER(ShortArray)
USE_SERIALIZER_WRAPPER(Vec2sArray)
USE_SERIALIZER_WRAPPER(Vec3sArray)
USE_SERIALIZER_WRAPPER(Vec4sArray)
USE_SERIALIZER_WRAPPER(UShortArray)
USE_SERIALIZER_WRAPPER(Vec2usArray)
USE_SERIALIZER_WRAPPER(Vec3usArray)
USE_SERIALIZER_WRAPPER(Vec4usArray)
USE_SERIALIZER_WRAPPER(IntArray)
USE_SERIALIZER_WRAPPER(Vec2iArray)
USE_SERIALIZER_WRAPPER(Vec3iArray)
USE_SERIALIZER_WRAPPER(Vec4iArray)
USE_SERIALIZER_WRAPPER(UIntArray)
USE_SERIALIZER_WRAPPER(Vec2uiArray)
USE_SERIALIZER_WRAPPER(Vec3uiArray)
USE_SERIALIZER_WRAPPER(Vec4uiArray)
// PrimitiveSets
USE_SERIALIZER_WRAPPER(PrimitiveSet)
USE_SERIALIZER_WRAPPER(DrawArrays)
USE_SERIALIZER_WRAPPER(DrawArrayLengths)
USE_SERIALIZER_WRAPPER(DrawElementsUByte)
USE_SERIALIZER_WRAPPER(DrawElementsUShort)
USE_SERIALIZER_WRAPPER(DrawElementsUInt)
extern "C" void wrapper_serializer_library_osg(void) {}