BuildingForIos.wiki
author Wuzzy
Thu, 14 Nov 2019 16:02:49 +0000
changeset 2103 612f6f103787
parent 2001 06b6991194d1
permissions -rw-r--r--
LuaLibraryAnimate: add newline
Ignore whitespace changes - Everywhere: Within whitespace: At end of lines:
1963
1175d2f6f198 Rename “Mac OS” to “macOS”
Wuzzy <almikes@aol.com>
parents: 753
diff changeset
     1
#summary Instructions for building Hedgewars for iOS on macOS
115
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
753
e59a33069c54 BuildingForIos: Title consistency
Wuzzy
parents: 752
diff changeset
     4
= Building on iOS =
752
ab1e891cdf63 BuildingForIos: Add title, fix header levels
Wuzzy
parents: 206
diff changeset
     5
== Prerequisites ==
115
3278ecf295a3 First release of the iOS guide
vittorio.giovara@gmail.com
parents:
diff changeset
     6
2001
06b6991194d1 BuildingForIos: Fix formatting
Wuzzy
parents: 1963
diff changeset
     7
 * XCode must be installed, and you should have some skills in using it
06b6991194d1 BuildingForIos: Fix formatting
Wuzzy
parents: 1963
diff changeset
     8
 * We need Mercurial to grab external dependencies
06b6991194d1 BuildingForIos: Fix formatting
Wuzzy
parents: 1963
diff changeset
     9
 * You should be familiar with the BuildingOnMac instructions
115
3278ecf295a3 First release of the iOS guide
vittorio.giovara@gmail.com
parents:
diff changeset
    10
752
ab1e891cdf63 BuildingForIos: Add title, fix header levels
Wuzzy
parents: 206
diff changeset
    11
=== Necessary libraries ===
115
3278ecf295a3 First release of the iOS guide
vittorio.giovara@gmail.com
parents:
diff changeset
    12
3278ecf295a3 First release of the iOS guide
vittorio.giovara@gmail.com
parents:
diff changeset
    13
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
    14
3278ecf295a3 First release of the iOS guide
vittorio.giovara@gmail.com
parents:
diff changeset
    15
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
    16
2001
06b6991194d1 BuildingForIos: Fix formatting
Wuzzy
parents: 1963
diff changeset
    17
 * Tremor - `misc/libtremor/Xcode` - is an ogg variant suited for embedded devices
06b6991194d1 BuildingForIos: Fix formatting
Wuzzy
parents: 1963
diff changeset
    18
 * Freetype - `misc/libfreetype/Xcode` - is a trimmed down version of the popular font rendering library
06b6991194d1 BuildingForIos: Fix formatting
Wuzzy
parents: 1963
diff changeset
    19
 * Lua - `misc/liblua/Xcode` - can also be skipped if you specify `LUA_DISABLED` in Hedgewars' `config.inc` file
115
3278ecf295a3 First release of the iOS guide
vittorio.giovara@gmail.com
parents:
diff changeset
    20
752
ab1e891cdf63 BuildingForIos: Add title, fix header levels
Wuzzy
parents: 206
diff changeset
    21
==== Compiling SDL for iOS ====
115
3278ecf295a3 First release of the iOS guide
vittorio.giovara@gmail.com
parents:
diff changeset
    22
118
a854206ba50c Edited wiki page BuildingForIos through web user interface.
vittorio.giovara@gmail.com
parents: 115
diff changeset
    23
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
    24
3278ecf295a3 First release of the iOS guide
vittorio.giovara@gmail.com
parents:
diff changeset
    25
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
    26
3278ecf295a3 First release of the iOS guide
vittorio.giovara@gmail.com
parents:
diff changeset
    27
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
    28
3278ecf295a3 First release of the iOS guide
vittorio.giovara@gmail.com
parents:
diff changeset
    29
{{{
3278ecf295a3 First release of the iOS guide
vittorio.giovara@gmail.com
parents:
diff changeset
    30
hg clone http://hg.libsdl.org/SDL
3278ecf295a3 First release of the iOS guide
vittorio.giovara@gmail.com
parents:
diff changeset
    31
hg clone http://hg.libsdl.org/SDL_image
3278ecf295a3 First release of the iOS guide
vittorio.giovara@gmail.com
parents:
diff changeset
    32
hg clone http://hg.libsdl.org/SDL_net
3278ecf295a3 First release of the iOS guide
vittorio.giovara@gmail.com
parents:
diff changeset
    33
hg clone http://hg.libsdl.org/SDL_ttf
3278ecf295a3 First release of the iOS guide
vittorio.giovara@gmail.com
parents:
diff changeset
    34
hg clone http://hg.libsdl.org/SDL_mixer
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
2001
06b6991194d1 BuildingForIos: Fix formatting
Wuzzy
parents: 1963
diff changeset
    37
Each library has its own iOS project file under the folder Xcode-iOS/; also here you need to build both Release and Debug for all the architectures available. After this step remeber to update the include paths and linker information in the main Xcode project file.
115
3278ecf295a3 First release of the iOS guide
vittorio.giovara@gmail.com
parents:
diff changeset
    38
752
ab1e891cdf63 BuildingForIos: Add title, fix header levels
Wuzzy
parents: 206
diff changeset
    39
=== Necessary tools ===
115
3278ecf295a3 First release of the iOS guide
vittorio.giovara@gmail.com
parents:
diff changeset
    40
206
125a79c342d8 Updated guide for fpc2.6
vittorio.giovara@gmail.com
parents: 118
diff changeset
    41
Besides the iOS SDK, you need a special variant of Freepascal to build the engine as well as the standard Freepascal compiler. So let's download and install (in order):
125a79c342d8 Updated guide for fpc2.6
vittorio.giovara@gmail.com
parents: 118
diff changeset
    42
2001
06b6991194d1 BuildingForIos: Fix formatting
Wuzzy
parents: 1963
diff changeset
    43
 * [http://sourceforge.net/projects/freepascal/files/Mac%20OS%20X/2.6.0/fpc-2.6.0.intel-macosx.dmg/download fpc-intel-macosx]
06b6991194d1 BuildingForIos: Fix formatting
Wuzzy
parents: 1963
diff changeset
    44
 * [http://sourceforge.net/projects/freepascal/files/Mac%20OS%20X/2.6.0/fpc-2.6.0.arm-ios.dmg/download fpc-arm-ios]
206
125a79c342d8 Updated guide for fpc2.6
vittorio.giovara@gmail.com
parents: 118
diff changeset
    45
2001
06b6991194d1 BuildingForIos: Fix formatting
Wuzzy
parents: 1963
diff changeset
    46
The latter one will run a script on its own, let it finish and if no errors are reported, your system is ready! If you get stuck anywhere, luckily there is a full documentation about this process on the [http://wiki.lazarus.freepascal.org/iPhone/iPod_development FreePascal Wiki].
115
3278ecf295a3 First release of the iOS guide
vittorio.giovara@gmail.com
parents:
diff changeset
    47
752
ab1e891cdf63 BuildingForIos: Add title, fix header levels
Wuzzy
parents: 206
diff changeset
    48
== Building process ==
115
3278ecf295a3 First release of the iOS guide
vittorio.giovara@gmail.com
parents:
diff changeset
    49
3278ecf295a3 First release of the iOS guide
vittorio.giovara@gmail.com
parents:
diff changeset
    50
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
    51
2001
06b6991194d1 BuildingForIos: Fix formatting
Wuzzy
parents: 1963
diff changeset
    52
 # 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
06b6991194d1 BuildingForIos: Fix formatting
Wuzzy
parents: 1963
diff changeset
    53
 # 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.
115
3278ecf295a3 First release of the iOS guide
vittorio.giovara@gmail.com
parents:
diff changeset
    54
2001
06b6991194d1 BuildingForIos: Fix formatting
Wuzzy
parents: 1963
diff changeset
    55
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.
115
3278ecf295a3 First release of the iOS guide
vittorio.giovara@gmail.com
parents:
diff changeset
    56
1963
1175d2f6f198 Rename “Mac OS” to “macOS”
Wuzzy <almikes@aol.com>
parents: 753
diff changeset
    57
Enjoy!