Ogre 1.10.11 compile for IOS devices (MacOS 10.13.2 / XCode 9.2) Topic is solved

Discussion of issues specific to mobile platforms such as iOS, Android, Symbian and Meego.
aphcoder
Gnoblar
Posts: 5
Joined: Sat Dec 30, 2017 10:00 pm

Ogre 1.10.11 compile for IOS devices (MacOS 10.13.2 / XCode 9.2)

Post by aphcoder »

Hi Guys,

Last time I used Ogre3D was 1.7.x with arm7.

I tried to find an up to date blog for compiling from source to embedding to iDevices but failed to find one.

By following https://github.com/OGRECave/ogre/blob/m ... ingOgre.md
For me, the command for MacOS/Iphone is not enough:
cmake -DCMAKE_TOOLCHAIN_FILE=CMake/toolchain/ios.toolchain.xcode.cmake -G Xcode .
(due to the dependencies to be prerequsite installs)


I am interested if other people are experiencing for same config/targets:
Ogre source zip 1.10.11
MacOS 10.13.2
XCode 9.2
target: arm9 for idevices / x86_64 simulator


I have push a xcode project where I explained how I compiled the static libs and I am trying
to write a simple sample to test the libraries linking/ ogremesh displaying.


https://github.com/aphcoder/ogre-ios-helloworld
********************************************************************

Appreciate if someone can explain how to theses:

1) What is the proper procedure/cmake command to compile Ogre IOS SDK libs and header files packages ?
(moreover the SDK/iOS/make_ios.sh failed to generate the .dmg package)
2) Where could I find a github with ogremesh for iphone and Ogre 1.10.11 to test the libs linking ?
3) Which Render System is used for iDevices ?
4) zziplib is LGPL but IOS does not allow dynamic linking How do you have .zip resources handled for iDevices ?
5) How to have iDevice samples compiled ? (because there is not dependencies on zzip/zlib)


After compilation I have thoses libs:

find . -name "*.a"
./iOSDependencies/lib/libfreetype.a
libfreetype.a
./libOgreGLSupportStatic.a
./libRenderSystem_GLES2Static.a
./libOgreMainStatic.a

find . -name "*.framework"
./Plugin_BSPSceneManagerStatic.framework
./Plugin_ParticleFXStatic.framework
./OgrePropertyStatic.framework
./Plugin_OctreeZoneStatic.framework
./Plugin_OctreeSceneManagerStatic.framework
./OgreRTShaderSystemStatic.framework
./OgrePagingStatic.framework
./Plugin_PCZSceneManagerStatic.framework
./OgreVolumeStatic.framework
./OgreMeshLodGeneratorStatic.framework
./OgreHLMSStatic.framework
./OgreTerrainStatic.framework


Regards,
paroj
OGRE Team Member
OGRE Team Member
Posts: 2106
Joined: Sun Mar 30, 2014 2:51 pm
x 1132

Re: Ogre 1.10.11 compile for IOS devices (MacOS 10.13.2 / XCode 9.2)

Post by paroj »

the dependencies should be compiled automatically when you run cmake.

take a look on the process used by our iOS CI:
https://travis-ci.org/OGRECave/ogre/jobs/323626676

zziplib is LGPL/ MPL dual licensed.
Icedev
Gnoblar
Posts: 8
Joined: Thu Sep 22, 2011 10:31 am

Re: Ogre 1.10.11 compile for IOS devices (MacOS 10.13.2 / XCode 9.2)

Post by Icedev »

Hi,

I recently compiled Ogre 1.10.10 for Android and IOS, and it was hard!

I can not give you the process as my project is too complex and I do not have time to make a simple version. But I can answer a few questions.
1) What is the proper procedure/cmake command to compile Ogre IOS SDK libs and header files packages ?
To make something working, I added -DIOS_PLATFORM=OS to the cmake command line and specify the IOS toolchain file provided in OgreSDK.
It generate XCode projects that I then modify to correct target platforms.
(moreover the SDK/iOS/make_ios.sh failed to generate the .dmg package)
I did not be able to do it either and link with .a directly
3) Which Render System is used for iDevices ?
Both use GLES2. There are common files, but there are really different implementations files for each platform too. The structure is not easy to understand quickly.
4) zziplib is LGPL but IOS does not allow dynamic linking How do you have .zip resources handled for iDevices ?
Simple: use static libs. My setup is more complicated on that point but I did not remember to have done something particular on that point. Maybe correct some include or link path.
5) How to have iDevice samples compiled ? (because there is not dependencies on zzip/zlib)
If you correct the previous point you should have something working. It works for me with Ogre 1.10.10 but as I do not use SDL I can't go further than the menu.

Regards.
aphcoder
Gnoblar
Posts: 5
Joined: Sat Dec 30, 2017 10:00 pm

Re: Ogre 1.10.11 compile for IOS devices (MacOS 10.13.2 / XCode 9.2)

Post by aphcoder »

Hi Guys,

Thanks all for you quick replies that helped me.


I have progressed by effectively processing like the CI build for the moment (as it always guarantees the compilation/linking)
I have managed to have the renderer and viewport set to expected fushia color on IOS SIMU.
I have updated and pushed the sample / README.md

https://github.com/aphcoder/ogre-ios-helloworld

Next integratio step is to initialize properly the RTShaderSystem as the sample crashes when it has to set the OgreMesh material.

Regards,
paroj
OGRE Team Member
OGRE Team Member
Posts: 2106
Joined: Sun Mar 30, 2014 2:51 pm
x 1132

Re: Ogre 1.10.11 compile for IOS devices (MacOS 10.13.2 / XCode 9.2)

Post by paroj »

the log says that you did not add any location including ogrehead.mesh.

Also you should use the ApplicationContext, which will take care of the RTSS and resource locations automatically:
https://ogrecave.github.io/ogre/api/1.10/setup.html
aphcoder
Gnoblar
Posts: 5
Joined: Sat Dec 30, 2017 10:00 pm

Re: Ogre 1.10.11 compile for IOS devices (MacOS 10.13.2 / XCode 9.2)

Post by aphcoder »

Hi Pavel,

I have finally managed to have Sinbad rendered properly on IOS SIMU. (github updated)

I followed your OgreBites::ApplicationContext which really eases a great part of the initialization (compared to
former versions of ogre I was accustomed to)

But during my initialization phase, I had had to slightly modify my setup() function to pass the pointers
to my native windows when initializing from a ViewController.mm


How do you manage to initialize properly without passing thoses windows pointers ?
(you have a initAppForAndroid() interface, why isn't there an initAppForIOS() ?


My last integration step is to have the sample work also on IPhone device and the xcodeproj properly
set for both simu and device.


Thanks for all forum members' and your support.


Regards
aphcoder
Gnoblar
Posts: 5
Joined: Sat Dec 30, 2017 10:00 pm

Re: Ogre 1.10.11 compile for IOS devices (MacOS 10.13.2 / XCode 9.2)

Post by aphcoder »

Hi All,

I have finally managed to have a xcodeproj working for SIMU and DEVICE.

https://github.com/aphcoder/ogre-ios-helloworld

The very tricky part was really the build of ZZIPlib for arm64, OgreMain lib with ZIP support because depending
of the passed commands, some xcodeproj are not generated or failed during compilation.

Hope this could help other people in the same case.

Regards,
aphcoder
Gnoblar
Posts: 5
Joined: Sat Dec 30, 2017 10:00 pm

Re: Ogre 1.10.11 compile for IOS devices (MacOS 10.13.2 / XCode 9.2)

Post by aphcoder »

[SOLVED]

https://github.com/aphcoder/ogre-ios-helloworld


For IOS SIMU, viewport and Sinbad are rendered properly
For IOS Device, viewport and Sinbad are rendered properly
For Win10 VS Community 2017 (Debug x64) viewport and Sinbad are rendered properly


(I am more accustomed to develop/debug faster with VS and render assets with Blender 3D under win10 with more CPU/GPU power)