Jump to navigation Jump to search

Compiling ScummVM/iPhone

664 bytes added, 17:14, 30 March 2016
→‎Unofficial SDK: Update cross-compilation instructions.
'''TODO:''' Describe how to use XCode and create_project to compile for iOS using the official Apple toolchain.
= Unofficial SDK Cross-Compilation =
Please note binaries generated with these instructions only work with jailbroken devices. == Toolchain Setup ==
=== Toolchain ===
First, you'll need to set up the [ toolchain]. Earlier versions than the one linked will NOT work.
First you need to set up a toolchain for cross-compilation. On our buildbot we use [ this toolchain]. It is based on LLVM/Clang and contains instructions on how to set it up. === Environment variables External libs ===You'll need In the previously linked toolchain a script to set some environment variables for both compile all libraries used by the external libraries, and iOS version of ScummVM itselfis contained. This is so Please refer to the right compiler and libraries will be usedtoolchain's README file on how to build them.
<pre> export SDKROOT=<your toolkit directory> export SYSROOT="$SDKROOT/sys" export BUILDENVBuilding ScummVM ="$SDKROOT/pre" export FDIR="$SYSROOT" export CC="$BUILDENV/bin/arm-apple-darwin9-gcc -v" export CXX="$BUILDENV/bin/arm-apple-darwin9-g++" export LD=$CC export SHAREDOPTS="-isysroot $SYSROOT -fobjc-abi-version=2 -I$SDKROOT/include" export FRAMEWORKS="-F$FDIR/System/Library/PrivateFrameworks/ -F$FDIR/System/Library/Frameworks/" export LDFLAGS="-L$BUILDENV/arm-apple-darwin9/lib/ $FRAMEWORKS $SHAREDOPTS -bind_at_load -lobjc" export CXXFLAGS="-I$SYSROOT/usr/include $SHAREDOPTS" export OBJCFLAGS="-I$SYSROOT/usr/include/ $SHAREDOPTS --std=c99" export CFLAGS="$CXXFLAGS" export AS=$SDKROOT/pre/bin/arm-apple-darwin9-as</pre>
=== Configuration ===
Before we can compile ScummVM we need to configure the source tree for building. This is usually only required once or when you want to alter build options. ====Choosing an iOS target = External libs ===ThenWe feature two different iOS backends:* ''iphone'': Our legacy iOS backend, set up any of the external libs you might wantwhich supports all iOS3+ devices. Meaning libMAD for MP3 playback* ''ios7'': Our modern iOS7+ backend, libFLAC for FLAC support and/or Tremor which only supports iOS7+ devices but features better integration for Ogg supportthese.
Note that Depending on which backend you only use you will need to add these if you need support use a different value for those filetypes. ScummVM itself will run fine without them. You can also download the already compiled libraries from the link in the Official SDK section above''TARGET'' environment variable.
The below should usually do the trick for these* For ''iphone'' use:<presource lang="bash"> ./configure --hostexport TARGET=arm-darwin apple--prefix=$SDKROOT/sys/ make && make installdarwin9</presource>
* For ''ios7'' use:<source lang="bash">export TARGET== ScummVM ===arm-apple-darwin11</source>
Then, we need to configure ScummVM itself.==== Setting up the Environment ====
<presource lang="bash"> .export PATH="$IOS_TOOLCHAIN_BASE/bin:$IOS_TOOLCHAIN_BASE/$TARGET/configure --host=iphone \ --disable-mt32emu --disable-scalers --enable-release \ --with-flac-prefix=bin:$IOS_TOOLCHAIN_BASE/$SYSROOTTARGET/usr/local \bin:$PATH" export CPPFLAGS="--with-mad-prefix=isystem $IOS_TOOLCHAIN_BASE/$SYSROOTTARGET/usr/local \include" export LDFLAGS="--with-tremor-prefix=L$IOS_TOOLCHAIN_BASE/$SYSROOTTARGET/usr/locallib"</presource>Where ''IOS_TOOLCHAIN_BASE'' contains the directory where you installed the toolchain. And ''TRAGET'' has been setup from the previous step.
Note that '''NOTE''': If you quit the --with-flac-prefix (shell you are using when configuring ScummVM and the rest) is only necessary if pick up compilation later, you want will need to include support for that specific libraryre-export only the ''PATH'' variable like described above.
If you've installed ==== Configuring the external libs in any other place than $SYSROOT/usr/local, you need to use that location instead.Build ====
== Compiling ==Then configure ScummVM for the iOS version you want to target.
NowFirst, we navigate to a path where you want your build files to be located (this can start be the compileScummVM root directory but does not have to be).Then run the following:<source lang="bash">./path/to/scummvm/configure --host=ios7 --with-staticlib-prefix=$IOS_TOOLCHAIN_BASE/$TARGET/usr</source>Replace ''ios7'' with ''iphone'' if you want to build the older version of our iOS backend.
<pre> make iphone</pre>=== Compilation ===
Lastly, we You can simple compile ScummVM with running make:<source lang="bash">make iphone</source>If you simply want to test whether changes you made compile but do not plan to use the binary for deployment you can also simply run ''make a ScummVM''.app bundle:
Please note that if you want to deploy ScummVM on your iOS device you will need to generate a bundle file. For this run either:<source lang="bash">make ios7bundle</source>for the ''ios7'' backend. Or<presource lang="bash"> make iphonebundle</presource>for the ''iphone'' backend.
Then simply upload the whole directory to your device under the /Applications folder, and you're done!


Navigation menu