IOS and Allegro 5

From Allegro Wiki

Jump to: navigation, search

See README_iphone.txt for main instructions.

Contents

Compiling Dependencies

FreeType

(adapted from http://librocket.com/wiki/documentation/BuildingFreeTypeForiOS)

iOS 5.1, XCode 4

These instructions assume you want to compile for iOS 5.1 and are using XCode 4. These commands will build two libraries, one for the iOS simulator and one for the actual device, and then pack them into one fat library that you can use for both.

  1. Download and unpack a recent version of FreeType from Sourceforge.
    • Optional: Create a folder where you want to install FreeType. In my experience it's more convenient to install it somewhere in your home folder than the default path (which is /usr/local). Allegro also supports having a folder named 'deps' in it's root directory where you can install such dependencies.
  2. Navigate to the folder and run these commands:
    $ ./configure --host=arm-apple-darwin --enable-static=yes --enable-shared=no \
    CC=/Applications/XCode.app/Contents/Developer/Platforms/iPhoneSimulator.platform/Developer/usr/bin/gcc \
    CFLAGS="-arch i386 -pipe -std=c99 -Wno-trigraphs -fpascal-strings -O2 -Wreturn-type -Wunused-variable -fmessage-length=0 -fvisibility=hidden \
    -I/Applications/XCode.app/Contents/Developer/Platforms/iPhoneSimulator.platform/Developer/SDKs/iPhoneSimulator5.1.sdk/usr/include/libxml2 \
    -isysroot /Applications/XCode.app/Contents/Developer/Platforms/iPhoneSimulator.platform/Developer/SDKs/iPhoneSimulator5.1.sdk" \
    CPP=/Applications/XCode.app/Contents/Developer/Platforms/iPhoneSimulator.platform/Developer/usr/bin/cpp \
    AR=/Applications/XCode.app/Contents/Developer/Platforms/iPhoneSimulator.platform/Developer/usr/bin/ar \
    LDFLAGS="-arch i386 -isysroot /Applications/XCode.app/Contents/Developer/Platforms/iPhoneSimulator.platform/Developer/SDKs/iPhoneSimulator5.1.sdk"
    $ make
    $ make install # May need to run this as root
    $ cp objs/.libs/libfreetype.a libfreetype-i386.a
    $ ./configure --host=arm-apple-darwin --enable-static=yes --enable-shared=no \
    CC=/Applications/XCode.app/Contents/Developer/Platforms/iPhoneOS.platform/Developer/usr/bin/gcc \
    CFLAGS="-arch armv7 -pipe -std=c99 -Wno-trigraphs -fpascal-strings -O2 -Wreturn-type -Wunused-variable -fmessage-length=0 -fvisibility=hidden \
    -I/Applications/XCode.app/Contents/Developer/Platforms/iPhoneOS.platform/Developer/SDKs/iPhoneOS5.1.sdk/usr/include/libxml2 \
    -isysroot /Applications/XCode.app/Contents/Developer/Platforms/iPhoneOS.platform/Developer/SDKs/iPhoneOS5.1.sdk" \
    CPP=/Applications/XCode.app/Contents/Developer/Platforms/iPhoneSimulator.platform/Developer/usr/bin/cpp \
    AR=/Applications/XCode.app/Contents/Developer/Platforms/iPhoneOS.platform/Developer/usr/bin/ar \
    LDFLAGS="-arch armv7 -isysroot /Applications/XCode.app/Contents/Developer/Platforms/iPhoneOS.platform/Developer/SDKs/iPhoneOS5.1.sdk"
    $ make clean
    $ make
    $ cp objs/.libs/libfreetype.a libfreetype-arm7.a
    $ lipo -create -output libfreetype.a libfreetype-i386.a libfreetype-arm7.a
    • Optional: Add a --prefix=destination_directory option to the first configure call if you want to have your headers somewhere else.
  3. After the previous step you have a fat binary libfreetype.a inside the directory where you extracted FreeType. Now you should copy this library where you want it to appear, overwriting the libfreetype.a that was put there by the make install command.

iOS 6.0, XCode 4

Execute the same commands as above, but replace the first configure command with:

./configure --host=arm-apple-darwin --enable-static=yes --enable-shared=no --without-zlib --without-bzip2 \
CC=/Applications/Xcode.app/Contents/Developer/Platforms/iPhoneSimulator.platform/Developer/usr/bin/gcc \
CFLAGS="-arch i386 -pipe -std=c99 -Wno-trigraphs -fpascal-strings -O2 -Wreturn-type -Wunused-variable -fmessage-length=0 -fvisibility=hidden \
-I/Applications/Xcode.app/Contents/Developer/Platforms/iPhoneSimulator.platform/Developer/SDKs/iPhoneSimulator6.0.sdk/usr/include/libxml2 \
-isysroot /Applications/Xcode.app/Contents/Developer/Platforms/iPhoneSimulator.platform/Developer/SDKs/iPhoneSimulator6.0.sdk" \
CPP=/Applications/Xcode.app/Contents/Developer/Platforms/iPhoneSimulator.platform/Developer/usr/bin/cpp \
AR=/Applications/Xcode.app/Contents/Developer/Platforms/iPhoneSimulator.platform/Developer/usr/bin/ar \
LDFLAGS="-arch i386 -isysroot /Applications/Xcode.app/Contents/Developer/Platforms/iPhoneSimulator.platform/Developer/SDKs/iPhoneSimulator6.0.sdk"

And replace the second configure command with:

./configure --host=arm-apple-darwin --enable-static=yes --enable-shared=no  --without-zlib --without-bzip2 \
CC=/Applications/Xcode.app/Contents/Developer/Platforms/iPhoneOS.platform/Developer/usr/bin/gcc \
CFLAGS="-arch armv7 -pipe -std=c99 -Wno-trigraphs -fpascal-strings -O2 -Wreturn-type -Wunused-variable -fmessage-length=0 -fvisibility=hidden \
-I/Applications/Xcode.app/Contents/Developer/Platforms/iPhoneOS.platform/Developer/SDKs/iPhoneOS6.0.sdk/usr/include/libxml2 \
-isysroot /Applications/Xcode.app/Contents/Developer/Platforms/iPhoneOS.platform/Developer/SDKs/iPhoneOS6.0.sdk" \
CPP=/Applications/Xcode.app/Contents/Developer/Platforms/iPhoneSimulator.platform/Developer/usr/bin/cpp \
AR=/Applications/Xcode.app/Contents/Developer/Platforms/iPhoneOS.platform/Developer/usr/bin/ar \
LDFLAGS="-arch armv7 -isysroot /Applications/Xcode.app/Contents/Developer/Platforms/iPhoneOS.platform/Developer/SDKs/iPhoneOS6.0.sdk"
Personal tools
Adsense