Last Updated: February 25, 2016
·
2.52K
· infiniteloop5

Compile qt 5 for iOS

This shows how to compile qt5 for the iOS simulator.

If you want to build for an iOS device, you have to check out the qt5 sources to a second directory and use the alternate configure command, also shown below.

Check out qt 5.2 beta 1. Check for newer versions with git tag.

git clone git://gitorious.org/qt/qt5.git qt5-ios-simulator.git
cd qt5-ios-simulator.git
git tag
git reset --hard v5.2.0-beta1

Initialize qt but do not use webkit because it takes too long to compile

perl init-repository --no-webkit

Configure qt to use open source version with simulator, skipping examples and test

./configure -xplatform macx-ios-clang -developer-build -opensource -release -nomake examples -nomake tests -sdk iphonesimulator

Alternatively, use this configure command in a separate git checkout to build for iOS devices

./configure -xplatform macx-ios-clang -developer-build -opensource -release -nomake examples -nomake tests

Run make. Uses 4 jobs in parallel for faster compilation.

make -j 4
cd ..

Done.

You may test if everything works ok by building an example project

git clone https://github.com/msorvig/qt-ios-demo.git
cd qt-ios-demo
../qt5-ios-simulator.git/qtbase/bin/qmake 
open qt-ios-demo.xcodeproj