I've noticed that the resulting executable of the demo application is 23 MB in size when compiled with Ogre 1.8. That's pretty huge compared to the 9MB you get with Ogre 1.7.4.
Is Ogre 1.8 so much bigger than 1.7?
I thought it may be caused by the new OpenGLES 2 rendersystem (which I don't need at the moment), so I tried not to compile it with -D OGRE_BUILD_RENDERSYSTEM_GLES2=0 but cmake is ignoring this directive and building it anyway
An executable size of 22MB woulnd't be a big problem on a PC, but on iOS is quite important to try keeping your app under 20MB as 3G users cannot download files over that limit.
Last edited by Ologon on Wed Apr 18, 2012 5:22 pm, edited 1 time in total.
Hmm I see.. that means that when I set "iOS Device" as target in Xcode i should get a smaller executable? I cannot do that right now because I'm not a paid developer yet..
I also just tried to build ogre manually in Xcode without relying on the script and I get a libOgre which is half in size
But i'm pretty sure xcode will complain if i try to test the app in the simulator
Nope, that should be fine. If you build for the simulator then it will be half the size and should be ok in the simulator. Just make sure to do a clean build in between switching architectures.
Okay, this is driving me crazy
The libOgre is now 40MB but my app is still 25MB when it should be half the size probably.. and it is 11MB when linking to the prebuilt SDK (1.7.4)
The app is the unmodified ogre xcode template. the libOgre in the prebuilt sdk is still smaller than what i've got (24mb). Really don't know what I'm doing wrong at this point :/
EDIT: Oddly enough, the app debug size is the same as the release one
Last edited by Ologon on Mon Apr 16, 2012 9:36 pm, edited 1 time in total.
then open up the generated xcode project, select "ALL_BUILD" and "IPhone 5.1 Simulator" as target and finally Build. The generated libOgre (40mb) and all the others .a files are double in size compared to the prebuilt SDK 1.7.4, but I think it shouldn't be compiling for architectures other than armv7 :/
Ahh, the ALL_BUILD target may not work correctly(I haven't tried in a while, I just know that it was broken because of CMake for a while). So I usually either build the libraries I want or just the SampleBrowser to get everything.
The build flags are radically different for 1.8 vs 1.7 but remember, symbols not used can be stripped out for your own project. Then again, my libOgreMainStatic.a is 13.3 MB.
Try doing this(these are also the directions on the wiki page)
Mac-mini-di-Alfredo:build yoshi$ cmake -DOGRE_BUILD_PLATFORM_APPLE_IOS=1 -G Xcode ..
-- Configuring OGRE 1.8.0unstable
-- Detected g++
-- Enabling GCC visibility flags
-- Search path: /Users/yoshi/Documents/Development/ogreBuild/build/iOSDependencies;/Users/yoshi/Documents/Development/ogreBuild/iOSDependencies;/Users/yoshi/Documents/Development/ogreBuild/build/../iOSDependencies;/Users/yoshi/Documents/Development/ogreBuild/../iOSDependencies
-- Looking for ZLIB...
-- Could NOT find PkgConfig (missing: PKG_CONFIG_EXECUTABLE)
-- Could not locate ZLIB
-- Looking for FreeImage...
-- Could NOT find PkgConfig (missing: PKG_CONFIG_EXECUTABLE)
-- Found FreeImage: optimized;/Users/yoshi/Documents/Development/ogreBuild/iOSDependencies/lib/release/libFreeImage.a;debug;/Users/yoshi/Documents/Development/ogreBuild/iOSDependencies/lib/debug/libFreeImage.a
-- Looking for FREETYPE...
-- Could NOT find PkgConfig (missing: PKG_CONFIG_EXECUTABLE)
-- CMAKE_PREFIX_PATH: /Users/yoshi/Documents/Development/ogreBuild/build/iOSDependencies;/Users/yoshi/Documents/Development/ogreBuild/iOSDependencies;/Users/yoshi/Documents/Development/ogreBuild/build/../iOSDependencies;/Users/yoshi/Documents/Development/ogreBuild/../iOSDependencies;/usr/local;/usr/lib/i386-linux-gnu
-- CMAKE_PREFIX_PATH: /Users/yoshi/Documents/Development/ogreBuild/build/iOSDependencies;/Users/yoshi/Documents/Development/ogreBuild/iOSDependencies;/Users/yoshi/Documents/Development/ogreBuild/build/../iOSDependencies;/Users/yoshi/Documents/Development/ogreBuild/../iOSDependencies;/usr/local;/usr/lib/i386-linux-gnu
-- Found FREETYPE: optimized;/usr/X11R6/lib/libfreetype.dylib;debug;/usr/X11R6/lib/libfreetype.dylib
-- Looking for POCO...
-- Could NOT find PkgConfig (missing: PKG_CONFIG_EXECUTABLE)
-- Could not locate POCO
-- Looking for TBB...
-- Could not locate TBB
-- Looking for GLSL_Optimizer...
-- Could NOT find PkgConfig (missing: PKG_CONFIG_EXECUTABLE)
-- Found GLSL_Optimizer: optimized;/Users/yoshi/Documents/Development/ogreBuild/iOSDependencies/lib/release/libmesaglsl2.a;debug;/Users/yoshi/Documents/Development/ogreBuild/iOSDependencies/lib/debug/libmesaglsl2.a
-- Looking for HLSL2GLSL...
-- Could NOT find PkgConfig (missing: PKG_CONFIG_EXECUTABLE)
-- Found HLSL2GLSL: optimized;/Users/yoshi/Documents/Development/ogreBuild/iOSDependencies/lib/release/libhlsl2glsl.a;debug;/Users/yoshi/Documents/Development/ogreBuild/iOSDependencies/lib/debug/libhlsl2glsl.a
-- Looking for OIS...
-- Could NOT find PkgConfig (missing: PKG_CONFIG_EXECUTABLE)
-- Found OIS: optimized;/Users/yoshi/Documents/Development/ogreBuild/iOSDependencies/lib/release/libOIS.a;debug;/Users/yoshi/Documents/Development/ogreBuild/iOSDependencies/lib/debug/libOIS.a
-- Could NOT find Doxygen (missing: DOXYGEN_EXECUTABLE)
-- Looking for Softimage...
-- Could not locate Softimage
-- Looking for CppUnit...
-- Could NOT find PkgConfig (missing: PKG_CONFIG_EXECUTABLE)
-- Could not locate CppUnit
-- Looking for iOS SDK...
-- Found iOS SDK
--
-----------------------------------------------------------------------------
-- The following external packages were located on your system.
-- This installation will have the extra features provided by these packages.
+ freeimage
+ freetype
+ OpenGL
+ OpenGL ES 1.x
+ OpenGL ES 2.x
+ boost
+ boost-thread
+ boost-date_time
+ GLSL Optimizer
+ HLSL2GLSL
+ OIS
+ iOS SDK
-----------------------------------------------------------------------------
-- The following OPTIONAL packages could NOT be located on your system.
-- Consider installing them to enable more features from this software.
+ zlib: Simple data compression library <http://www.zlib.net>
+ POCO: POCO framework <http://pocoproject.org/>
+ tbb: Threading Building Blocks <http://www.threadingbuildingblocks.org/>
+ Doxygen: Tool for building API documentation <http://doxygen.org>
+ Softimage: Softimage SDK needed for building XSIExporter <FALSE>
+ CppUnit: Library for performing unit tests <http://cppunit.sourceforge.net>
-----------------------------------------------------------------------------
send_error/Users/yoshi/Documents/Development/ogreBuild/iOSDependencies/bin/debug/libOIS.a did not exist, can't install!
send_error/Users/yoshi/Documents/Development/ogreBuild/iOSDependencies/bin/release/libOIS.a did not exist, can't install!
--
----------------------------------------------------------------------------
FEATURE SUMMARY
----------------------------------------------------------------------------
Building components:
+ Paging
+ Property
+ Terrain
+ RTShader System
+ RTShader System Core Shaders
+ RTShader System Extensions Shaders
Building plugins:
+ BSP scene manager
+ Octree scene manager
+ Portal connected zone scene manager
+ Particle FX
Building rendersystems:
+ OpenGL ES 1.x
+ OpenGL ES 2.x
Building executables:
+ Samples
Building core features:
+ DDS image codec
+ PVRTC image codec
+ FreeImage codec
Build type: static
Threading support: background (boost)
Use double precision: disabled
Allocator type: nedmalloc (pooling)
STL containers use allocator: enabled
Strings use allocator: disabled
Memory tracker (debug): disabled
Memory tracker (release): disabled
Use new script compilers: enabled
Use Boost: enabled
----------------------------------------------------------------------------
-- Configuring done
-- Generating done
-- Build files have been written to: /Users/yoshi/Documents/Development/ogreBuild/build
Building in Release the sample browser for the iPhone simulator still results in a libOgreMainStatic.a of 40mb
Did you compile ogre in this exact way with the iOS dependences from sourceforge.net? Unless there's something wrong with my Xcode or Mac I should also get 13mb..
It's very peculiar that it doesn't find zlib, make me wonder what all is going on there. Possibly a stale CMakeCache.txt from your previous configuration.
The dependencies shouldn't make a difference in this case. Mine are compiled with the iOS 5.1 SDK, but will still work fine. I will release a precompiled SDK once 1.8 has been finalized.
Okay, I guess I will use my sdk until Ogre 1.8 is out then
Linking to your precompiled sdk will definitely solve this issue. Thanks a lot for your help and patience!
Okay I finally solved this problem. New demo app size: 9mb Probably if I disable freeimage I could get an even smaller executable.
Looks like the issue was caused by a broken cmake since the OGRE project it generated was totally unoptimized and many settings were wrong.
I solved by doing a clean osx lion reinstall, then I reinstalled Cmake for darwin64 + Xcode 4.3.2. When I ran cmake in the ogre build it correctly detected zlib this time and generated the correct project file. Also the ALL_BUILD target worked fine (I just had to set the optimization level from -O3 to "fastest, smallest -Os" on all targets).