WinRTBuild: Difference between revisions

From Qt Wiki
Jump to navigation Jump to search
No edit summary
No edit summary
Line 3: Line 3:
This page provides tips on building Qt for Windows Runtime, available in Qt 5.3.
This page provides tips on building Qt for Windows Runtime, available in Qt 5.3.


== Halt! Before you continue reading:<br />* Read the official documentation: http://doc-snapshot.qt.io/qt5-dev/winrt-support.html<br />* Building Qt 5 from Git: http://wiki.qt.io/Building_Qt_5_from_Git ==
== Halt! Before you continue reading:
* Read the official documentation: http://doc-snapshot.qt.io/qt5-dev/winrt-support.html
* Building Qt 5 from Git: http://wiki.qt.io/Building_Qt_5_from_Git ==


== Prerequisites ==
== Prerequisites ==


* Windows 8.1 64-bit
* Windows 8.1 64-bit
* Perl (for example, &quot;Strawberry&amp;quot;:http://strawberryperl.com ) is required to be in your PATH.
* Perl (for example, "Strawberry":http://strawberryperl.com ) 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
* 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/
* 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/
Line 17: Line 19:
== Getting a command line environment ==
== Getting a command line environment ==


No matter what your target (PC, Surface, Phone, etc.), '''ALWAYS USE the &quot;x86 Native tools command prompt&amp;quot;'''. 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.
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.
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.
Line 23: Line 25:
== Configure &amp; Make ==
== Configure &amp; 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:<br /><code><br />.bat -xplatform winrt-x64-msvc2013 -developer-build -opensource -confirm-license -nomake tests -nomake examples<br /></code>
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:
<code>
.bat -xplatform winrt-x64-msvc2013 -developer-build -opensource -confirm-license -nomake tests -nomake examples
</code>


If all goes well in the configure, build away:<br /><code>nmake<code>
If all goes well in the configure, build away:
<code>nmake<code>


or:<br /></code>jom</code>
or:
</code>jom</code>


&quot;jom&amp;quot;:http://wiki.qt.io/jom will almost certainly build Qt faster than nmake, so its use is recommended.
"jom":http://wiki.qt.io/jom will almost certainly build Qt faster than nmake, so its use is recommended.


If you did not use <s>developer-build, remember to run '''nmake install''' after the build is done.
If you did not use -developer-build, remember to run '''nmake install''' after the build is done.
<br />Congratulations, you should now have a built copy of Qt 5 for WinRT to play with.
 
<br />h2. Building and running your first example
Congratulations, you should now have a built copy of Qt 5 for WinRT to play with.
<br />You may want to try out &quot;Qt Creator 3.1&amp;quot;:http://qt.io/download#qt-creator, 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</s>&gt; About Plugins.
 
h2. Building and running your first example
 
You may want to try out "Qt Creator 3.1":http://qt.io/download#qt-creator, 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:
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:

Revision as of 09:01, 25 February 2015

h1. 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":http://strawberryperl.com ) 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<code>

or:

jom

"jom":http://wiki.qt.io/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.

h2. Building and running your first example

You may want to try out "Qt Creator 3.1":http://qt.io/download#qt-creator, 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: