Monday 20 April 2009

the WHOLE SDL libraries availalbe for the iPhone

So i have been toying with this toolchain lately... i must say that i'm constantly surpised by Xcode power! it's something that you have to get used to, but once there it can almost whatever you want!

anyways, i am in the middle of porting a certain game from a normal Mac framework to a iPhone/iPod Touch device! Most of the stuff is already there, like the Pascal compiler, but the main libraries are missing!

I'm talking about SDL, but after some thinkering i got everything done! Here is what i did after checking out every repository

SDL
well this was the easiest, porting this lib started in a past google SoC and they did a pretty good job. To get the lib it's sufficient to unpack the Xcode_iPhone.tar.gz and press "build".

SDL_net
this one wasn't particuarly difficult, as it required just a correct configuration in the Xcode.tar.gz project. In the project settings, set the Base SDK to Device - iPhoneOS (or Simulator according to your needs) and Architectures to Standard.

SDL_ttf
i had to google a little to get this done: ttf is built exactly as SDL_net, but all the applications built with it are hard depending on libfreetype. Of course this library is available for the iphone, but it's difficult to configure it correctly. Luckily i read this site which clearly explained what to do; include that file in your application frameworks and add the -lz flag to the linker options, and you are done!

SDL_image
the hardest of all, just because the svn repository was out of date! In fact there's this guy who did a neat job for introducing a native support for png, jpeg etc instead of third party libraries. His patches were accepted in mainstream, but the iphone project in the repo has not been updated and can't compile!!! I emailed sdl-list but got no reply... for now it's sufficient to download his updated package and compile from it.

SDL_mixer
this was not as easy as net but i guess that porting for this project has yet to start. For the moment i got a working library just by removing all the native_midi_mac stuff, as it's the only part that relies on a framework which is not present in the iPhone. I didn't need any midi support, so i was satisfied with it already.
Beware that while simulation will give no problems, there's an issue for the device! In fact the simluator is likely to load the ogg functions from the shared libs of the system, but since ogg is nowere in the iphone, we have to provide our own!
so let's grab libvorbis and libogg and compile them the same way we compiled libfreetype; i had some problems with the paths when compiling libvorbis, due to the macports installations. I resolved by placing the arm version of libogg.a into the lib directory of macports (/opt/local/lib) and creating a symlink to it named libogg.dylib. Obviously make backups so you can restore your installation!


Now that you know what to do, you can keep updated the freely available versions that i compiled! they are the latest revision... of today! If something doesn't work complain with the SDL guys! I do hope that by the 1.3 release, SDL for iPhone will become officially supported

click here to download all the libraries, both for the simulator and for the device (debug version obv)

if you find them useful, drop a comment here, it'll mean that my work is appreciated :)
Vittorio

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

Monday 13 April 2009

Hedgewars 0.9.10 available

Hey guys, after much work, the new version of Hedgewars is finally available!
It seems i have been added to the developers list and that's really rewarding :)

the changelog is really long but the part that i've contributed most is

  • The game now officially works on windows, linux and mac!


Hedgewars is now a 100% cross platform game! w00t!!!!

Copies have just been uploaded, grab them while they're hot http://www.hedgewars.org/download.html



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