Наша сборка Qt VS Tools
giy
2022-06-13 175679ae608f0b295d761588d332f635b21bdf30
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
209
210
211
212
213
214
215
216
217
218
219
220
221
222
223
224
225
226
227
228
229
230
231
232
233
234
235
236
237
238
239
240
241
242
243
244
245
246
247
248
249
250
251
252
253
254
255
256
257
258
259
260
261
262
263
264
265
266
267
268
269
270
271
272
273
274
275
276
277
278
279
280
281
282
283
284
285
286
287
288
289
290
291
292
293
294
295
296
297
298
299
300
301
302
303
304
305
306
307
308
309
310
311
312
313
314
315
316
317
318
319
320
321
322
323
324
325
326
327
328
329
330
331
332
333
334
335
336
337
338
339
340
341
342
<?xml version="1.0" encoding="utf-8"?>
<!--
/****************************************************************************
**
** Copyright (C) 2020 The Qt Company Ltd.
** Contact: https://www.qt.io/licensing/
**
** This file is part of the Qt VS Tools.
**
** $QT_BEGIN_LICENSE:GPL-EXCEPT$
** 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 The Qt Company. For licensing terms
** and conditions see https://www.qt.io/terms-conditions. For further
** information use the contact form at https://www.qt.io/contact-us.
**
** GNU General Public License Usage
** Alternatively, this file may be used under the terms of the GNU
** General Public License version 3 as published by the Free Software
** Foundation with exceptions as appearing in the file LICENSE.GPL3-EXCEPT
** included in the packaging of this file. Please review the following
** information to ensure the GNU General Public License requirements will
** be met: https://www.gnu.org/licenses/gpl-3.0.html.
**
** $QT_END_LICENSE$
**
****************************************************************************/
-->
 
<!--
///////////////////////////////////////////////////////////////////////////////////////////////////
// Deployment of Qt dependencies
// -->
<Project xmlns="http://schemas.microsoft.com/developer/msbuild/2003">
 
  <!--
  /////////////////////////////////////////////////////////////////////////////////////////////////
  // Setup property page
  // -->
  <ItemGroup>
    <PropertyPageSchema
      Include="$(MSBuildThisFileDirectory)qtdeploy.xml" />
  </ItemGroup>
 
  <!--
  /////////////////////////////////////////////////////////////////////////////////////////////////
  // Default deploy log location
  // -->
  <PropertyGroup>
    <QtDeployLog Condition="'$(QtDeployLog)' == ''">$(IntDir)windeployqt.log</QtDeployLog>
  </PropertyGroup>
 
  <!--
  /////////////////////////////////////////////////////////////////////////////////////////////////
  // Schedule QtDeploy target to run after Link
  // -->
  <PropertyGroup Condition="'$(QtDeploy)' == 'true' AND '$(ApplicationType)' != 'Linux'">
    <BuildLinkTargets>$(BuildLinkTargets);QtDeploy</BuildLinkTargets>
  </PropertyGroup>
 
  <!--
  /////////////////////////////////////////////////////////////////////////////////////////////////
  // Deploy Qt files
  // -->
  <Target Name="QtDeploy"
    AfterTargets="Link"
    Inputs="$(TargetPath)" Outputs="$(QtDeployLog)"
    Condition="'$(QtDeploy)' == 'true' AND '$(ApplicationType)' != 'Linux'">
 
    <ItemGroup>
      <QtDeploy Include="$(TargetPath)"/>
    </ItemGroup>
 
    <!--
    ///////////////////////////////////////////////////////////////////////////////////////////////
    // Convert string lists in source item properties to lists of items
    // -->
    <Flatten Items="@(QtDeploy)"
      Metadata="QtDeployFiles;
                QtDeployDir;
                QtDeployLibDir;
                QtDeployPluginDir;
                QtDeployDebugRelease;
                QtDeployPdb;
                QtDeployForce;
                QtDeployNoPatchQt;
                QtDeployNoPlugins;
                QtDeployNoLibraries;
                QtDeployQmlDir;
                QtDeployQmlImport;
                QtDeployNoQuickImport;
                QtDeployNoTranslations;
                QtDeployNoSystemD3dCompiler;
                QtDeployNoVirtualKeyboard;
                QtDeployCompilerRuntime;
                QtDeployWebkit2;
                QtDeployAngle;
                QtDeployNoOpenglSw;
                QtDeployIncludeModules;
                QtDeployExcludeModules;
                QtDeployVerbose">
      <Output
        TaskParameter="Result" ItemName="Options" />
    </Flatten>
 
    <ItemGroup>
      <!--
      /////////////////////////////////////////////////////////////////////////////////////////////
      // Remove quotes from all paths
      // -->
      <Options>
        <Value Condition="( '%(Name)' == 'QtDeployFiles'
                         OR '%(Name)' == 'QtDeployDir'
                         OR '%(Name)' == 'QtDeployLibDir'
                         OR '%(Name)' == 'QtDeployPluginDir'
                         OR '%(Name)' == 'QtDeployQmlDir'
                         OR '%(Name)' == 'QtDeployQmlImport' )"
          >$([System.String]::Copy('%(Value)').Replace('&quot;', ''))</Value>
      </Options>
      <!--
        ///////////////////////////////////////////////////////////////////////////////////////////
        // Escape trailing back-slash in paths
        // -->
      <Options>
        <Value Condition="( '%(Name)' == 'QtDeployFiles'
                         OR '%(Name)' == 'QtDeployDir'
                         OR '%(Name)' == 'QtDeployLibDir'
                         OR '%(Name)' == 'QtDeployPluginDir'
                         OR '%(Name)' == 'QtDeployQmlDir'
                         OR '%(Name)' == 'QtDeployQmlImport' )
                        AND $([System.String]::Copy('%(Value)').Contains(' '))
                        AND $([System.String]::Copy('%(Value)').EndsWith('\'))"
          >%(Value)\</Value>
      </Options>
      <!--
        ///////////////////////////////////////////////////////////////////////////////////////////
        // Add quotes to paths containing spaces
        // -->
      <Options>
        <Value Condition="( '%(Name)' == 'QtDeployFiles'
                         OR '%(Name)' == 'QtDeployDir'
                         OR '%(Name)' == 'QtDeployLibDir'
                         OR '%(Name)' == 'QtDeployPluginDir'
                         OR '%(Name)' == 'QtDeployQmlDir'
                         OR '%(Name)' == 'QtDeployQmlImport' )
                        AND $([System.String]::Copy('%(Value)').Contains(' '))"
          >&quot;%(Value)&quot;</Value>
      </Options>
      <!--
      /////////////////////////////////////////////////////////////////////////////////////////////
      // Generate tool command line arguments
      // -->
      <Options>
        <!-- [files]                  Binaries or directory containing the binary. -->
        <PosArg Condition="'%(Name)' == 'QtDeployFiles'">%(Value)</PosArg>
      </Options>
      <Options>
        <!-- -dir <directory>         Use directory instead of binary directory. -->
        <Arg Condition="'%(Name)' == 'QtDeployDir'">--dir %(Value)</Arg>
      </Options>
      <Options>
        <!-- -libdir <path>           Copy libraries to path. -->
        <Arg Condition="'%(Name)' == 'QtDeployLibDir'">--libdir %(Value)</Arg>
      </Options>
      <Options>
        <!-- -plugindir <path>        Copy plugins to path. -->
        <Arg Condition="'%(Name)' == 'QtDeployPluginDir'">--plugindir %(Value)</Arg>
      </Options>
      <Options>
        <!-- -debug                   Assume debug binaries.
             -release                 Assume release binaries.-->
        <Arg Condition="'%(Name)' == 'QtDeployDebugRelease' AND '%(Value)' == 'debug'"
               >--debug</Arg>
        <Arg Condition="'%(Name)' == 'QtDeployDebugRelease' AND '%(Value)' == 'release'"
               >--release</Arg>
      </Options>
      <Options>
        <!-- -pdb                     Deploy .pdb files (MSVC). -->
        <Arg Condition="'%(Name)' == 'QtDeployPdb' AND '%(Value)' == 'true'"
               >--pdb</Arg>
      </Options>
      <Options>
        <!-- -force                   Force updating files. -->
        <Arg Condition="'%(Name)' == 'QtDeployForce' AND '%(Value)' == 'true'"
               >--force</Arg>
      </Options>
      <Options>
        <!-- -no-patchqt              Do not patch the Qt5Core library. -->
        <Arg Condition="'%(Name)' == 'QtDeployNoPatchQt' AND '%(Value)' == 'true'"
               >--no-patchqt</Arg>
      </Options>
      <Options>
        <!-- -no-plugins              Skip plugin deployment. -->
        <Arg Condition="'%(Name)' == 'QtDeployNoPlugins' AND '%(Value)' == 'true'"
               >--no-plugins</Arg>
      </Options>
      <Options>
        <!-- -no-libraries            Skip library deployment. -->
        <Arg Condition="'%(Name)' == 'QtDeployNoLibraries' AND '%(Value)' == 'true'"
               >--no-libraries</Arg>
      </Options>
      <Options>
        <!-- -qmldir <directory>      Scan for QML-imports starting from directory. -->
        <Arg Condition="'%(Name)' == 'QtDeployQmlDir'">--qmldir %(Value)</Arg>
      </Options>
      <Options>
        <!-- -qmlimport <directory>   Add the given path to the QML module search
                                      locations. -->
        <Arg Condition="'%(Name)' == 'QtDeployQmlImport'">--qmlimport %(Value)</Arg>
      </Options>
      <Options>
        <!-- -no-quick-import         Skip deployment of Qt Quick imports. -->
        <Arg Condition="'%(Name)' == 'QtDeployNoQuickImport' AND '%(Value)' == 'true'"
               >--no-quick-import</Arg>
      </Options>
      <Options>
        <!-- -no-translations         Skip deployment of translations. -->
        <Arg Condition="'%(Name)' == 'QtDeployNoTranslations' AND '%(Value)' == 'true'"
               >--no-translations</Arg>
      </Options>
      <Options>
        <!-- -no-system-d3d-compiler  Skip deployment of the system D3D compiler. -->
        <Arg Condition="'%(Name)' == 'QtDeployNoSystemD3dCompiler' AND '%(Value)' == 'true'"
               >--no-system-d3d-compiler</Arg>
      </Options>
      <Options>
        <!-- -no-virtualkeyboard      Disable deployment of the Virtual Keyboard. -->
        <Arg Condition="'%(Name)' == 'QtDeployNoVirtualKeyboard' AND '%(Value)' == 'true'"
               >--no-virtualkeyboard</Arg>
      </Options>
      <Options>
        <!-- -compiler-runtime        Deploy compiler runtime (Desktop only).
             -no-compiler-runtime     Do not deploy compiler runtime (Desktop only). -->
        <Arg Condition="'%(Name)' == 'QtDeployCompilerRuntime' AND '%(Value)' == 'deploy'"
               >--compiler-runtime</Arg>
        <Arg Condition="'%(Name)' == 'QtDeployCompilerRuntime' AND '%(Value)' == 'skip'"
               >--no-compiler-runtime</Arg>
      </Options>
      <Options>
        <!-- -webkit2                 Deployment of WebKit2 (web process).
             -no-webkit2              Skip deployment of WebKit2. -->
        <Arg Condition="'%(Name)' == 'QtDeployWebkit2' AND '%(Value)' == 'deploy'"
               >--webkit2</Arg>
        <Arg Condition="'%(Name)' == 'QtDeployWebkit2' AND '%(Value)' == 'skip'"
               >--no-webkit2</Arg>
      </Options>
      <Options>
        <!-- -angle                   Force deployment of ANGLE.
             -no-angle                Disable deployment of ANGLE. -->
        <Arg Condition="'%(Name)' == 'QtDeployAngle' AND '%(Value)' == 'deploy'"
               >--angle</Arg>
        <Arg Condition="'%(Name)' == 'QtDeployAngle' AND '%(Value)' == 'skip'"
               >--no-angle</Arg>
      </Options>
      <Options>
        <!-- -no-opengl-sw            Do not deploy the software rasterizer library. -->
        <Arg Condition="'%(Name)' == 'QtDeployNoOpenglSw' AND '%(Value)' == 'true'"
               >--no-opengl-sw</Arg>
      </Options>
      <Options>
        <!-- Qt libraries can be added by passing their name (-xml) ... -->
        <Arg Condition="'%(Name)' == 'QtDeployIncludeModules'">-%(Value)</Arg>
      </Options>
      <Options>
        <!-- ... or removed by passing the name prepended by -no- (-no-xml). -->
        <Arg Condition="'%(Name)' == 'QtDeployExcludeModules'">--no-%(Value)</Arg>
      </Options>
    </ItemGroup>
 
    <!--
    ///////////////////////////////////////////////////////////////////////////////////////////////
    // Run windeployqt
    // -->
    <PropertyGroup>
      <Cmd><![CDATA["$(QtToolsPath)\windeployqt.exe"]]></Cmd>
      <Cmd>$(Cmd) --list target</Cmd>
      <Cmd Condition="'%(Options.Arg)' != ''">$(Cmd) %(Options.Arg)</Cmd>
      <Cmd Condition="'%(Options.PosArg)' != ''">$(Cmd) %(Options.PosArg)</Cmd>
    </PropertyGroup>
    <Message Importance="high" Text="windeployqt: $(Cmd)" />
    <Exec Command="$(Cmd) > &quot;$(QtDeployLog)&quot;" />
 
    <!--
    ///////////////////////////////////////////////////////////////////////////////////////////////
    // Read deploy log into QtDeployed list
    // -->
    <ReadLinesFromFile File="$(QtDeployLog)">
      <Output TaskParameter="Lines" ItemName="QtDeployed" />
    </ReadLinesFromFile>
    <ItemGroup>
      <QtDeployed Remove="@(QtDeployed)" Condition="!Exists('%(Fullpath)')"/>
    </ItemGroup>
 
    <!--
    ///////////////////////////////////////////////////////////////////////////////////////////////
    // Mark deployed files as source content for VS deployment project
    // -->
    <ItemGroup>
      <None Include="@(QtDeployed)" Condition="'%(QtDeploy.QtDeployVsContent)' == 'true'">
        <DeploymentContent>true</DeploymentContent>
        <RootFolder>$(ProjectDir)</RootFolder>
      </None>
    </ItemGroup>
 
    <!--
    ///////////////////////////////////////////////////////////////////////////////////////////////
    // Log output files; used by VS on clean and up-to-date check
    // -->
    <ItemGroup>
      <QtDeployLog Include="$(QtDeployLog)"/>
      <QtDeployed Include="$(QtDeployLog)"/>
    </ItemGroup>
    <WriteLinesToFile
      File="$(TLogLocation)windeployqt.read.1u.tlog"
      Lines="^$(ProjectPath)"
      Overwrite="true" Encoding="Unicode"/>
    <WriteLinesToFile
      File="$(TLogLocation)windeployqt.write.1u.tlog"
      Lines="^$(ProjectPath);@(QtDeployLog->'%(Fullpath)')"
      Overwrite="true" Encoding="Unicode"/>
    <WriteLinesToFile
      File="$(TLogLocation)$(ProjectName).write.1u.tlog"
      Lines="^$(ProjectFileName);@(QtDeployed->'%(Fullpath)')"
      Overwrite="false" Encoding="Unicode"/>
 
    <!--
    ///////////////////////////////////////////////////////////////////////////////////////////////
    // Clean-up
    // -->
    <PropertyGroup>
      <Cmd/>
    </PropertyGroup>
    <ItemGroup>
      <Options Remove="@(Options)"/>
      <QtDeploy Remove="@(QtDeploy)"/>
      <QtDeployLog Remove="@(QtDeployLog)"/>
      <QtDeployed Remove="@(QtDeployed)"/>
    </ItemGroup>
  </Target>
</Project>