| 1 |
<?xml version="1.0" encoding="utf-8"?> |
| 2 |
<!-- |
| 3 |
/**************************************************************************** |
| 4 |
** |
| 5 |
** Copyright (C) 2018 The Qt Company Ltd. |
| 6 |
** Contact: https://www.qt.io/licensing/ |
| 7 |
** |
| 8 |
** This file is part of the Qt VS Tools. |
| 9 |
** |
| 10 |
** $QT_BEGIN_LICENSE:GPL-EXCEPT$ |
| 11 |
** Commercial License Usage |
| 12 |
** Licensees holding valid commercial Qt licenses may use this file in |
| 13 |
** accordance with the commercial license agreement provided with the |
| 14 |
** Software or, alternatively, in accordance with the terms contained in |
| 15 |
** a written agreement between you and The Qt Company. For licensing terms |
| 16 |
** and conditions see https://www.qt.io/terms-conditions. For further |
| 17 |
** information use the contact form at https://www.qt.io/contact-us. |
| 18 |
** |
| 19 |
** GNU General Public License Usage |
| 20 |
** Alternatively, this file may be used under the terms of the GNU |
| 21 |
** General Public License version 3 as published by the Free Software |
| 22 |
** Foundation with exceptions as appearing in the file LICENSE.GPL3-EXCEPT |
| 23 |
** included in the packaging of this file. Please review the following |
| 24 |
** information to ensure the GNU General Public License requirements will |
| 25 |
** be met: https://www.gnu.org/licenses/gpl-3.0.html. |
| 26 |
** |
| 27 |
** $QT_END_LICENSE$ |
| 28 |
** |
| 29 |
****************************************************************************/ |
| 30 |
--> |
| 31 |
|
| 32 |
<!-- |
| 33 |
/////////////////////////////////////////////////////////////////////////////////////////////////// |
| 34 |
/// Qt/MSBuild global definitions |
| 35 |
/////////////////////////////////////////////////////////////////////////////////////////////////// |
| 36 |
// --> |
| 37 |
<Project> |
| 38 |
|
| 39 |
<!-- |
| 40 |
///////////////////////////////////////////////////////////////////////////////////////////////// |
| 41 |
// Build dependencies |
| 42 |
// --> |
| 43 |
<PropertyGroup> |
| 44 |
<BuildDependsOn> |
| 45 |
QtVersion; |
| 46 |
$(BuildDependsOn); |
| 47 |
Qt |
| 48 |
</BuildDependsOn> |
| 49 |
<CleanDependsOn> |
| 50 |
$(CleanDependsOn); |
| 51 |
QtClean |
| 52 |
</CleanDependsOn> |
| 53 |
<DesignTimeBuildInitTargets> |
| 54 |
$(DesignTimeBuildInitTargets); |
| 55 |
Qt |
| 56 |
</DesignTimeBuildInitTargets> |
| 57 |
<ComputeCompileInputsTargets> |
| 58 |
$(ComputeCompileInputsTargets); |
| 59 |
Qt |
| 60 |
</ComputeCompileInputsTargets> |
| 61 |
<BeforeClCompileTargets> |
| 62 |
$(BeforeClCompileTargets); |
| 63 |
Qt |
| 64 |
</BeforeClCompileTargets> |
| 65 |
<ComputeLinkInputsTargets> |
| 66 |
$(ComputeLinkInputsTargets); |
| 67 |
Qt |
| 68 |
</ComputeLinkInputsTargets> |
| 69 |
</PropertyGroup> |
| 70 |
|
| 71 |
<!-- |
| 72 |
///////////////////////////////////////////////////////////////////////////////////////////////// |
| 73 |
// Qt/MSBuild global properties |
| 74 |
// --> |
| 75 |
<Import Project="..\version.targets" Condition="Exists('..\version.targets')"/> |
| 76 |
<PropertyGroup> |
| 77 |
<QtMsBuildVersion>$(QtVSToolsVersion)</QtMsBuildVersion> |
| 78 |
<QtDebug Condition="'$(QtDebug)' == ''">false</QtDebug> |
| 79 |
<QtLogFilePath Condition="'$(QtLogFilePath)' == ''" |
| 80 |
>$([System.IO.Path]::Combine($(ProjectDir),$(IntDir)qt_work.log))</QtLogFilePath> |
| 81 |
<QtMaxProcs Condition="'$(QtMaxProcs)' == ''" |
| 82 |
>$([System.Environment]::ProcessorCount)</QtMaxProcs> |
| 83 |
</PropertyGroup> |
| 84 |
|
| 85 |
<!-- |
| 86 |
///////////////////////////////////////////////////////////////////////////////////////////////// |
| 87 |
/// TARGET QtGetDefaultClCompile |
| 88 |
///////////////////////////////////////////////////////////////////////////////////////////////// |
| 89 |
// Get default C++ properties |
| 90 |
// --> |
| 91 |
<Target Name="QtGetDefaultClCompile"> |
| 92 |
<ItemGroup> |
| 93 |
<ClCompile Include="DefaultClCompile"/> |
| 94 |
</ItemGroup> |
| 95 |
</Target> |
| 96 |
|
| 97 |
<!-- |
| 98 |
///////////////////////////////////////////////////////////////////////////////////////////////// |
| 99 |
/// TARGET QtClean |
| 100 |
///////////////////////////////////////////////////////////////////////////////////////////////// |
| 101 |
// Clean-up from previous build |
| 102 |
// --> |
| 103 |
<Target Name="QtClean"> |
| 104 |
<Message Importance="High" Condition="'$(QtDebug)' == 'true'" Text="## Qt Clean"/> |
| 105 |
<Delete Files="$(QtLogFilePath)"/> |
| 106 |
</Target> |
| 107 |
|
| 108 |
<!-- |
| 109 |
///////////////////////////////////////////////////////////////////////////////////////////////// |
| 110 |
/// TARGET QtVersion |
| 111 |
///////////////////////////////////////////////////////////////////////////////////////////////// |
| 112 |
// Print debug message with Qt/MSBuild version |
| 113 |
// --> |
| 114 |
<Target Name="QtVersion"> |
| 115 |
<Message Importance="High" Condition="'$(QtDebug)' == 'true'" |
| 116 |
Text="Qt/MSBuild v$(QtMsBuildVersion) ($(MSBuildThisFileDirectory))"/> |
| 117 |
</Target> |
| 118 |
|
| 119 |
<!-- |
| 120 |
///////////////////////////////////////////////////////////////////////////////////////////////// |
| 121 |
/// TARGET QtPrepare |
| 122 |
///////////////////////////////////////////////////////////////////////////////////////////////// |
| 123 |
// Prepare Qt build: read and parse work log file |
| 124 |
// --> |
| 125 |
<Target Name="QtPrepare" |
| 126 |
Condition="'$(QtSkipWork)' != 'true'" |
| 127 |
DependsOnTargets="$(QtDependsOn)" |
| 128 |
BeforeTargets="QtWorkPrepare"> |
| 129 |
|
| 130 |
<Message Importance="High" Condition="'$(QtDebug)' == 'true'" Text="#### QtPrepare"/> |
| 131 |
|
| 132 |
<ReadLinesFromFile File="$(QtLogFilePath)"> |
| 133 |
<Output TaskParameter="Lines" ItemName="QtLogData"/> |
| 134 |
</ReadLinesFromFile> |
| 135 |
<ItemGroup Condition="'@(QtLogData)' != ''"> |
| 136 |
<QtWorkLog |
| 137 |
Include="@(QtLogData->'$([System.String]::Copy('%(QtLogData.Identity)').Split('|')[0])')"> |
| 138 |
<Hash>$([System.String]::Copy('%(QtLogData.Identity)').Split('|')[1])</Hash> |
| 139 |
</QtWorkLog> |
| 140 |
</ItemGroup> |
| 141 |
</Target> |
| 142 |
|
| 143 |
<!-- |
| 144 |
///////////////////////////////////////////////////////////////////////////////////////////////// |
| 145 |
/// TARGET QtWorkPrepare |
| 146 |
///////////////////////////////////////////////////////////////////////////////////////////////// |
| 147 |
// Analyze work request and decide if the Qt tool needs to be called or if the output from the |
| 148 |
// previous call is still valid. |
| 149 |
// --> |
| 150 |
<Target Name="QtWorkPrepare" DependsOnTargets="$(QtDependsOn);$(QtBuildTargets)" |
| 151 |
Condition="'$(QtSkipWork)' != 'true'" |
| 152 |
Inputs="%(QtWork.WorkType)(%(QtWork.Identity))" |
| 153 |
Outputs="@(QtWork->'####### Don't skip this target #######')"> |
| 154 |
|
| 155 |
<Message Importance="High" Condition="'$(QtDebug)' == 'true' AND '@(QtWork)' != ''" |
| 156 |
Text="## QtWorkPrepare %(QtWork.Identity)" /> |
| 157 |
|
| 158 |
<!-- |
| 159 |
/////////////////////////////////////////////////////////////////////////////////////////////// |
| 160 |
// Calculate hash for the requested work item, based on its associated tool and options |
| 161 |
// --> |
| 162 |
<GetItemHash Condition="'@(QtWork)' != ''" |
| 163 |
Item="@(QtWork)" Keys="Identity;WorkType;ToolPath;Options"> |
| 164 |
<Output TaskParameter="Hash" PropertyName="work_hash" /> |
| 165 |
</GetItemHash> |
| 166 |
|
| 167 |
<!-- |
| 168 |
/////////////////////////////////////////////////////////////////////////////////////////////// |
| 169 |
// Try to find entry in Qt work log for the requested work item; get logged hash |
| 170 |
// --> |
| 171 |
<PropertyGroup Condition="'@(QtWork)' != ''"> |
| 172 |
<work_key>@(QtWork->'%(WorkType)(%(Identity))')</work_key> |
| 173 |
<dependencies_changed>@(QtWork->'%(DependenciesChanged)')</dependencies_changed> |
| 174 |
<input_changed>@(QtWork->'%(InputChanged)')</input_changed> |
| 175 |
<project_changed |
| 176 |
Condition="'$(dependencies_changed)' == 'true' AND '$(input_changed)' != 'true'" |
| 177 |
>true</project_changed> |
| 178 |
</PropertyGroup> |
| 179 |
|
| 180 |
<FindInList Condition="'@(QtWork)' != '' AND '$(input_changed)' != 'true'" |
| 181 |
CaseSensitive="false" List="@(QtWorkLog)" ItemSpecToFind="$(work_key)"> |
| 182 |
<Output TaskParameter="ItemFound" ItemName="log_entry"/> |
| 183 |
</FindInList> |
| 184 |
|
| 185 |
<PropertyGroup Condition="'@(QtWork)' != ''"> |
| 186 |
<log_hash Condition="'@(log_entry)' != ''">@(log_entry->'%(Hash)')</log_hash> |
| 187 |
</PropertyGroup> |
| 188 |
|
| 189 |
<!-- |
| 190 |
/////////////////////////////////////////////////////////////////////////////////////////////// |
| 191 |
// Skip work item if: |
| 192 |
// * work is not needed: |
| 193 |
// - input was not modified |
| 194 |
// - AND project was not modified OR command line did not change (i.e. hashes are the same) |
| 195 |
// * OR we're in a design-time build |
| 196 |
// --> |
| 197 |
<PropertyGroup> |
| 198 |
<do_work |
| 199 |
Condition="'$(input_changed)' == 'true' |
| 200 |
OR ('$(project_changed)' == 'true' AND '$(log_hash)' != '$(work_hash)')" |
| 201 |
>true</do_work> |
| 202 |
<skip_work |
| 203 |
Condition="'$(do_work)' != 'true' OR '$(DesignTimeBuild)' == 'true'" |
| 204 |
>true</skip_work> |
| 205 |
</PropertyGroup> |
| 206 |
|
| 207 |
<!-- |
| 208 |
/////////////////////////////////////////////////////////////////////////////////////////////// |
| 209 |
// Skip work item |
| 210 |
// --> |
| 211 |
<ItemGroup Condition="'@(QtWork)' != '' AND '$(skip_work)' == 'true'"> |
| 212 |
<QtWorkResult Include="@(QtWork)"> |
| 213 |
<ExitCode>0</ExitCode> |
| 214 |
<Skipped>true</Skipped> |
| 215 |
</QtWorkResult> |
| 216 |
<QtWork Remove="@(QtWork)" /> |
| 217 |
</ItemGroup> |
| 218 |
|
| 219 |
<!-- |
| 220 |
/////////////////////////////////////////////////////////////////////////////////////////////// |
| 221 |
// Generate new work log entry and ensure path to output exists |
| 222 |
// --> |
| 223 |
<ItemGroup Condition="'@(QtWork)' != '' AND '$(skip_work)' != 'true'"> |
| 224 |
<QtWorkLog Remove="$(work_key)"/> |
| 225 |
<QtWorkLog Include="$(work_key)"> |
| 226 |
<Hash>$(work_hash)</Hash> |
| 227 |
</QtWorkLog> |
| 228 |
</ItemGroup> |
| 229 |
|
| 230 |
<MakeDir Condition="'@(QtWork)' != '' AND '$(skip_work)' != 'true'" |
| 231 |
Directories="$([System.IO.Path]::GetDirectoryName(%(QtWork.OutputFile)))"/> |
| 232 |
|
| 233 |
<!-- |
| 234 |
/////////////////////////////////////////////////////////////////////////////////////////////// |
| 235 |
// Clean-up |
| 236 |
// --> |
| 237 |
<PropertyGroup> |
| 238 |
<work_key/> |
| 239 |
<log_hash/> |
| 240 |
<dependencies_changed/> |
| 241 |
<input_changed/> |
| 242 |
<project_changed/> |
| 243 |
<do_work/> |
| 244 |
<skip_work/> |
| 245 |
</PropertyGroup> |
| 246 |
<ItemGroup> |
| 247 |
<log_entry Remove="@(log_entry)"/> |
| 248 |
</ItemGroup> |
| 249 |
</Target> |
| 250 |
|
| 251 |
<!-- |
| 252 |
///////////////////////////////////////////////////////////////////////////////////////////////// |
| 253 |
/// TARGET QtWork |
| 254 |
///////////////////////////////////////////////////////////////////////////////////////////////// |
| 255 |
// Run Qt tools and add dynamic C++ sources to build |
| 256 |
// --> |
| 257 |
<Target Name="QtWork" |
| 258 |
Condition="'$(QtSkipWork)' != 'true'" |
| 259 |
DependsOnTargets="QtWorkPrepare;QtGetDefaultClCompile"> |
| 260 |
|
| 261 |
<Message Importance="High" Condition="'$(QtDebug)' == 'true'" |
| 262 |
Text="## Qt Build $(QtBuildTargets.Replace(';',' ').Trim())" /> |
| 263 |
|
| 264 |
<!-- |
| 265 |
/////////////////////////////////////////////////////////////////////////////////////////////// |
| 266 |
// Run work locally in parallel processes |
| 267 |
// --> |
| 268 |
<QtRunWork |
| 269 |
Condition="'$(ApplicationType)' != 'Linux' AND '@(QtWork)' != '' |
| 270 |
AND '%(QtWork.ParallelBuild)' == 'true' |
| 271 |
AND '$(DesignTimeBuild)' != 'true'" |
| 272 |
QtWork="@(QtWork)" QtMaxProcs="$(QtMaxProcs)" QtDebug="$(QtDebug)"> |
| 273 |
<Output TaskParameter="Result" ItemName="QtWorkResult" /> |
| 274 |
</QtRunWork> |
| 275 |
|
| 276 |
<!-- |
| 277 |
/////////////////////////////////////////////////////////////////////////////////////////////// |
| 278 |
// Run work locally in a single process |
| 279 |
// --> |
| 280 |
<QtRunWork |
| 281 |
Condition="'$(ApplicationType)' != 'Linux' AND '@(QtWork)' != '' |
| 282 |
AND '%(QtWork.ParallelBuild)' != 'true' |
| 283 |
AND '$(DesignTimeBuild)' != 'true'" |
| 284 |
QtWork="@(QtWork)" QtMaxProcs="1" QtDebug="$(QtDebug)"> |
| 285 |
<Output TaskParameter="Result" ItemName="QtWorkResult" /> |
| 286 |
</QtRunWork> |
| 287 |
|
| 288 |
<!-- |
| 289 |
/////////////////////////////////////////////////////////////////////////////////////////////// |
| 290 |
// Run work in build host |
| 291 |
// --> |
| 292 |
<!-- // Translate local paths to host paths --> |
| 293 |
<Flatten |
| 294 |
Condition="'$(ApplicationType)' == 'Linux' |
| 295 |
AND '@(QtWork)' != '' AND '$(DesignTimeBuild)' != 'true'" |
| 296 |
Items="@(QtWork)" Metadata="ResourceFiles"> |
| 297 |
<Output TaskParameter="Result" ItemName="ResourceFiles"/> |
| 298 |
</Flatten> |
| 299 |
<ItemGroup |
| 300 |
Condition="'$(ApplicationType)' == 'Linux' |
| 301 |
AND '@(QtWork)' != '' AND '$(DesignTimeBuild)' != 'true'"> |
| 302 |
<LocalPath Include="%(QtWork.Identity)"> |
| 303 |
<Name>InputPath</Name> |
| 304 |
<Item>%(QtWork.Identity)</Item> |
| 305 |
<Value>%(QtWork.Identity)</Value> |
| 306 |
</LocalPath> |
| 307 |
<LocalPath |
| 308 |
Condition="'%(ResourceFiles.Identity)' != ''" |
| 309 |
Include="@(ResourceFiles->'%(Item)')"> |
| 310 |
<Name>InputPath</Name> |
| 311 |
<Item>@(ResourceFiles->'%(Value)')</Item> |
| 312 |
<Value>@(ResourceFiles->'%(Value)')</Value> |
| 313 |
</LocalPath> |
| 314 |
<LocalPath Include="%(QtWork.Identity)"> |
| 315 |
<Name>OutputPath</Name> |
| 316 |
<Item>%(QtWork.OutputFile)</Item> |
| 317 |
<Value>%(QtWork.OutputFile)</Value> |
| 318 |
</LocalPath> |
| 319 |
</ItemGroup> |
| 320 |
<HostTranslatePaths |
| 321 |
Condition="'$(ApplicationType)' == 'Linux' |
| 322 |
AND '@(QtWork)' != '' AND '$(DesignTimeBuild)' != 'true'" |
| 323 |
Items="@(LocalPath)" Names="InputPath;OutputPath"> |
| 324 |
<Output TaskParameter="Result" ItemName="HostPath"/> |
| 325 |
</HostTranslatePaths> |
| 326 |
<ItemGroup> |
| 327 |
<InputPath Include="@(HostPath->WithMetadataValue('Name', 'InputPath'))" /> |
| 328 |
<OutputPath Include="@(HostPath->WithMetadataValue('Name', 'OutputPath'))" /> |
| 329 |
</ItemGroup> |
| 330 |
|
| 331 |
<!-- // Run command --> |
| 332 |
<HostExec |
| 333 |
Condition="'$(ApplicationType)' == 'Linux' |
| 334 |
AND '%(Identity)' != '' AND '$(DesignTimeBuild)' != 'true'" |
| 335 |
Message="@(QtWork->'%(WorkType) %(Identity)')" |
| 336 |
Command="@(QtWork->'%(ToolPath) %(Options)')" |
| 337 |
Inputs="@(InputPath)" |
| 338 |
Outputs="@(OutputPath)" |
| 339 |
RemoteTarget="$(ResolvedRemoteTarget)" |
| 340 |
RemoteProjectDir="$(_ResolvedRemoteProjectDir)"> |
| 341 |
</HostExec> |
| 342 |
|
| 343 |
<!-- // Generate result item --> |
| 344 |
<ItemGroup |
| 345 |
Condition="'$(ApplicationType)' == 'Linux' |
| 346 |
AND '@(QtWork)' != '' AND '$(DesignTimeBuild)' != 'true'"> |
| 347 |
<QtWorkResult Include="@(QtWork)"> |
| 348 |
<ExitCode>0</ExitCode> |
| 349 |
</QtWorkResult> |
| 350 |
</ItemGroup> |
| 351 |
|
| 352 |
<!-- |
| 353 |
/////////////////////////////////////////////////////////////////////////////////////////////// |
| 354 |
// Save tracking log of files read during build; used by VS to check the up-to-date status |
| 355 |
// --> |
| 356 |
<ItemGroup Condition="'$(DesignTimeBuild)' != 'true'"> |
| 357 |
<read_log Include="^%(QtWorkResult.FullPath);%(QtWorkResult.AdditionalDependencies)" |
| 358 |
Condition="'%(QtWorkResult.ExitCode)' == '0' AND '%(QtWorkResult.DisableLog)' != 'true'"> |
| 359 |
<WorkType>%(QtWorkResult.WorkType)</WorkType> |
| 360 |
</read_log> |
| 361 |
<read_log> |
| 362 |
<Path Condition="$([System.String]::Copy('%(Identity)').StartsWith('^'))">%(Identity)</Path> |
| 363 |
<Path Condition="!$([System.String]::Copy('%(Identity)').StartsWith('^'))" |
| 364 |
>$([System.IO.Path]::Combine('$(MSBuildProjectDirectory)','%(Identity)'))</Path> |
| 365 |
</read_log> |
| 366 |
</ItemGroup> |
| 367 |
|
| 368 |
<WriteLinesToFile |
| 369 |
Condition="'@(read_log)' != ''" |
| 370 |
File="$(TLogLocation)%(read_log.WorkType).read.1u.tlog" |
| 371 |
Lines="@(read_log->MetaData('Path')->ToUpperInvariant());" |
| 372 |
Overwrite="true" |
| 373 |
Encoding="Unicode"/> |
| 374 |
|
| 375 |
<!-- |
| 376 |
/////////////////////////////////////////////////////////////////////////////////////////////// |
| 377 |
// Save tracking log of files written during build; used by VS to check the up-to-date status |
| 378 |
// --> |
| 379 |
<ItemGroup Condition="'$(DesignTimeBuild)' != 'true'"> |
| 380 |
<write_log Include="^%(QtWorkResult.FullPath);%(QtWorkResult.OutputFile)" |
| 381 |
Condition="'%(QtWorkResult.ExitCode)' == '0' AND '%(QtWorkResult.DisableLog)' != 'true'"> |
| 382 |
<WorkType>%(QtWorkResult.WorkType)</WorkType> |
| 383 |
</write_log> |
| 384 |
<write_log> |
| 385 |
<Path Condition="$([System.String]::Copy('%(Identity)').StartsWith('^'))">%(Identity)</Path> |
| 386 |
<Path Condition="!$([System.String]::Copy('%(Identity)').StartsWith('^'))" |
| 387 |
>$([System.IO.Path]::Combine('$(MSBuildProjectDirectory)','%(Identity)'))</Path> |
| 388 |
</write_log> |
| 389 |
</ItemGroup> |
| 390 |
|
| 391 |
<WriteLinesToFile Condition="'@(write_log)' != ''" |
| 392 |
File="$(TLogLocation)%(write_log.WorkType).write.1u.tlog" |
| 393 |
Lines="@(write_log->MetaData('Path')->ToUpperInvariant());" |
| 394 |
Overwrite="true" Encoding="Unicode"/> |
| 395 |
|
| 396 |
<!-- |
| 397 |
/////////////////////////////////////////////////////////////////////////////////////////////// |
| 398 |
// Log output files; this is used by VS to determine what files to delete on "Clean" |
| 399 |
// --> |
| 400 |
<ItemGroup Condition="'$(DesignTimeBuild)' != 'true'"> |
| 401 |
<clean_log Include="%(QtWorkResult.OutputFile)" |
| 402 |
Condition="'%(QtWorkResult.ExitCode)' == '0'"> |
| 403 |
<Source>@(QtWorkResult, '|')</Source> |
| 404 |
</clean_log> |
| 405 |
</ItemGroup> |
| 406 |
|
| 407 |
<WriteLinesToFile Condition="'@(clean_log)' != ''" |
| 408 |
File="$(TLogLocation)$(ProjectName).write.1u.tlog" |
| 409 |
Lines="^%(clean_log.Source);@(clean_log->'%(Fullpath)')" |
| 410 |
Encoding="Unicode"/> |
| 411 |
|
| 412 |
<!-- |
| 413 |
/////////////////////////////////////////////////////////////////////////////////////////////// |
| 414 |
// Log calls to Qt tools; used in QtWorkPrepare to detect changes to the options of Qt tools |
| 415 |
// --> |
| 416 |
<WriteLinesToFile Condition="'@(QtWorkLog)' != '' AND '$(DesignTimeBuild)' != 'true'" |
| 417 |
File="$(QtLogFilePath)" |
| 418 |
Lines="@(QtWorkLog->'%(Identity)|%(Hash)')" |
| 419 |
Overwrite="true" Encoding="Unicode"/> |
| 420 |
|
| 421 |
<!-- |
| 422 |
/////////////////////////////////////////////////////////////////////////////////////////////// |
| 423 |
// Generate build error if a Qt tool did not terminate correctly |
| 424 |
// --> |
| 425 |
<Error |
| 426 |
Condition="'%(QtWorkResult.ExitCode)' != '' |
| 427 |
AND '%(QtWorkResult.ExitCode)' != '0' |
| 428 |
AND '$(DesignTimeBuild)' != 'true'" |
| 429 |
File="%(QtWorkResult.Identity)" Code="%(QtWorkResult.ExitCode)" |
| 430 |
Text="%(QtWorkResult.WorkType) (%(QtWorkResult.ToolPath))"/> |
| 431 |
|
| 432 |
<!-- |
| 433 |
/////////////////////////////////////////////////////////////////////////////////////////////// |
| 434 |
// Add dynamic C++ sources to build |
| 435 |
// --> |
| 436 |
<ItemGroup> |
| 437 |
<QtWork_ClCompile |
| 438 |
Condition="'%(QtWorkResult.ExitCode)' == '0' AND '%(QtWorkResult.ClCompile)' != ''" |
| 439 |
Include="@(QtWorkResult->'%(ClCompile)')"/> |
| 440 |
<QtWork_ClCompile |
| 441 |
Condition="Exists('$(QtVarsOutputDir)\qtvars_plugin_import.cpp')" |
| 442 |
Include="$(QtVarsOutputDir)\qtvars_plugin_import.cpp"/> |
| 443 |
</ItemGroup> |
| 444 |
<ItemGroup Condition="'$(ApplicationType)' == 'Linux'"> |
| 445 |
<QtWork_ClCompile Condition="'%(QtWork_ClCompile.ObjectFileName)' == ''"> |
| 446 |
<ObjectFileName>$(IntDir)%(Filename).o</ObjectFileName> |
| 447 |
</QtWork_ClCompile> |
| 448 |
</ItemGroup> |
| 449 |
|
| 450 |
<!-- // Copy default C++ compiler properties --> |
| 451 |
<Expand Condition="'@(QtWork_ClCompile)' != ''" |
| 452 |
Items="@(QtWork_ClCompile)" |
| 453 |
BaseItem="@(ClCompile->WithMetadataValue('Identity', 'DefaultClCompile'))"> |
| 454 |
<Output TaskParameter="Result" ItemName="QtWork_ClCompile_Expanded"/> |
| 455 |
</Expand> |
| 456 |
|
| 457 |
<!-- // Force pre-compiled header include --> |
| 458 |
<ItemGroup Condition="'$(ApplicationType)' != 'Linux'"> |
| 459 |
<QtWork_ClCompile_Expanded> |
| 460 |
<AdditionalIncludeDirectories |
| 461 |
>$(ProjectDir);%(AdditionalIncludeDirectories)</AdditionalIncludeDirectories> |
| 462 |
<ForcedIncludeFiles Condition="'%(PrecompiledHeader)' == 'Use'" |
| 463 |
>%(PrecompiledHeaderFile)</ForcedIncludeFiles> |
| 464 |
</QtWork_ClCompile_Expanded> |
| 465 |
</ItemGroup> |
| 466 |
|
| 467 |
<!-- // Add C++ source items and clean-up temp items --> |
| 468 |
<ItemGroup> |
| 469 |
<ClCompile Include="@(QtWork_ClCompile_Expanded)"/> |
| 470 |
<QtWork_ClCompile_Expanded Remove="@(QtWork_ClCompile_Expanded)"/> |
| 471 |
<QtWork_ClCompile Remove="@(QtWork_ClCompile)"/> |
| 472 |
</ItemGroup> |
| 473 |
|
| 474 |
<!--// If sources were manually selected (e.g. by the 'Compile' option in the context menu for |
| 475 |
// project items), add generated C++ sources to the list of selected files --> |
| 476 |
<PropertyGroup Condition="'$(SelectedFiles)' != ''"> |
| 477 |
<SelectedClCompile>@(QtWorkResult->'%(ClCompile)')</SelectedClCompile> |
| 478 |
</PropertyGroup> |
| 479 |
<PropertyGroup Condition="'$(SelectedClCompile)' != ''"> |
| 480 |
<SelectedFiles>$(SelectedFiles);$(SelectedClCompile)</SelectedFiles> |
| 481 |
</PropertyGroup> |
| 482 |
<ItemGroup Condition="'$(SelectedClCompile)' != ''"> |
| 483 |
<SelectedFiles Include="$(SelectedClCompile)"/> |
| 484 |
</ItemGroup> |
| 485 |
|
| 486 |
<!-- |
| 487 |
/////////////////////////////////////////////////////////////////////////////////////////////// |
| 488 |
// Update C++ sources with generated information |
| 489 |
// --> |
| 490 |
<PropertyGroup> |
| 491 |
<QtIncludePath>@(QtIncludePath->Distinct())</QtIncludePath> |
| 492 |
</PropertyGroup> |
| 493 |
<ItemGroup> |
| 494 |
<ClCompile_Updated Include="@(ClCompile)"> |
| 495 |
<AdditionalIncludeDirectories |
| 496 |
>$(QtIncludePath);%(ClCompile.AdditionalIncludeDirectories)</AdditionalIncludeDirectories> |
| 497 |
</ClCompile_Updated> |
| 498 |
<ClCompile Remove="@(ClCompile)"/> |
| 499 |
<ClCompile Include="@(ClCompile_Updated)"/> |
| 500 |
<ClCompile_Updated Remove="@(ClCompile_Updated)"/> |
| 501 |
</ItemGroup> |
| 502 |
|
| 503 |
<!-- |
| 504 |
/////////////////////////////////////////////////////////////////////////////////////////////// |
| 505 |
// Clean-up |
| 506 |
// --> |
| 507 |
<ItemGroup> |
| 508 |
<QtWork Remove="@(QtWork)"/> |
| 509 |
<QtWorkResult Remove="@(QtWorkResult)"/> |
| 510 |
<QtWorkLog Remove="@(QtWorkLog)"/> |
| 511 |
<read_log Remove="@(read_log)"/> |
| 512 |
<write_log Remove="@(write_log)"/> |
| 513 |
<clean_log Remove="@(clean_log)"/> |
| 514 |
</ItemGroup> |
| 515 |
</Target> |
| 516 |
|
| 517 |
<!-- |
| 518 |
///////////////////////////////////////////////////////////////////////////////////////////////// |
| 519 |
/// TARGET Qt |
| 520 |
///////////////////////////////////////////////////////////////////////////////////////////////// |
| 521 |
// Root Qt target |
| 522 |
// --> |
| 523 |
<Target Name="Qt" DependsOnTargets="QtPrepare;QtWork" BeforeTargets="FixupCLCompileOptions"> |
| 524 |
<ItemGroup> |
| 525 |
<ClCompile Remove="DefaultClCompile" /> |
| 526 |
</ItemGroup> |
| 527 |
</Target> |
| 528 |
|
| 529 |
<!-- |
| 530 |
///////////////////////////////////////////////////////////////////////////////////////////////// |
| 531 |
/// TARGET QtOuterBuild |
| 532 |
///////////////////////////////////////////////////////////////////////////////////////////////// |
| 533 |
// Run targets in $(QtOuterBuildDependsOn) and then recursively invoke build |
| 534 |
// --> |
| 535 |
<Target Name="QtOuterBuild" DependsOnTargets="$(QtOuterBuildDependsOn)"> |
| 536 |
<!--// Invoke inner build: recursive build in second MSBuild instance --> |
| 537 |
<MSBuild |
| 538 |
Projects="$(MSBuildProjectFullPath)" |
| 539 |
Targets="Build" |
| 540 |
Properties="QtInnerBuild=$(MSBuildProjectFullPath);RandomFileName=$(RandomFileName)"> |
| 541 |
</MSBuild> |
| 542 |
</Target> |
| 543 |
|
| 544 |
<PropertyGroup |
| 545 |
Condition="'$(QtInnerBuild)' == '' AND '$(DesignTimeBuild)' != 'true'"> |
| 546 |
<!--// Outer build: invoke inner build --> |
| 547 |
<BuildDependsOn>$(QtOuterBuildPrepare);QtOuterBuild;$(QtOuterBuildFinalize)</BuildDependsOn> |
| 548 |
<QtInnerBuild>$(MSBuildProjectFullPath)</QtInnerBuild> |
| 549 |
<RandomFileName>$([System.IO.Path]::GetRandomFileName())</RandomFileName> |
| 550 |
</PropertyGroup> |
| 551 |
|
| 552 |
<PropertyGroup |
| 553 |
Condition="'$(QtInnerBuild)' != '$(MSBuildProjectFullPath)' AND '$(DesignTimeBuild)' != 'true'"> |
| 554 |
<!--// Dependent project inner build: skip build --> |
| 555 |
<BuildDependsOn>$(QtOuterBuildPrepare);$(QtOuterBuildFinalize)</BuildDependsOn> |
| 556 |
</PropertyGroup> |
| 557 |
|
| 558 |
</Project> |