Improving Android support

Discussion of issues specific to mobile platforms such as iOS, Android, Symbian and Meego.
haydenli
Gnoblar
Posts: 15
Joined: Thu Apr 26, 2012 4:23 am
x 3

Re: Improving Android support

Post by haydenli »

Wolfmanfx , Thanks for your great work! Finally a running ogre in android!

I want to ask, if I want to hook an ogre project to an android project, how can this be done in eclipse? Mind giving some pointer here? As I need to pack the mini game to an android application.

Thanks so much!

BTW, I wrap up the configuration in a bat file as below for the configuration before nmake. Hope someone may find this helpful.

Code: Select all

@echo off

if "%1" == "" (
	echo "Enter build target directory."
	@exit /b 1
)

if "%NDK%" == "" (
	echo "NDK Path is empty."
	@exit /b 1
)

if "%LIBPATH%" == "" (
	echo "Warning: vc++ environment is missing."
)

if not exist %1 (
	mkdir %1
)

cd %1

cmake .. -G "NMake Makefiles" -DCMAKE_TOOLCHAIN_FILE="../CMake/toolchain/android.toolchain.cmake" -DOGRE_DEPENDENCIES_DIR="../AndroidDependencies" -DTargetPlatform="Android" -DOGRE_BUILD_RENDERSYSTEM_GLES2=TRUE -DOGRE_STATIC=TRUE -DANDROID_NATIVE_API_LEVEL=14 -DOGRE_BUILD_COMPONENT_PAGING=FALSE -DOGRE_BUILD_COMPONENT_TERRAIN=FALSE -DOGRE_BUILD_COMPONENT_RTSHADERSYSTEM=TRUE -DOGRE_BUILD_PLUGIN_BSP=FALSE -DOGRE_BUILD_PLUGIN_PCZ=FALSE -DOGRE_BUILD_RENDERSYSTEM_GLES=FALSE -DOGRE_BUILD_TESTS=FALSE -DOGRE_BUILD_TOOLS=FALSE
haydenli
Gnoblar
Posts: 15
Joined: Thu Apr 26, 2012 4:23 am
x 3

Re: Improving Android support

Post by haydenli »

Hi,

Mind asking if I can build this in VS for Window use? As I get a bunch of error like this while building using VS2010

Code: Select all

1>     Creating library D:/downloadFramework/WolfMax_Trunk/ogre_vc10-v1-8-0/lib/Debug/OgreMain_d.lib and object D:/downloadFramework/WolfMax_Trunk/ogre_vc10-v1-8-0/lib/Debug/OgreMain_d.exp
1>OgreRoot.obj : error LNK2001: unresolved external symbol "public: virtual class Ogre::SharedPtr<class Ogre::DataStream> __thiscall Ogre::ETC1Codec::code(class Ogre::SharedPtr<class Ogre::MemoryDataStream> &,class Ogre::SharedPtr<class Ogre::Codec::CodecData> &)const " (?code@ETC1Codec@Ogre@@UBE?AV?$SharedPtr@VDataStream@Ogre@@@2@AAV?$SharedPtr@VMemoryDataStream@Ogre@@@2@AAV?$SharedPtr@VCodecData@Codec@Ogre@@@2@@Z)
1>OgreRoot.obj : error LNK2001: unresolved external symbol "public: virtual void __thiscall Ogre::ETC1Codec::codeToFile(class Ogre::SharedPtr<class Ogre::MemoryDataStream> &,class std::basic_string<char,struct std::char_traits<char>,class std::allocator<char> > const &,class Ogre::SharedPtr<class Ogre::Codec::CodecData> &)const " (?codeToFile@ETC1Codec@Ogre@@UBEXAAV?$SharedPtr@VMemoryDataStream@Ogre@@@2@ABV?$basic_string@DU?$char_traits@D@std@@V?$allocator@D@2@@std@@AAV?$SharedPtr@VCodecData@Codec@Ogre@@@2@@Z)
1>OgreRoot.obj : error LNK2001: unresolved external symbol "public: virtual struct std::pair<class Ogre::SharedPtr<class Ogre::MemoryDataStream>,class Ogre::SharedPtr<class Ogre::Codec::CodecData> > __thiscall Ogre::ETC1Codec::decode(class Ogre::SharedPtr<class Ogre::DataStream> &)const " (?decode@ETC1Codec@Ogre@@UBE?AU?$pair@V?$SharedPtr@VMemoryDataStream@Ogre@@@Ogre@@V?$SharedPtr@VCodecData@Codec@Ogre@@@2@@std@@AAV?$SharedPtr@VDataStream@Ogre@@@2@@Z)
1>OgreRoot.obj : error LNK2001: unresolved external symbol "public: virtual class std::basic_string<char,struct std::char_traits<char>,class std::allocator<char> > __thiscall Ogre::ETC1Codec::getType(void)const " (?getType@ETC1Codec@Ogre@@UBE?AV?$basic_string@DU?$char_traits@D@std@@V?$allocator@D@2@@std@@XZ)
1>OgreRoot.obj : error LNK2001: unresolved external symbol "public: virtual class std::basic_string<char,struct std::char_traits<char>,class std::allocator<char> > __thiscall Ogre::ETC1Codec::magicNumberToFileExt(char const *,unsigned int)const " (?magicNumberToFileExt@ETC1Codec@Ogre@@UBE?AV?$basic_string@DU?$char_traits@D@std@@V?$allocator@D@2@@std@@PBDI@Z)
1>OgreRoot.obj : error LNK2019: unresolved external symbol "public: static void __cdecl Ogre::ETC1Codec::startup(void)" (?startup@ETC1Codec@Ogre@@SAXXZ) referenced in function "public: __thiscall Ogre::Root::Root(class std::basic_string<char,struct std::char_traits<char>,class std::allocator<char> > const &,class std::basic_string<char,struct std::char_traits<char>,class std::allocator<char> > const &,class std::basic_string<char,struct std::char_traits<char>,class std::allocator<char> > const &)" (??0Root@Ogre@@QAE@ABV?$basic_string@DU?$char_traits@D@std@@V?$allocator@D@2@@std@@00@Z)
1>OgreRoot.obj : error LNK2019: unresolved external symbol "public: static void __cdecl Ogre::ETC1Codec::shutdown(void)" (?shutdown@ETC1Codec@Ogre@@SAXXZ) referenced in function "public: __thiscall Ogre::Root::~Root(void)" (??1Root@Ogre@@QAE@XZ)
1>D:\downloadFramework\WolfMax_Trunk\ogre_vc10-v1-8-0\bin\Debug\OgreMain_d.dll : fatal error LNK1120: 7 unresolved externals
BigDave2001
Kobold
Posts: 37
Joined: Tue Feb 21, 2012 3:57 pm

Re: Improving Android support

Post by BigDave2001 »

Hi,

I've managed to build the Ogre code for Android. But when I run it from device I get the following error:

Code: Select all


I/ActivityManager(  203): START {act=android.intent.action.MAIN cat=[android.intent.category.LAUNCHER] flg=0x10200000 cmp=org.ogre3d.browser/android.app.NativeActivity} from pid 374
D/dalvikvm( 1236): Late-enabling CheckJNI
D/dalvikvm(  203): GC_FOR_ALLOC freed 741K, 41% free 6890K/11655K, paused 135ms
I/ActivityManager(  203): Start proc org.ogre3d.browser for activity org.ogre3d.browser/android.app.NativeActivity: pid=1236 uid=10044 gids={}
D/OpenGLRenderer(  374): Flushing caches (mode 1)
D/AndroidRuntime( 1236): Shutting down VM
W/dalvikvm( 1236): threadid=1: thread exiting with uncaught exception (group=0x40a4a1f8)
E/AndroidRuntime( 1236): FATAL EXCEPTION: main
E/AndroidRuntime( 1236): java.lang.RuntimeException: Unable to start activity ComponentInfo{org.ogre3d.browser/android.app.NativeActivity}: java.lang.IllegalArgumentException: Unable to find native library: OgreSampleBrowser
Looks like (with my limited knowledge) it can't find OgreSampleBrowser, but it is there in the APK.

After building the code (make) do the following:

Code: Select all

ant debug
adb install bin/NativeActivitiy-debug.apk
The app is then present on device but when I run it, it crashes straight away.

Any ideas? The phone is using the latest Ice Cream Sandwich (4.04).
BigDave2001
Kobold
Posts: 37
Joined: Tue Feb 21, 2012 3:57 pm

Re: Improving Android support

Post by BigDave2001 »

Ok - I'm getting somewhere - the phone has an arm6 CPU and I noticed that the lib folder has a subfolder called "armeabi-v7a", whereas my other apps use the folder name "armeabi".

Renamed this manually, re-did the

Code: Select all

ant debug
and loaded and ran. Different error this time...

Code: Select all

I/ActivityManager(  203): START {act=android.intent.action.MAIN cat=[android.intent.category.LAUNCHER] flg=0x10200000 cmp=org.ogre3d.browser/android.app.NativeActivity} from pid 374
D/dalvikvm( 1987): Late-enabling CheckJNI
D/dalvikvm(  203): GC_FOR_ALLOC freed 579K, 45% free 7102K/12743K, paused 128ms
I/ActivityManager(  203): Start proc org.ogre3d.browser for activity org.ogre3d.browser/android.app.NativeActivity: pid=1987 uid=10044 gids={}
D/OpenGLRenderer(  374): Flushing caches (mode 1)
F/libc    ( 1987): Fatal signal 4 (SIGILL) at 0x508d329c (code=1)
D/OpenGLRenderer(  374): Flushing caches (mode 0)
I/Process (  203): Sending signal. PID: 1987 SIG: 3
I/dalvikvm( 1987): threadid=3: reacting to signal 3
I/dalvikvm( 1987): Wrote stack traces to '/data/anr/traces.txt'
I/DEBUG   (  111): *** *** *** *** *** *** *** *** *** *** *** *** *** *** *** ***
I/DEBUG   (  111): Build fingerprint: 'ZTE/P772A10D/atlas40:4.0.4/IMM76D/20120608.113547:user/release-keys'
I/DEBUG   (  111): pid: 1987, tid: 1987  >>> org.ogre3d.browser <<<
I/DEBUG   (  111): signal 4 (SIGILL), code 1 (ILL_ILLOPC), fault addr 508d329c
I/DEBUG   (  111):  r0 50f2e968  r1 50f2ebc4  r2 00000000  r3 00000000
I/DEBUG   (  111):  r4 bece12fc  r5 50f2e968  r6 00000000  r7 50f2e8d4
Will continue to investigate, but is it possible the code is being built for Arm7 and that is why it is crashing?
User avatar
Wolfmanfx
OGRE Team Member
OGRE Team Member
Posts: 1525
Joined: Fri Feb 03, 2006 10:37 pm
Location: Austria - Leoben
x 99
Contact:

Re: Improving Android support

Post by Wolfmanfx »

@BigDave2001
Ah no it will not work on arm6 because i compiled everything for armv7 - to get it work i must rebuild everything and create a fat binary containing both versions.
So renaming will crash hard.

@haydenli
It should work on windows try to recreate the MSVC project (delete the cmake build folder) these linker errors mean that the cpp file is not included.
If its still not working you can disable ETC support via CMake gui.
BigDave2001
Kobold
Posts: 37
Joined: Tue Feb 21, 2012 3:57 pm

Re: Improving Android support

Post by BigDave2001 »

Thanks for that :-)

I just worked out that if I changed the application.mk that I could specify the non-arm 7 (but it still crashes), but are you saying that wouldn't be enough, there are other dependencies on Arm 7?

Out of interest, in that case, when releasing apps is it possible to specify to users that the CPU must be Arm7 - is there a way to do that?
User avatar
Wolfmanfx
OGRE Team Member
OGRE Team Member
Posts: 1525
Joined: Fri Feb 03, 2006 10:37 pm
Location: Austria - Leoben
x 99
Contact:

Re: Improving Android support

Post by Wolfmanfx »

Yes the deps are also compiled for armv7 (so its using armv7 opcode).
User avatar
Xplodwild
Goblin
Posts: 231
Joined: Thu Feb 12, 2009 3:49 pm
Location: France
x 13
Contact:

Re: Improving Android support

Post by Xplodwild »

Thanks for your code :)

I'm trying to compile everything on a Linux box. So far everything goes fine, I have Ogre compiled, as well as libOgreSampleBrowser.so. However, I can't seem to be able to build the APK. Is Eclipse needed? What steps am I missing to build the apk?
User avatar
Wolfmanfx
OGRE Team Member
OGRE Team Member
Posts: 1525
Joined: Fri Feb 03, 2006 10:37 pm
Location: Austria - Leoben
x 99
Contact:

Re: Improving Android support

Post by Wolfmanfx »

Mmm on linux ant command must be in your path. Eclipse is not needed but ant to build the apk.
User avatar
Xplodwild
Goblin
Posts: 231
Joined: Thu Feb 12, 2009 3:49 pm
Location: France
x 13
Contact:

Re: Improving Android support

Post by Xplodwild »

Thanks - that did the trick. I had to run

Code: Select all

android update project --path .
firsthand to generate a build.xml for ant though. Then "ant debug" built the apk. Testing in a few minutes on a Galaxy S3 and later today on a Galaxy Note, Galaxy Nexus and TF300T! :)

Edit: All black on a Galaxy S III (I only see the "BSP" sample title). I smell some textures compatibility issues there.

Edit2: All black but text and colored objects on TF300T too. Could something be wrong by building the way I did? (textures not getting packed)

Edit3: PNG codec not found - I'm missing FreeImage. Lib is installed but CMake doesn't find it
User avatar
Wolfmanfx
OGRE Team Member
OGRE Team Member
Posts: 1525
Joined: Fri Feb 03, 2006 10:37 pm
Location: Austria - Leoben
x 99
Contact:

Re: Improving Android support

Post by Wolfmanfx »

Hi,

Stop editing the same post because then i do not get a notification.

Yeah just look some posts up you have to use the deps i precompiled and you can add the freeimage paths through console or gui then everything will work.
haydenli
Gnoblar
Posts: 15
Joined: Thu Apr 26, 2012 4:23 am
x 3

Re: Improving Android support

Post by haydenli »

Hi,

I am trying to make a demo ogre head project based on your SDK and building using eclipse. However, when I try initing the Ogre by

Code: Select all

mRoot = new Ogre::Root()
It gets error:

Code: Select all

07-06 15:48:46.894: A/libc(8635): Fatal signal 11 (SIGSEGV) at 0x00000000 (code=1)
I try separating the constructor of the Ogre Root and seems like I will get this error when createLog().

Do you have any idea what is wrong with this?

P.S I run this piece of code write after app_dummy() in android_main()
User avatar
Xplodwild
Goblin
Posts: 231
Joined: Thu Feb 12, 2009 3:49 pm
Location: France
x 13
Contact:

Re: Improving Android support

Post by Xplodwild »

Wolfmanfx wrote:Hi,

Stop editing the same post because then i do not get a notification.

Yeah just look some posts up you have to use the deps i precompiled and you can add the freeimage paths through console or gui then everything will work.
Yeah sorry - I just didn't want to flood the topic either :)
After manually entering FreeImage path to CMake, it works well (although a bit slow, 20-30fps on most demos, but it might be because I'm running a debug build made with "ant debug").
haydenli
Gnoblar
Posts: 15
Joined: Thu Apr 26, 2012 4:23 am
x 3

Re: Improving Android support

Post by haydenli »

Hi,

I find that if I use ndk-build in the command prompt there is no such error when createLog(), but when I run the ndk-builder using eclipse there is no way to avoid this.

Do you have any idea about the issue?

Many thanks in advance.
haydenli
Gnoblar
Posts: 15
Joined: Thu Apr 26, 2012 4:23 am
x 3

Re: Improving Android support

Post by haydenli »

Hi,

Finally figured out the problem. After using the newer release of android ndk-builder I am able to build it using eclipse!
haydenli
Gnoblar
Posts: 15
Joined: Thu Apr 26, 2012 4:23 am
x 3

Re: Improving Android support

Post by haydenli »

Hi Wolfmanfx,

Mind asking do you know how can we add open the android camera underneath the Ogre view layer? As we are targeting to make an AR browser, we need to be able to preview the camera output.

Many thanks in advance!
Furinax
Gnoblar
Posts: 1
Joined: Sat Jul 14, 2012 7:42 pm

Re: Improving Android support

Post by Furinax »

Hey wolfmanfx,

I'm an android developer and I have extensive experience with the NDK. I see you're well under way, just curious if you can give me a run-down of where you're at and more specifically what you need help with if anything. Thanks and great work. :)
mike_cyber
Halfling
Posts: 48
Joined: Thu Jun 21, 2012 11:45 am

Re: Improving Android support

Post by mike_cyber »

Downloaded from first post. Now how to compile? Cannot find any tutorial. Simply run cmake-gui on Ubuntu and copy over to my Sony?

PS: Now that's what I get:
michael@michael-ubuntu:~/ogre/build/Samples$ make
[ 0%] Building CXX object OgreMain/CMakeFiles/OgreMain.dir/src/OgreAutoParamDataSource.cpp.o
In file included from /home/michael/ogre/OgreMain/include/OgreMatrix4.h:35:0,
from /home/michael/ogre/OgreMain/include/OgreAutoParamDataSource.h:33,
from /home/michael/ogre/OgreMain/src/OgreAutoParamDataSource.cpp:30:
/home/michael/ogre/OgreMain/include/OgreMatrix3.h: In member function ‘Ogre::Real* Ogre::Matrix3::operator[](size_t) const’:
/home/michael/ogre/OgreMain/include/OgreMatrix3.h:117:24: warning: cast from type ‘const Real* {aka const float*}’ to type ‘Ogre::Real* {aka float*}’ casts away qualifiers [-Wcast-qual]
In file included from /home/michael/ogre/OgreMain/include/OgreRoot.h:39:0,
from /home/michael/ogre/OgreMain/src/OgreAutoParamDataSource.cpp:36:
/home/michael/ogre/OgreMain/include/OgreWorkQueue.h: At global scope:
/home/michael/ogre/OgreMain/include/OgreWorkQueue.h:475:4: error: expected ‘;’ at end of member declaration
/home/michael/ogre/OgreMain/include/OgreWorkQueue.h:532:3: error: expected ‘;’ at end of member declaration
make[2]: *** [OgreMain/CMakeFiles/OgreMain.dir/src/OgreAutoParamDataSource.cpp.o] Error 1
make[1]: *** [OgreMain/CMakeFiles/OgreMain.dir/all] Error 2
make: *** [all] Error 2
michael@michael-ubuntu:~/ogre/build/Samples$
haydenli
Gnoblar
Posts: 15
Joined: Thu Apr 26, 2012 4:23 am
x 3

Re: Improving Android support

Post by haydenli »

Furinax wrote:Hey wolfmanfx,

I'm an android developer and I have extensive experience with the NDK. I see you're well under way, just curious if you can give me a run-down of where you're at and more specifically what you need help with if anything. Thanks and great work. :)

Hey Furinax,

As I have very little knowledge on NDK, mind asking do you have any idea of how to add a camera preview layer underneath the ogre render window so that I can make a AR browser?

Many thanks in advance.
Nick Johnson
Gnoblar
Posts: 3
Joined: Mon Jul 16, 2012 8:34 am

Re: Improving Android support

Post by Nick Johnson »

Hey,,,

Is it possible for you to give step-by-step guide to compile ogre on android....???????

Thanx........
haydenli
Gnoblar
Posts: 15
Joined: Thu Apr 26, 2012 4:23 am
x 3

Re: Improving Android support

Post by haydenli »

Nick Johnson wrote:Hey,,,

Is it possible for you to give step-by-step guide to compile ogre on android....???????

Thanx........
If Win platform:

Pre-request:
  • 1. visual studio xxx
    2. cmake , and make sure cmake executable is in the PATH environment
    3. ant , and make sure ant executable is in the PATH environment
    4. environment variable: ANDROID_NDK is pointing to the root NDK path, make sure this path is also included in the PATH environment, so ndk-build can be called
    5. environment variable: ANDROID_SDK is pointing to the root SDK path, make sure the tools in this path is also included in the PATH environment, so the sdk tools can be accessed in the terminal

Steps:
  • 1. Download from: https://bitbucket.org/wolfmanfx/ogre to a desired location
    2.Download dependencies from: http://www.coderabbit.at/AndroidDependencies.zip
    3. Extract the dependencies to the location in step 1 (so you will have something like: desiredLocation/AndroidDependencies)
    4. Create a bat file under desiredLocation as below, name it as configure-android.bat:

    Code: Select all

    @echo off
    
    set MAINFOLDER=%CD%
    
    if "%1" == "" (
    	echo "Enter build target directory."
    	@exit /b 1
    )
    
    if "%LIBPATH%" == "" (
    	echo "Warning: vc++ environment is missing."
    )
    
    if not exist %1 (
    	mkdir %1
    )
    
    cd %1
    
    cmake  %MAINFOLDER% -G "NMake Makefiles" -DCMAKE_TOOLCHAIN_FILE="%MAINFOLDER%/CMake/toolchain/android.toolchain.cmake" -DOGRE_DEPENDENCIES_DIR="%MAINFOLDER%/AndroidDependencies" -DTargetPlatform="Android" -DOGRE_BUILD_RENDERSYSTEM_GLES2=TRUE -DOGRE_STATIC=TRUE -DANDROID_NATIVE_API_LEVEL=14 -DOGRE_BUILD_COMPONENT_PAGING=FALSE -DOGRE_BUILD_COMPONENT_TERRAIN=FALSE -DOGRE_BUILD_COMPONENT_RTSHADERSYSTEM=TRUE -DOGRE_BUILD_PLUGIN_BSP=FALSE -DOGRE_BUILD_PLUGIN_PCZ=FALSE -DOGRE_BUILD_RENDERSYSTEM_GLES=FALSE -DOGRE_BUILD_TESTS=FALSE -DOGRE_BUILD_TOOLS=FALSE
    
    rem cd %MAINFOLDER%
    
    5. Open a VS terminal or a normal terminal then run "C:\Program Files\Microsoft Visual Studio 10.0\VC\bin\vcvars32.bat" (if you installed Microsoft Visual Studio somewhere else, of course use that path instead)
    6. Go to the location in step 1 in the terminal then run

    Code: Select all

    5. .\configure-android BUILD
    BUILD is the location for the built folder
    7. run:

    Code: Select all

    nmake
Run Sample android project:
  • 1. You will see SampleBrowserNDK under the BUILD folder, in the terminal go to that directory
    2. Run

    Code: Select all

    ant debug
    for building a debug version
    3. Run

    Code: Select all

    ant installd
    to install to your android device
Last edited by haydenli on Tue Jul 17, 2012 7:47 am, edited 1 time in total.
haydenli
Gnoblar
Posts: 15
Joined: Thu Apr 26, 2012 4:23 am
x 3

Re: Improving Android support

Post by haydenli »

Hi,

Anyone has any idea of how to add a camera preview in NDK with Ogre running on top?

Thanks.
mike_cyber
Halfling
Posts: 48
Joined: Thu Jun 21, 2012 11:45 am

Re: Improving Android support

Post by mike_cyber »

Hi
make doesn't create the samplebrowserndk, hence I try:
/home/michael/Android-dev/android-sdk-linux/tools/android create project --target 10 --name SampleBrowserNDK --path ./SampleBrowserNDK --activity SampleBrowserNDKActivity --package com.example.SampleBrowserNDK

After that I do: ant debug
What's wrong with the above? I get a hello world but not a samplebrowser.
Thanks

PS: how do I add: Tip: Add the platform-tools/ as well as the tools/ directory to your PATH environment variable.
in .bashrc I've:
export NDK=/home/michael/Android-dev/android-ndk-r8
export ANDROID_NDK=/home/michael/Android-dev/android-ndk-r8
export NDK_BIN=$NDK/toolchains/arm-linux-androideabi-4.4.3/prebuilt/linux-x86/bin
export PATH=$PATH:$NDK_BIN

but no idea on how to add more...
Last edited by mike_cyber on Wed Jul 18, 2012 10:30 am, edited 5 times in total.
ironsteel
Gnoblar
Posts: 5
Joined: Mon Feb 20, 2012 9:27 am

Re: Improving Android support

Post by ironsteel »

Hi.

Did someone successfully compiled the browser on a linux distro ?
I'm following the steps in the thread but i only got OgreMain, RTSS, ParticleFX and OpenGL ES 2.0 RS components compiled ?

Here's what I do.

1. Clone the repo.
2. Setup my ANDROID_NDK and ANDROID_SDK env variables.
3. Then made a dir in the main source tree called Android and cd to it.
4. Download the precompiled deps and extract them into the Android dir made in step 3 .
5. Then run

Code: Select all

#!/bin/bash
cmake .. -DCMAKE_TOOLCHAIN_FILE="`pwd`/../CMake/toolchain/android.toolchain.cmake" -DOGRE_DEPENDENCIES_DIR="`pwd`/AndroidDependencies" -DTargetPlatform="Android" -DOGRE_BUILD_RENDERSYSTEM_GLES2=TRUE -DOGRE_STATIC=TRUE -DANDROID_NATIVE_API_LEVEL=14 -DOGRE_BUILD_COMPONENT_PAGING=FALSE -DOGRE_BUILD_COMPONENT_TERRAIN=FALSE -DOGRE_BUILD_COMPONENT_RTSHADERSYSTEM=TRUE -DOGRE_BUILD_PLUGIN_BSP=FALSE -DOGRE_BUILD_PLUGIN_PCZ=FALSE -DOGRE_BUILD_RENDERSYSTEM_GLES=FALSE -DOGRE_BUILD_TESTS=FALSE -DOGRE_BUILD_TOOLS=FALSE
6. Then run make -j4. Everything OK, but got no sample libraries only the main stuff.

What am I doing wrong ?

Thanks in advance.

P.S. Keep up the good work :).
mike_cyber
Halfling
Posts: 48
Joined: Thu Jun 21, 2012 11:45 am

Re: Improving Android support

Post by mike_cyber »

Following haydenli steps 1,2,3. Then copied AndroidDependencies also to Dependencies
4. cmake-gui
5. michael@michael-ubuntu:~/ogre/build$ cmake /home/michael/ogre -G "Unix Makefiles" -DCMAKE_TOOLCHAIN_FILE="/home/michael/ogre/CMake/toolchain/android.toolchain.cmake" -DOGRE_DEPENDENCIES_DIR="/home/michael/ogre/AndroidDependencies" -DTargetPlatform="Android" -DOGRE_BUILD_RENDERSYSTEM_GLES2=TRUE -DOGRE_STATIC=TRUE -DANDROID_NATIVE_API_LEVEL=14 -DOGRE_BUILD_COMPONENT_PAGING=FALSE -DOGRE_BUILD_COMPONENT_TERRAIN=FALSE -DOGRE_BUILD_COMPONENT_RTSHADERSYSTEM=TRUE -DOGRE_BUILD_PLUGIN_BSP=FALSE -DOGRE_BUILD_PLUGIN_PCZ=FALSE -DOGRE_BUILD_RENDERSYSTEM_GLES=FALSE -DOGRE_BUILD_TESTS=FALSE -DOGRE_BUILD_TOOLS=FALSE

make sure to have all dependencies. I had to add some libs manually to CMakeCache.txt
6. make
I got some errors, easy to fix add ; and such.
Now I'm stuck here:
Linking CXX static library ../../lib/libRenderSystem_GLStatic.a
[ 61%] Built target RenderSystem_GL
Scanning dependencies of target RenderSystem_GLES2
[ 61%] Building CXX object RenderSystems/GLES2/CMakeFiles/RenderSystem_GLES2.dir/src/OgreGLES2Context.cpp.o
In file included from /home/michael/ogre/RenderSystems/GLES2/include/OgreGLES2Context.h:32:0,
from /home/michael/ogre/RenderSystems/GLES2/src/OgreGLES2Context.cpp:29:
/home/michael/ogre/RenderSystems/GLES2/include/OgreGLES2Prerequisites.h:76:26: fatal error: GLES2/gl2.h: No such file or directory
compilation terminated.
make[2]: *** [RenderSystems/GLES2/CMakeFiles/RenderSystem_GLES2.dir/src/OgreGLES2Context.cpp.o] Error 1
make[1]: *** [RenderSystems/GLES2/CMakeFiles/RenderSystem_GLES2.dir/all] Error 2
make: *** [all] Error 2

I found multiple at:
/home/michael/Android-dev/android-ndk-r8/platforms/android-14/arch-arm/usr/include/GLES2
or
/home/michael/Android-dev/android-ndk-r8/platforms/android-14/arch-x86/usr/include/GLES2
etc.
What should I use on Ubuntu 12.04 64bit? arch-x86?
Thanks and cheers. I'll report/modify later this post.
Michael
Locked