WinRTBuild: Difference between revisions

From Qt Wiki
Jump to navigation Jump to search
No edit summary
 
No edit summary
Line 1: Line 1:
=Building Qt 5 for Windows 8 Modern UI (Windows Store Apps & Windows Phone 8)=
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.
This page provides tips on building Qt for Windows Runtime, available in Qt 5.3.


==Halt! Before you continue reading:==
== 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 ==


* Read the official documentation: http://doc-snapshot.qt.io/qt5-dev/winrt-support.html
== Prerequisites ==
* Building Qt 5 from Git: [[Building Qt 5 from Git|http://wiki.qt.io/Building_Qt_5_from_Git]]
 
==Prerequisites==


* Windows 8.1 64-bit
* Windows 8.1 64-bit
* Perl (for example, [http://strawberryperl.com Strawberry] ''[strawberryperl.com]'' ) is required to be in your <span class="caps">PATH</span>.
* Perl (for example, &quot;Strawberry&amp;quot;:http://strawberryperl.com ) is required to be in your PATH.
* GnuWin32 bison in your <span class="caps">PATH</span> – 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 <span class="caps">PATH</span> – 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/
* Visual Studio 2013
* 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 <span class="caps">SDK</span>.
** 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.
** 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==
== Getting a command line environment ==
 
No matter what your target (PC, Surface, Phone, etc.), '''<span class="caps">ALWAYS</span> <span class="caps">USE</span> 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 <span class="caps">MSVC</span> 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 &amp; Make==


From the <span class="caps">MSVC</span> 2013 ×86 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 />
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.


If all goes well in the configure, build away:<br />
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.


or:<br />
== Configure &amp; Make ==


[[jom]] ''[qt.io]'' will almost certainly build Qt faster than nmake, so its use is recommended.
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>


If you did not use -developer-build, remember to run '''nmake install''' after the build is done.
If all goes well in the configure, build away:<br /><code>nmake<code>


Congratulations, you should now have a built copy of Qt 5 for WinRT to play with.
or:<br /></code>jom</code>


==Building and running your first example==
&quot;jom&amp;quot;:http://wiki.qt.io/jom will almost certainly build Qt faster than nmake, so its use is recommended.


You may want to try out [http://qt.io/download#qt-creator Qt Creator 3.1] ''[qt.io]'', 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 -&gt; About Plugins.
If you did not use <s>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
<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.


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 14:38, 23 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:
* 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

  • Windows 8.1 64-bit
  • Perl (for example, "Strawberry&quot;: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&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.

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:

<br />.bat -xplatform winrt-x64-msvc2013 -developer-build -opensource -confirm-license -nomake tests -nomake examples<br />

If all goes well in the configure, build away:

nmake<code>

or:<br />

jom

"jom&quot;: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&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
> 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: