Dear community members,

I worked the last week on extending osgAndroid and due to own hassles with the initial compilation, I sat down and wrote a new manual that describes the compilation process in detail. could be nicely attached to the guideline on the website written by Rafa. Feedback, comments and questions of clarification are welcome.

Kind Regards,

Christian Kehl

PS: intended for the newly, to-be-submitted version of osgAndroid, but the OSG compile part is equivalent (changes done on the Android.mk structure in osgAndroid, to be negotiated with Rafa and Jordi)

Attachment: manual.pdf
Description: Adobe PDF document

\documentclass[10pt]{scrreprt}
%\usepackage{url}
\usepackage{hyperref}
\usepackage[UKenglish]{babel}

\begin{document}

This manual describes the compilation procedure for OpenSceneGraph development on Android devices. The proposed pipeline is tested to work with OSG versions 3.3.7 and Android NDK r8 and r9.

\begin{enumerate}
\item Download OpenSceneGraph 3.3.8 or above: \url{http://www.openscenegraph.org/index.php/download-section/stable-releases}
\item Download and install the Android NDK for your platform: \url{http://developer.android.com/ndk/index.html}
\item Create an environment variable: \\
\verb+NAME=ANDROID_NDK VALUE=<path to your NDK installation>+
\item Download the 3rd-Party, pre-compiled libraries (\url{http://www2.ai2.upv.es/difusion/osgAndroid/3rdpartyAndroid.zip})
\item \label{cmake_command} Open a commandline (cmd.exe or Terminal) and browse to the extracted head folder (e.g. ''\verb+C:\Users\<username>\\Downloads\\OpenSceneGraph-3.3.8+'' or ''\$\{HOME\}/Downloads/OpenSceneGraph-3.3.8'')
\item Extract the folder ''3rdparty''into your OSG head folder (as above)
\item Run cmake from the commandline (important: GUI CMake currently doesn't work well with the new Android toolchain) with the following string: \\
\begin{verbatim}
cmake .. 
-DCMAKE_TOOLCHAIN_FILE=../PlatformSpecifics/Android/android.toolchain.cmake
-DOSG_BUILD_PLATFORM_ANDROID=ON -DDYNAMIC_OPENTHREADS=OFF 
-DDYNAMIC_OPENSCENEGRAPH=OFF -DOSG_GL_DISPLAYLISTS_AVAILABLE=OFF 
-DOSG_GL_MATRICES_AVAILABLE=OFF -DOSG_GL_VERTEX_FUNCS_AVAILABLE=OFF 
-DOSG_GL_VERTEX_ARRAY_FUNCS_AVAILABLE=OFF -DOSG_GL_FIXED_FUNCTION_AVAILABLE=OFF 
-DOSG_CPP_EXCEPTIONS_AVAILABLE=OFF -DOSG_GL1_AVAILABLE=OFF 
-DOSG_GL2_AVAILABLE=OFF -DOSG_GL3_AVAILABLE=OFF -DOSG_GLES1_AVAILABLE=OFF 
-DOSG_GLES2_AVAILABLE=ON -DOPENGL_PROFILE="GLES2" -DANDROID_NATIVE_API_LEVEL=15 
-DOSG_GL_LIBRARY_STATIC=OFF -DCURL_DIR=../3rdparty/curl -DCURL_IS_STATIC=ON 
-DGDAL_DIR=../3rdparty/gdal/include -DGIFLIB_INCLUDE_DIR=../3rdparty/giflib 
-DJPEG_INCLUDE_DIR=../3rdparty/libjpeg -DPNG_INCLUDE_DIR=../3rdparty/libpng 
-DTIFF_INCLUDE_DIR=../3rdparty/libtiff -DCMAKE_INSTALL_PREFIX=$HOME/android 
(or another folder of your choice - just be consistent)
\end{verbatim}

CMake will generate an installation package native to your environment

\item \label{installation} Run the CMake-generated installation (on Linux: make \&\& [sudo] make install)

Comments:
\begin{itemize}
\item if you want to support multiple target devices, you have to run point~\ref{cmake_command} and ~\ref{installation} multiple times, and add to the cmake string \verb+-DANDROID_ABI=<platform>+, where platform can be (armeabi, armeabi-v7a, ...) (ADVANCED STEP)
\item if you want to compile the libraries for OpenGL ES Profile 1 and 2, you also have to run point~\ref{cmake_command} and ~\ref{installation} multiple times, for each platform in combination with either 

\begin{verbatim}
-DOSG_GLES1_AVAILABLE=OFF 
-DOSG_GLES2_AVAILABLE=ON -DOPENGL_PROFILE="GLES2" 
\end{verbatim} (GL ES 2) 

or 

\begin{verbatim}
-DOSG_GLES1_AVAILABLE=ON 
-DOSG_GLES2_AVAILABLE=OFF -DOPENGL_PROFILE="GLES1"
\end{verbatim} (GL ES 1) (ADVANCED STEP)
\item As you can see, with all the possible configurations the resulting folder structure can get involved. This means you may want to think about an appropriate folder structure in advance. My personal structure is as follows:

\begin{verbatim}
<head installation folder>/android/<gles2 OR gles1>/<platform name>/
\end{verbatim}

which is inserted as \verb+-DCMAKE_INSTALL_PREFIX+.
\end{itemize}
\item after compiling, download (or git-clone) osgAndroid: \url{https://github.com/miragetech/osgAndroid}
\item copy the folders in \verb+<OSG head folder>/build/+ to your android installation directory (e.g.\verb+${HOME}/android+). If you compiled for GLES 1 and 2, you just need to copy it in the GLES 1 directory.
\item Open the Android make file in \verb+<osgAndroid head folder>/org.openscenegraph.android/jni/Android.mk+
\begin{enumerate}
\item go to the section ''\verb+### Static preparation+''
\item adapt the paths for \verb+OSG_HEAD+ to your installation path
\item go to the section ''\verb+### GLES1 build+''
\item adapt the paths for \verb+OSG_HEAD+ to your installation path
\item go to the section ''\verb+### GLES2 build+''
\item adapt the paths for \verb+OSG_HEAD+ to your installation path
\end{enumerate}
\item in the commandline, browse to \verb+<osgAndroid head folder>/org.openscenegraph.android+
\item type: \verb+${ANDROID_NDK}/ndk-build+
\item make sure no error or warning occurred (if all is done correctly, no error or warning shall appear)
\item use the compiled shared/dynamic object (''lib''-subfolder) and the jar-file (''bin''-subfolder) in your project !
\end{enumerate}
\end{document}
_______________________________________________
osg-submissions mailing list
[email protected]
http://lists.openscenegraph.org/listinfo.cgi/osg-submissions-openscenegraph.org

Reply via email to