WinRTBuild

From Qt Wiki
Jump to: navigation, search


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

  • Windows 8.1 64-bit
  • Perl (for example, Strawberry ) is required to be in your PATH.
  • GnuWin32 bison in your PATH - this is included as part of the qt5.git repository. It can be obtained separately from http://gnuwin32.sourceforge.net/packages/bison.htm
  • Gnu flex for Windows in your PATH - this is also included as part of the qt5.git repository. It can be obtained separately from http://sourceforge.net/projects/winflexbison/
  • Visual Studio 2013
    • If using Express, install both VS2013 Express for Desktop Windows and VS2013 Express for Windows. For Windows Phone support, also install the Windows Phone 8 SDK.
    • If using VS2013 Professional or Ultimate, you have all you need. For Windows Phone support, make sure to enable Windows Phone App support in the installation options.

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:

.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: