Anonymous View
Jump to content

WinRTBuild

From Qt Wiki


Building Qt 5 for Windows 8 Modern UI (Windows Store Apps & Windows Phone 8)
This page provides tips on building Qt for Windows Runtime, available in Qt 5.3.

Halt! Before you continue reading:

Prerequisites

Getting a command line environment

No matter what your target (PC, Surface, Phone, etc.), ALWAYS USE the "x86 Native tools command prompt". This is because the command prompt will first build host tools (qmake, moc, rcc, etc.) and then cross-compile the Qt libraries. Do not open the Windows Phone command prompt, for instance, as it will not be able to build the host tools.

The MSVC 2013 command prompts can be a bit difficult to find. They are in a folder in the lower page of the Start menu - pin one to the task bar for easy access.

Configure & Make

From the MSVC 2013 x86 Native Tools command line, configure Qt. The mkspec you choose depends on your target platform, but it is always cross-compiled: that is, it uses the -xplatform argument. If you are doing a shadow build (building outside of the source directory) you may prefer to use -developer-build to make modifying Qt easier. Otherwise, you should set the -prefix to the location you want Qt installed. For example:

configure.bat -xplatform winrt-x64-msvc2013 -developer-build -opensource -confirm-license -nomake tests -nomake examples

If all goes well in the configure, build away:

nmake

or:

jom

jom will almost certainly build Qt faster than nmake, so its use is recommended.

If you did not use -developer-build, remember to run nmake install after the build is done.

Congratulations, you should now have a built copy of Qt 5 for WinRT to play with.

Building and running your first example

You may want to try out Qt Creator 3.1, which has support for launching WinRT apps. The WinRT plugin is currently in the experimental state. That means it is disabled by default and you have to enable it by yourself under Help-> About Plugins.

Until the Qt Creator support is in a more mature state, you will probably want to use Visual Studio for debugging. The command below will generate a vcxproject file which you can open in VS. You may then regenerate it each time you make changes to your qmake .pro file: