summaryrefslogtreecommitdiffstats
path: root/doc/src/platforms/wince-customization.qdoc
blob: 6d76e43ae49bcb5369eabb98ea9b5556e80c7653 (plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
143
144
145
146
147
148
149
150
151
152
153
154
155
156
157
158
159
160
161
162
163
164
165
166
167
168
169
170
171
172
173
174
175
176
177
178
179
180
181
182
183
184
185
186
187
188
189
190
191
192
193
194
195
196
197
198
199
200
201
202
203
204
205
206
207
208
/****************************************************************************
**
** Copyright (C) 2013 Digia Plc and/or its subsidiary(-ies).
** Contact: http://www.qt-project.org/legal
**
** This file is part of the documentation of the Qt Toolkit.
**
** $QT_BEGIN_LICENSE:FDL$
** Commercial License Usage
** Licensees holding valid commercial Qt licenses may use this file in
** accordance with the commercial license agreement provided with the
** Software or, alternatively, in accordance with the terms contained in
** a written agreement between you and Digia.  For licensing terms and
** conditions see http://qt.digia.com/licensing.  For further information
** use the contact form at http://qt.digia.com/contact-us.
**
** GNU Free Documentation License Usage
** Alternatively, this file may be used under the terms of the GNU Free
** Documentation License version 1.3 as published by the Free Software
** Foundation and appearing in the file included in the packaging of
** this file.  Please review the following information to ensure
** the GNU Free Documentation License version 1.3 requirements
** will be met: http://www.gnu.org/copyleft/fdl.html.
** $QT_END_LICENSE$
**
****************************************************************************/

/*!
    \page windowsce-customization.html
    \ingroup qtce
    \title Windows CE - Working with Custom SDKs
    \brief How to set up Qt for use with custom Windows CE SDKs.

    When working with a custom SDK for Windows CE, Qt provides an easy way
    to add support for it to your development environment. The following is
    a tutorial that covers how to create a specification for Qt for Windows
    CE platforms.

    \tableofcontents

    \section1 Creating a Custom Build Specification

    Create a subdirectory in the \c mkspecs folder of the Qt directory.
    New specifications for Qt for Windows CE following this naming convention:

    \snippet snippets/code/doc_src_wince-customization.qdoc 0

    Using this convention makes it possible for \l{qmake} to identify that
    you are building Qt for Windows CE, and will customize the compilation
    process accordingly.

    Create the files \c qmake.conf and \c qplatformdefs.h inside the new
    specification directory. Take a look at the implementation of the other
    Windows CE specifications included in the \c mkspecs directory to see
    what is required to build Qt for Windows CE successfully.


    \section1 Fine-Tuning Options

    Compared to the desktop versions, Qt for Windows CE needs two additional
    options:

    \list
    \li \b{CE_SDK} specifies the name of the SDK.
    \li \b{CE_ARCH} specifies information about the target architecture.
    \endlist

    Following is an example configuration for a custom SDK we call "CustomSDK":

    \snippet snippets/code/doc_src_wince-customization.qdoc 1

    \note Running \l qmake to generate Visual Studio project files for Windows CE currently does not produce valid output..

    Additionally, most Windows CE SDKs use extra compiler options. These
    can be specified by expanding the \c DEFINES value.

    For example, with CustomSDK, the \c DEFINES variable
    is expanded in the following way:

    \snippet snippets/code/doc_src_wince-customization.qdoc 2


    \section1 Cross-compilation Environment for a Custom SDK

    Qt for Windows CE only requires that the mkspec that is specified
    with -xplatform is setup as mentioned \l{Fine-Tuning Options}{above}.

    The selection of the custom SDK environment will happen by concatenating \c CE_SDK
    and \c CE_ARCH. This builds a string that can be found in "\e{%ProgramFiles%\\Microsoft Visual Studio 9.0\\VC\\vcpackages\\WCE.VCPlatform.xml}"
    and contains the correct environment. If you are unsure about the SDK name and Arch for your
    SDK you can find it in this file.


    \section1 Compiling Qt for a Custom SDK

    Windows CE is highly customizable, hence it is possible that some SDKs have
    feature-stripped setups. Depending on the SDK's configuration, Qt may not
    compile in its standard configuration, as Qt for Windows CE is designed to
    be compatible with the Standard SDK setup. Every Makefile qmake generates
    that is not flagged to build for the host system will build WindowsCE projects
    for the SDK Qt was built with. There is no need to set a custom environment
    besides the Visual Studio 2005/2008 environment.

    However, it is possible to exclude features of Qt and create a version that
    compiles for the desired SDK.

    \section1 Making Qt Applications Start on a Custom Device

    Sometimes, a Windows CE device has been created with a configuration
    different from the corresponding SDK's configuration. In this case, symbols
    that were available at linking stage will be missing from the run-time
    libraries.

    Unfortunately, the operating system will not provide an error message that
    mentions which symbols are absent. Instead, a message box with the following
    message will appear:

    \c{app.exe is not a valid CE application!}

    To identify the missing symbols, you need to create a temporary
    application that attempts to dynamically load the Qt for Windows CE
    libraries using \c LoadLibrary. The following code can be used for this:

    \snippet snippets/code/doc_src_wince-customization.cpp 9

    Once you have compiled and deployed the application as well as the Qt
    libraries, start a remote debugger. The debugger will then print the
    ordinal number of the unresolved symbol.

    Search for parts of Qt that rely on these functions and disable them using
    the QFeatures functionality.

    In our experience, when Qt applications do not start on Windows CE, it is
    usually the result of missing symbols for the following classes or
    features:
    \list
    \li \l{Drag and Drop}
    \li \l{QClipboard}
    \li \l{QCursor}
    \endlist

    Please refer to the Microsoft documentation
    \l{http://msdn.microsoft.com/en-us/library/e7tsx612.aspx}{here} for
    information on what ordinals are and how you can create them. Information
    on accessing the corresponding symbol name to a given ordinal value can
    also be found in the Microsoft documentation.

*/

/*!
    \page shadow builds-wince.html
    \ingroup qtce
    \title Windows CE - Using shadow builds
    \brief How to create a shadow build for Qt for Windows CE.

    \tableofcontents

    While developing for Windows CE you might want to compile a
    version of Qt for several different platforms and SDKs. In order
    to create those different builds of Qt you do not have to copy the
    whole Qt package or the Qt source. You are able to create multiple
    Qt builds from a single source tree. Such builds are called shadow
    builds.

    Basically a shadow build is created by calling configure.exe from a
    different directory.

    To make sure that the shadow build compiles correctly it is important
    that you following these guidelines:

    \list
    \li The original Qt source package must be left untouched - configure must
    never have been run in the source tree directory.

    \li With Qt5, the code has to be checked out of the git repository, otherwise
        the out of source build will fail as syncqt is not executed.
    \li Avoid using "release" and "debug" in the path to the shadow build
    directory. (This is an internal limitation of the build system.)
    \li Perl has been installed on your system. (\l{ActivePerl} is a popular
    distribution of Perl on Windows.)
    \endlist

    So lets assume you have installed Qt in \c{C:\Qt\%VERSION%} and you want
    to create a shadow build in \c{C:\Qt\mobile5-shadow}:

    \list

    \li Make sure the enviroment variables for your compiler are set.

    Visual Studio includes \c{vcvars32.bat} for that purpose - or simply use
    the "Visual Studio Command Prompt" from the Start menu.

    \li Now navigate to your shadow build directory and run configure:

    \snippet snippets/code/doc_src_wince-customization.qdoc 4


    \li Finally, to build the shadow build type:

    \snippet snippets/code/doc_src_wince-customization.qdoc 7

    \li That's all. You have successfully created a shadow build of Qt in
    \c{C:\Qt\mobile5-shadow}.

    \li Now you can call \c{nmake install} and get a clean installation of Qt
        in \e{%INSTALLDIR%}.
    \endlist
*/