Build the Qt 5.3.1 for Windows Phone 8 development environment, qt5.3.1

Source: Internet
Author: User
Tags intel core i7

Build the Qt 5.3.1 for Windows Phone 8 development environment, qt5.3.1

Build the Qt 5.3.1 for Windows Phone 8 Development Environment

 

Currently, Qt supports Android and iOS development. I have also tried development on Android and iOS, and the research on Android is deeper, also made the first independent game "take medicine". In the release of Qt's New Version 5.3, the official announcement supported the development of WindowsPhone 8/8. 1. After two months, I also actively tried to see how to build the WP8 development environment using the latest Qt 5.3.1 version.

Original article, opposed to unstated reference. Original blog address: http://blog.csdn.net/gamesdev/article/details/38568903

1. Hardware requirements

The first is hardware. The unique advantage of developing WindowsRT/Windows Phone is that my notebook is a 64-bit system, the CPU is an Intel Core i7-4700MQ quad Core processor, the memory capacity is 4 GB, and runs Windows 8.1 operating system. Generally, computers a few years ago may not be competent for such development, because to support Windows Phone development, the CPU must support Hyper-V technology. This is Microsoft's virtualization technology, equivalent to running a Windows Phone Virtual Machine in Windows 8.1. For Hyper-V requirements, I checked that the CPU must be 64-bit and support the hardware self-protection (DEP) function, which has been started. The memory is at least 2 GB. My computer is so sloppy that I can develop Windows Phone smoothly.

2. software requirements

First, install the Windows 8/8.1 operating system. Can Windows 7 be used? After reading the post on the Internet, it may not work ......

Secondly, I read the "Qt forWinRT" topic in the Qt help document and learned that Visual Studio must be installed to support Windows Phone development. For Windows Phone 8/8. 1, Visual Studio 2012 for Windows Phone must be installed. However, what time is it now? I can't wait to use the latest Visual Studio version. So I went to this website to get ed2k resources, and started to download the latest Visual Studio 14 at high speed. Visual Studio14 has a component selection during installation. Remember to select the Windows Phone SDK.

Finally Qt is essential, download the latest "Qt5.3.1 for Windows RT 32-bit (647 MB)" on the qt-project.org, and unzip it to the appropriate location.

The installation sequence is Visual Studio 14 → Qt 5.3.1 for Windows RT. Then open the Qt Creator that comes with Qt.

3. Test the first program

First open the Qt Creator, that is, the IDE attached to Qt5.3.1. Create a QML project and set the build suite as follows:

The generated code is as follows, and some modifications are made here:

I will first use the desktop suite to build it. The result is as follows:

Everything works.

4. Start porting Windows Phone 8

Next I will try to port the example program to Windows Phone 8. As shown in the first figure, we can select the physical machine suite and Emulator suite. Emulator can only be selected for users without physical machines. When we follow the normal steps to build and run the system, the Windows Phone virtual machine will pop up, and everything looks normal:

But there is a pitfall. After the program starts, it will become blank:

The following will also pop up

Qt. winrtrunner: "E:/qtprojects/build-TestQuickForWinPhone8-Qt_5_3_for_Windows_Phone_8_x86_MSVC2012_32bit_Emulator-Release/release/AppxManifest. xml" does not exist.

Qt. winrtrunner: "E:/qtprojects/build-TestQuickForWinPhone8-Qt_5_3_for_Windows_Phone_8_x86_MSVC2012_32bit_Emulator-Release/release/AppxManifest. xml" does not exist.

Such a red letter. The problem will not be affected. How can we display programs?

5. UI. You are coming back soon

As mentioned in the article "Qt for WinRT", during the test, Qt provides a small tool called qtd3dservice. It can instantly compile and present the shader to the application. As OpenGL that supports Qt rendering, Microsoft had to "change its face" after encountering Microsoft's mobile Phone and "see" Windows Phone 8 in Direct3D. Therefore, we need to use a project ANGLE in Google Code to convert the OpenGL ES2.0 shader Code into a D3D shader. The interface cannot be displayed just now, because the coloring tool on which the interface depends is not loaded.

The solution is also simple. Run the qtd3dservice without parameters in the bin directory of QtSDK. Then open the program we compiled:

This is a little better. At least we can see the interface, but a lot of squares make us worried. This is another pitfall. How can we see the text?

6. Text. You are coming back soon

Check the directory structure of Qt 5.3.1for Windows Phone. A significant difference is that there is a directory named "font" in the bin and lib folders, this directory stores fonts related to the display of the interface. By default, these fonts are included in the package. Wait. We just ran the program like this, but it was not packaged. So how to package it? This depends on the VS14 we just installed. First, locate $ {YourProjectDirctory}, open the command prompt, and enter:

$ {QTDIR}/5.3/winphone_x86/bin/qmake-tp vcYourProject. pro "CONFIG + = windeployqt"

Here is my example:

After running, uuidgen cannot be found. This is another pitfall. At the beginning, I tried my best to find uuidgen.exe. I downloaded uidgen.exe on the Internet and put it in C:/Windows/system32. The results didn't work! So this is a pitfall. However, this error does not affect this step. Some necessary Qt and VS project files can also be generated smoothly.

Use VS14 to open the generated vcxproj file. As follows:

Click deploy. An error is returned!

C: \ Program Files (x86) \ MSBuild \ Microsoft \ WindowsPhone \ v8.0 \ Microsoft.Phone.Packaging.tar gets (637,9): error: the 'produtid' attribute is invalid-The value' {} 'is invalidaccording to its ype 'HTTP: // WPCommontypes: ST_Guid'-The Patternconstraint failed.

This is where uuidgen is located. Unable to generate ProductID, so the package cannot be deployed.

The most urgent task is to find the uuid generation method. There are several methods.

(1) vshas a tool named guidgen.exe, which is only one letter different from uuidgen. You can use it to generate uuid;

(2) download uuidgen.exe from the Internet. It was a veteran of Microsoft in 1996, but it still produces uuid under the command line;

(3) Everyone has a Chrome browser. It teaches you how to use Chrome to generate uuid. In fact, any js interpreter environment can be used, including QML Engine. Open Chrome, Ctrl + Shift + J, open the JS console, and enter the following JS Code:

function getGUID( ){function _p8(s) {var p = (Math.random().toString(16)+"000000000").substr(2,8);return s ? "-" + p.substr(0,4) + "-" + p.substr(4,4) : p ;}return _p8() + _p8(true) + _p8(true) + _p8();}getGUID( );

Press enter to generate a valid uuid. The uuid I generated here is:

684cebbf-bb4a-857b-9a1e-746feb967cd3

What we need to do is to enter the project directory, edit WMAppManifest. xml, find the ProductID field, put the uuid we generated in braces, and save it.

Go to VS14, click deploy, and press Ctrl + F5 to run at full speed. Remember to run qtd3dservice before running. The running result is as follows:

Success! After two days of trying and asking questions, I was able to successfully run the Qt program on Windows Phone. For more development issues on Windows Phone, I will study it later.

7. Summary

Here is a small summary:

1. The suffix of the Windows Phone application installation package is the. xap file, which can be opened using a 7-zip compression and decompression tool. After opening it, it is found that the directory structure of the Android apk installation package is similar.

2. As described above, there are still many pitfalls in developing WindowsPhone 8 with Qt. For example, if you want to click the File menu in the upper left corner, it is not sensitive. Sometimes the Exit option will exclusively occupy the screen, it seems that this screen is very empty. In addition, some important Qt modules, such as Enginio, are not transplanted together. Therefore, developing a Windows Phone 8 application is still experimental, and we hope to do better in Qt 5.4.

3. If you do not want to enable the qtd3dservice to compile the shader online each time, you can use "qtd3dservice -- list-binary -- qrc -- device 0 -- app {684cebbf-bb4a-857b-9a1e-746feb967cd3} -- output/path/to/project/shaders. qrc "to generate the shader resource, then modify the pro file and add this line:" RESOURCES + = shaders. qrc ", and finally re-compile and package.

4. In fact, qtd3dservice was only a preliminary feasible method. At that time, considering Windows policies, JIT compilation was not allowed. On jira, I saw the result discussed by the Qt team that qtd3dservice will be removed from Qt5.4. Because (1) Windows 8.1 supports compilation of the device's online (JIT) shader; (2) qtd3dservice is only an experimental solution and does not need to be maintained in the future; (3) you can use the cache method adopted by scene-graph to apply it to the coloring tool. (Refer to here)

5. Even if Hyper-V technology is used, the effect of WindowsPhone 8 on the simulator is not as good as that on the real machine. I used Nokia Lumia 525 in Suning Appliance to successfully run Digia's Qt application Quick Forcast. If you have the conditions, buy a real machine for development and testing.


Build the qt + opengl Development Environment

Various versions of Qt: qt-project.org/downloads
We recommend that you download the corresponding version of Qt5, which is better for VS2010 development!
(1) Qt 5.1.0 for Windows 32-bit (VS 2010,505 MB) (Info)
(2) Visual Studio Add-in 1.2.2 for Qt5
(3) VS2010
You can find the first two URLs (1) and (2) above. download them.
After VS2010 is installed, the two Qt plug-ins are installed. After the installation is successful, Qt5 will appear in VS. After the environment is configured, the Qt interface program can be developed.

How to build a development environment for Windows phone 7?

Like you, I only have one Visio Studio 2010 flagship edition, and then I downloaded three files from Microsoft to install them, however, when creating a new project, the update for vs2010 for windows phone7 has not been solved. Help you !!

Related Article

Contact Us

The content source of this page is from Internet, which doesn't represent Alibaba Cloud's opinion; products and services mentioned on that page don't have any relationship with Alibaba Cloud. If the content of the page makes you feel confusing, please write us an email, we will handle the problem within 5 days after receiving your email.

If you find any instances of plagiarism from the community, please send an email to: info-contact@alibabacloud.com and provide relevant evidence. A staff member will contact you within 5 working days.

A Free Trial That Lets You Build Big!

Start building with 50+ products and up to 12 months usage for Elastic Compute Service

  • Sales Support

    1 on 1 presale consultation

  • After-Sales Support

    24/7 Technical Support 6 Free Tickets per Quarter Faster Response

  • Alibaba Cloud offers highly flexible support services tailored to meet your exact needs.