Saturday, 18 April 2009

CMake configuration for Universal Binaries

So since i committed my partecipation in Hedgewars development, i wanted to support as many platform as i could

... and i ended up deploying only for Intel Leopards

why? well not that hedgewars can't compile on tiger (at least after a patch from mischi) or in powerpc environment is just that i couldn't set a working configuration for it! For quite a long time Qt was compiled statically which helped in reducing the number of relocated libraries, but forbidding any universal build
moreover the "Build once, Deploy everywhere" from Qt was not working even when i switched to the standard sdk!

At last, today I have found where was the problem! CMAKE
it appears that setting -arch ppc -arch i386 in the CMAKE_CXX_FLAGS flag has no effect! you have to specifically set the following two

-DCMAKE_OSX_SYSROOT="/Developer/SDKs/MacOSX10.4u.sdk/"
-DCMAKE_OSX_ARCHITECTURES="ppc;i386"
and before issuing make
export MACOSX_DEPLOYMENT_TARGET=10.4
Beware that using Carbon API from Tiger will slow down a bit execution on Leopard! for this reason i think it might be better to add an Intel-only Leopard optimized release of the software, since the new version of QT (4.5) supports Cocoa natively (which actually speeded up loading times.

I hope this helps desperate developers trying to support as many architecture as possible!
if you want to know more, follow this link, where it's explained how to include even additional configurations.


Vittorio

No comments:

Post a Comment



All the projects here are under a Creative Commons 3.0 licence! You can use and distribute them as you like (just quote the author so he knows his work is not useless)!

If you wish to get in touch with me write at projectsymphony@gmail.com