Qt5 on Windows Phone 8

Today, I'm going to blog something about Qt5 on Windows Phone 8.
Last week, Digia released a Technology Preview for the WinRT libraries [1].
The WinRT (= Windows Runtime) is the base library for developing Windows 8 (also including WindowsRT on ARM) and Windows Phone 8 apps. So, I wanted to try it out for my Nokia Lumia 820.

BUILD
Before you can compile the sources, you have to install the Windows Phone SDK!!!

First, you're starting with downloading the sources and extract them [2]. Then start configuring the build with:
> configure -xplatform winphone-arm-msvc2012 -debug
After this process, you cann run
> nmake
> nmake install
Congratulation! You've compiled Qt5 Technology Preview for Windows Phone 8.
You see how easy it is to build it. But you have to be aware, that not every part of the qtbase module is implemented. E.g. the Qt5Network module.

But now, the hard part is starting: you want to compile a Qt application.
I've started with compiling some offical qt examples. These are the examples that I managed to compile and test successfully.

examples/widgets/animation/easing
examples/widgets/widgets/wiggly
examples/touch/fingerpaint

  1. Navigate on the command line to the project directory. Run "<path to Qt5 build>\bin\qmake.exe -tp vc"
  2. Open the *.vcxproj file with a text editor, an delete the "<CharacterSet>"-line.
  3. Open the *.vcxproj with Visual Studio. Right-click on the project, click on Properties 
  4. Go to Configuration Properties --> General --> set Platform Toolset to "v110_wp80". Confirm with Apply.
  5. Go to Configuration Properties --> C/C++ --> Precompiled Headers --> set Precompiled Header to "Not Using Precompiled Headers". Confirm with Apply and OK.
  6. Copy the needed Qt libraries to the project folder. For the examples above, you need Qt5Cored.dll, Qt5Guid.dll, Qt5Widgets.dll, d3dcompiler_qtd.dll from <Path to Qt5 Folder>\bin\ to the <Path to Project>\.
  7. Copy <Path to Qt5 Folder>\plugins\platforms\winrtd.dll to <Path to Project>\platforms\winrtd.dll
  8. Copy <Path to Qt5 Folder>\lib\fonts folder to <Path to Project>\.
  9. In Visual Studio, right-click on the project --> Add --> Existing Item and add the files from 6-8. Then mark the added files, right-click on it --> Properties --> set Content to "Yes".
Now you're ready to build and deploy the application to your Windows Phone device.

CONCLUSION
Qt5 on Windows Phone is very promising. The deployment to the device is fast. Even some details like the input system works. But it's a Technology Preview, these things are not working:
The port isn't in the same state like the Android and iOS technology preview during the Qt5.1 release, but it's a good opportunity to get more focus and effort in porting for WinRT. If they get a full port for WinRT, Qt will be a great framework for developers: they can targeting every mobile and desktop platform that matters, with one code base!

You can find a video of the examples on YouTube:

FIXES

  • At the first time compiling the sources, during compiling the D3D-Compiler in src/angle/d3dcompiler, it failed with the error: " 'win_flex' is not recognized as internal or external command ". In my case, I could fix it with adding some more sources: in the original Qt5-Git-Repository, there is a folder named gnuwin32. Download this folder and put in this structure:
    <PATH TO SOURCES>/qtbase-opensource-src-5.3.0-WinRT-TP\bin
    ...

    <PATH TO SOURCES>/
    qtbase-opensource-src-5.3.0-WinRT-TP\src
    ...
    <PATH TO SOURCES>/gnuwin32I hope that this will fix the compiling process!!!
  • The d3dcompiler-library is not recognozied from the WinRT-Platform-Plugin. In:
    src/
    angle/d3dcompiler/main.cpp add following line:
    line 137: L"d3dcompiler_43.dll",
    line 138: L"d3dcompiler_qtd.dll",
    line 139: 0


RESOURCES
[1] http://blog.qt.digia.com/blog/2013/12/12/qt-for-windows-runtime-technology-preview-released/
[2] http://download.qt-project.org/development_releases/qt/winrt-tp/

Kommentare

Beliebte Posts aus diesem Blog

Native Look-and-Feel on Windows 10 Mobile with Qt / QML

Building QtWebKit Technology Preview 5 from Sources

Qt5 on Windows Phone - Current State