BuildingForIos.wiki
author richarddeurtje@gmail.com
Wed, 16 Nov 2011 16:39:37 +0000
changeset 160 8196e13b5b61
parent 118 a854206ba50c
child 206 125a79c342d8
permissions -rw-r--r--
last one i promise, forgot <br>
Ignore whitespace changes - Everywhere: Within whitespace: At end of lines:
115
3278ecf295a3 First release of the iOS guide
vittorio.giovara@gmail.com
parents:
diff changeset
     1
#summary Instructions for building Hedgewars for iOS on Mac OS X
3278ecf295a3 First release of the iOS guide
vittorio.giovara@gmail.com
parents:
diff changeset
     2
#labels Phase-Implementation,Phase-Deploy,Phase-Support
3278ecf295a3 First release of the iOS guide
vittorio.giovara@gmail.com
parents:
diff changeset
     3
3278ecf295a3 First release of the iOS guide
vittorio.giovara@gmail.com
parents:
diff changeset
     4
= Prerequisites =
3278ecf295a3 First release of the iOS guide
vittorio.giovara@gmail.com
parents:
diff changeset
     5
3278ecf295a3 First release of the iOS guide
vittorio.giovara@gmail.com
parents:
diff changeset
     6
  * XCode must be installed, and you should have some skills in usig it
3278ecf295a3 First release of the iOS guide
vittorio.giovara@gmail.com
parents:
diff changeset
     7
  * We need Mercurial to grab external dependencies
3278ecf295a3 First release of the iOS guide
vittorio.giovara@gmail.com
parents:
diff changeset
     8
  * You should be familiar with the BuildingOnMac instructions
3278ecf295a3 First release of the iOS guide
vittorio.giovara@gmail.com
parents:
diff changeset
     9
3278ecf295a3 First release of the iOS guide
vittorio.giovara@gmail.com
parents:
diff changeset
    10
== Necessary Libraries ==
3278ecf295a3 First release of the iOS guide
vittorio.giovara@gmail.com
parents:
diff changeset
    11
3278ecf295a3 First release of the iOS guide
vittorio.giovara@gmail.com
parents:
diff changeset
    12
The library are exactly the same as usual, but they don't come in a precompiled version; so we will have to download the latest snapshot and build them on our own.
3278ecf295a3 First release of the iOS guide
vittorio.giovara@gmail.com
parents:
diff changeset
    13
3278ecf295a3 First release of the iOS guide
vittorio.giovara@gmail.com
parents:
diff changeset
    14
All hard-to-find/hard-to-build libraries are bundled in the source, while SDL and SDL satellites are to be downloaded with HG. For easier handling all libraries come with an Xcode project file so that you just can use the graphical interface to build them; remember to build both Release and Debug for all the Architectures available.
3278ecf295a3 First release of the iOS guide
vittorio.giovara@gmail.com
parents:
diff changeset
    15
3278ecf295a3 First release of the iOS guide
vittorio.giovara@gmail.com
parents:
diff changeset
    16
  * Tremor - misc/libtremor/Xcode - is an ogg variant suited for embedded devices
3278ecf295a3 First release of the iOS guide
vittorio.giovara@gmail.com
parents:
diff changeset
    17
  * Freetype - misc/libfreetype/Xcode - is a trimmed down version of the popular font rendering library
3278ecf295a3 First release of the iOS guide
vittorio.giovara@gmail.com
parents:
diff changeset
    18
  * Lua - misc/liblua/Xcode - can also be skipped if you specify LUA_DISABLED in hedgewars config.inc file
3278ecf295a3 First release of the iOS guide
vittorio.giovara@gmail.com
parents:
diff changeset
    19
3278ecf295a3 First release of the iOS guide
vittorio.giovara@gmail.com
parents:
diff changeset
    20
=== Compiling SDL for iOS ===
3278ecf295a3 First release of the iOS guide
vittorio.giovara@gmail.com
parents:
diff changeset
    21
118
a854206ba50c Edited wiki page BuildingForIos through web user interface.
vittorio.giovara@gmail.com
parents: 115
diff changeset
    22
Since Hedgewars uses all four satellites besides the main SDL library things are going to get difficult. In fact most of the SDL_x libs don't come with a project file and/or can't be easily compiled (without a lot of hacking, that is).
115
3278ecf295a3 First release of the iOS guide
vittorio.giovara@gmail.com
parents:
diff changeset
    23
3278ecf295a3 First release of the iOS guide
vittorio.giovara@gmail.com
parents:
diff changeset
    24
I'll try to explain what I did here to get my setup working, but in case of doubts or problems you should definitely drop by our IRC channel where we can give better help. Also unfortunately SDL has a high record of breaking during different commits (understandable since SDL1.3 is in beta) so what is written here might not be valid for older releases.
3278ecf295a3 First release of the iOS guide
vittorio.giovara@gmail.com
parents:
diff changeset
    25
3278ecf295a3 First release of the iOS guide
vittorio.giovara@gmail.com
parents:
diff changeset
    26
Let's download the latest snapshot of the SDL family source code.
3278ecf295a3 First release of the iOS guide
vittorio.giovara@gmail.com
parents:
diff changeset
    27
3278ecf295a3 First release of the iOS guide
vittorio.giovara@gmail.com
parents:
diff changeset
    28
{{{
3278ecf295a3 First release of the iOS guide
vittorio.giovara@gmail.com
parents:
diff changeset
    29
hg clone http://hg.libsdl.org/SDL
3278ecf295a3 First release of the iOS guide
vittorio.giovara@gmail.com
parents:
diff changeset
    30
hg clone http://hg.libsdl.org/SDL_image
3278ecf295a3 First release of the iOS guide
vittorio.giovara@gmail.com
parents:
diff changeset
    31
hg clone http://hg.libsdl.org/SDL_net
3278ecf295a3 First release of the iOS guide
vittorio.giovara@gmail.com
parents:
diff changeset
    32
hg clone http://hg.libsdl.org/SDL_ttf
3278ecf295a3 First release of the iOS guide
vittorio.giovara@gmail.com
parents:
diff changeset
    33
hg clone http://hg.libsdl.org/SDL_mixer
3278ecf295a3 First release of the iOS guide
vittorio.giovara@gmail.com
parents:
diff changeset
    34
}}}
3278ecf295a3 First release of the iOS guide
vittorio.giovara@gmail.com
parents:
diff changeset
    35
3278ecf295a3 First release of the iOS guide
vittorio.giovara@gmail.com
parents:
diff changeset
    36
We will now go into each of them
3278ecf295a3 First release of the iOS guide
vittorio.giovara@gmail.com
parents:
diff changeset
    37
   # SDL - quite easy, comes with a project file in Xcode-iPhoneOS that can be used to generate the library
3278ecf295a3 First release of the iOS guide
vittorio.giovara@gmail.com
parents:
diff changeset
    38
   # SDL_image - easy, you need to uncompress a tar file to get the project file but then you can compile the library
3278ecf295a3 First release of the iOS guide
vittorio.giovara@gmail.com
parents:
diff changeset
    39
   # SDL_net - surprise! No project file for iOS; i had to take the Mac one and change targets 
3278ecf295a3 First release of the iOS guide
vittorio.giovara@gmail.com
parents:
diff changeset
    40
   # SDL_ttf - the above applies here as well
3278ecf295a3 First release of the iOS guide
vittorio.giovara@gmail.com
parents:
diff changeset
    41
   # SDL_mixer - here's where the fun begins! Besides changing targets, you need to remove unnecessary decodes from the preprocessor macros; you'll find more details about this [http://projectsymphony.blogspot.com/2009/12/how-to-compile-sdlmixer-for-iphone.html here]
3278ecf295a3 First release of the iOS guide
vittorio.giovara@gmail.com
parents:
diff changeset
    42
3278ecf295a3 First release of the iOS guide
vittorio.giovara@gmail.com
parents:
diff changeset
    43
== Necessary Tools ==
3278ecf295a3 First release of the iOS guide
vittorio.giovara@gmail.com
parents:
diff changeset
    44
3278ecf295a3 First release of the iOS guide
vittorio.giovara@gmail.com
parents:
diff changeset
    45
Besides the iOS SDK, you need a special variant of Freepascal to build the engine; luckily the whole process of getting it is well documented here: http://wiki.lazarus.freepascal.org/iPhone/iPod_development
3278ecf295a3 First release of the iOS guide
vittorio.giovara@gmail.com
parents:
diff changeset
    46
3278ecf295a3 First release of the iOS guide
vittorio.giovara@gmail.com
parents:
diff changeset
    47
= Building process =
3278ecf295a3 First release of the iOS guide
vittorio.giovara@gmail.com
parents:
diff changeset
    48
3278ecf295a3 First release of the iOS guide
vittorio.giovara@gmail.com
parents:
diff changeset
    49
And now we should be able to finally open the main Hedgewars.xcodeproj file! There are yet two steps before getting a working build. 
3278ecf295a3 First release of the iOS guide
vittorio.giovara@gmail.com
parents:
diff changeset
    50
3278ecf295a3 First release of the iOS guide
vittorio.giovara@gmail.com
parents:
diff changeset
    51
   # select the target UpdateDataFolder and hit 'build' (not 'build and run') so the the resources folder gets filled with data; you should do this periodically or when there is new content in the share/hedgewars/Data folder
3278ecf295a3 First release of the iOS guide
vittorio.giovara@gmail.com
parents:
diff changeset
    52
   # set the proper linking path of all the libries maked in red; the bundled ones should have a correct path, while you need to tell Xcode where are SDL static libraries. In order to do that I suggest that you right click on a red library, press "Get Info", in the "Path" line press 'Choose' and locate the correct xcodeproj file. Luckily this step is done only once.
3278ecf295a3 First release of the iOS guide
vittorio.giovara@gmail.com
parents:
diff changeset
    53
3278ecf295a3 First release of the iOS guide
vittorio.giovara@gmail.com
parents:
diff changeset
    54
You should be done by now! Hit "Build and Run" and the iOS Simulator should run! Note that for a bug in Freepascal Debug works only on the Simulator, while Release only for Device.
3278ecf295a3 First release of the iOS guide
vittorio.giovara@gmail.com
parents:
diff changeset
    55
3278ecf295a3 First release of the iOS guide
vittorio.giovara@gmail.com
parents:
diff changeset
    56
Enjoy!