qt_globals.targets 22 KB

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