Commit e5b8c231 authored by Sebastian Eichelbaum's avatar Sebastian Eichelbaum

[ADD] added some basic patches from the OpenWalnut Android development. This...

[ADD] added some basic patches from the OpenWalnut Android development. This should be enough to compile OW using the NDK
parent 3b88ec4d
......@@ -35,6 +35,8 @@ SET( LibName ${OW_LIB_OPENWALNUT} )
ADD_DEFINITIONS( '-DW_LIB_PREFIX="${CMAKE_SHARED_LIBRARY_PREFIX}"' )
ADD_DEFINITIONS( '-DW_LIB_SUFFIX="${CMAKE_SHARED_LIBRARY_SUFFIX}"' )
OPTION( OW_STATIC_BUILD "Enable this to build the core library as static library." OFF )
# ---------------------------------------------------------------------------------------------------------------------------------------------------
# Add sources as target
# ---------------------------------------------------------------------------------------------------------------------------------------------------
......@@ -43,7 +45,12 @@ ADD_DEFINITIONS( '-DW_LIB_SUFFIX="${CMAKE_SHARED_LIBRARY_SUFFIX}"' )
COLLECT_COMPILE_FILES( "${CMAKE_CURRENT_SOURCE_DIR}" TARGET_CPP_FILES TARGET_H_FILES TARGET_TEST_FILES )
# Setup the target
ADD_LIBRARY( ${LibName} SHARED ${TARGET_CPP_FILES} ${TARGET_H_FILES} ${OW_VERSION_HEADER} )
IF( OW_STATIC_BUILD )
ADD_LIBRARY( ${LibName} STATIC ${TARGET_CPP_FILES} ${TARGET_H_FILES} ${OW_VERSION_HEADER} )
ELSE()
ADD_LIBRARY( ${LibName} SHARED ${TARGET_CPP_FILES} ${TARGET_H_FILES} ${OW_VERSION_HEADER} )
ENDIF()
TARGET_LINK_LIBRARIES( ${LibName} ${Boost_LIBRARIES} ${CMAKE_STANDARD_LIBRARIES} ${CMAKE_DL_LIBS} ${OPENGL_gl_LIBRARY} ${OPENSCENEGRAPH_LIBRARIES}
)
......
......@@ -22,7 +22,7 @@
//
//---------------------------------------------------------------------------
#if (( defined( __linux__ ) && defined( __GNUC__ )) || defined( __APPLE__ ))
#if (( defined( __linux__ ) && defined( __GNUC__ )) && !defined( __ANDROID__) || defined ( __APPLE__ ))
#define BACKTRACE_SUPPORTED
#endif
......
......@@ -22,7 +22,7 @@
//
//---------------------------------------------------------------------------
#ifdef __linux__
#if ( defined( __linux__ ) && !defined( __ANDROID__ ) )
#include <sys/prctl.h>
#endif
......
......@@ -104,7 +104,9 @@ void WGEScreenCapture::operator()( osg::RenderInfo& renderInfo ) const // NOLIN
frameCounter.m_framesLeft--;
// read back buffer
#ifndef GL_ES_VERSION_2_0
glReadBuffer( GL_BACK );
#endif
// The following code uses PBO to grab the framebuffer. This sometimes causes errors. I am not sure why. glReadPixels
// osg::ref_ptr< osg::Image > imagePBO = new osg::Image();
......
......@@ -283,9 +283,31 @@ ENDIF()
# find the needed packages
SET( MIN_OSG_VERSION 2.8.0 )
FIND_PACKAGE( OpenSceneGraph ${MIN_OSG_VERSION} REQUIRED osgDB osgUtil osgGA osgViewer osgSim osgWidget osgText )
FIND_PACKAGE( OpenSceneGraph ${MIN_OSG_VERSION} REQUIRED osgWidget osgViewer osgText osgSim osgGA osgDB osgUtil )
IF( OPENSCENEGRAPH_FOUND )
INCLUDE_DIRECTORIES( ${OPENSCENEGRAPH_INCLUDE_DIRS} )
# is the OSG linked statically? If yes, we need to take care that all the osgdb plugins are linked too.
STRING( REGEX MATCH "osgDB\\.a" OPENSCENEGRAPH_STATIC "${OPENSCENEGRAPH_LIBRARIES}" )
IF( OPENSCENEGRAPH_STATIC )
MESSAGE( STATUS "Found static OpenSceneGraph! Adding all osgDB plugins." )
ADD_DEFINITIONS( -DOSG_LIBRARY_STATIC )
# we need to find the path. Unfortunately, the OSG find scripts do not provide these info
LIST( GET OPENSCENEGRAPH_LIBRARIES 0, firstElement )
GET_FILENAME_COMPONENT( firstElementPath ${firstElement} PATH )
# hopefully all static osgdb plugins reside in this directory
FILE( GLOB plugInLibs "${firstElementPath}/*osgdb_*.a" )
LIST( SORT plugInLibs )
SET( OPENSCENEGRAPH_OSGDB_LIBS "" )
FOREACH( plugIn ${plugInLibs} )
LIST( APPEND OPENSCENEGRAPH_OSGDB_LIBS ${plugIn} )
ENDFOREACH()
# The osgDB plugins need to be linked BEFORE osg and osgDB
LIST( INSERT OPENSCENEGRAPH_LIBRARIES 0 ${OPENSCENEGRAPH_OSGDB_LIBS} )
ENDIF()
ENDIF()
# NOTE: sorry but this is needed since those vars spam the ccmake. The user should find the important options fast!
......
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment