|
2 | 2 | <Project ToolsVersion="15.0" xmlns="http://schemas.microsoft.com/developer/msbuild/2003"> |
3 | 3 | <PropertyGroup Label="Globals"> |
4 | 4 | <__PyprojectClangCl_Props_Imported>true</__PyprojectClangCl_Props_Imported> |
5 | | - |
6 | | - <!-- TODO: Py_IntDir is TreatAsLocalProperty. How to get it here? Just redefined atm :( --> |
7 | | - <!-- maybe this will go anyway, since we're going to use $(OutDir)instrumented ... --> |
8 | | - <ClangProfileDir>$(MSBuildThisFileDirectory)obj\$(MajorVersionNumber)$(MinorVersionNumber)$(ArchName)_PGInstrument\__clang_profiles\</ClangProfileDir> |
9 | | - <ClangProfileDir>$(ClangProfileDir.Replace(`\\`, `\`))</ClangProfileDir> |
10 | 5 | </PropertyGroup> |
11 | 6 |
|
| 7 | + <ItemGroup> |
| 8 | + <_profrawFiles Include="$(OutDir)instrumented\$(TargetName)_*.profraw" /> |
| 9 | + </ItemGroup> |
| 10 | + |
| 11 | + <Target Name="EnsureClangProfileData" BeforeTargets="PrepareForBuild" |
| 12 | + Condition="'$(SupportPGO)' and $(Configuration) == 'PGUpdate'"> |
| 13 | + <Error Text="PGO run did not succeed (no $(TargetName)_*.profraw files) and there is no data to merge" |
| 14 | + Condition="$(RequirePGCFiles) == 'true' and @(_profrawFiles) == ''" /> |
| 15 | + </Target> |
| 16 | + |
| 17 | + <Target Name="MergeClangProfileData" BeforeTargets="PrepareForBuild" |
| 18 | + Condition="'$(SupportPGO)' and $(Configuration) == 'PGUpdate'" |
| 19 | + Inputs="@(_profrawFiles)" |
| 20 | + Outputs="@(_profrawFiles->'$(OutDir)instrumented\profdata.profdata')"> |
| 21 | + <Exec |
| 22 | + Command='"$(LLVMInstallDir)\bin\llvm-profdata.exe" merge -output=$(OutDir)instrumented\profdata.profdata $(OutDir)instrumented\*_*.profraw' /> |
| 23 | + </Target> |
| 24 | + |
| 25 | + <Target Name="CleanClangProfileData" BeforeTargets="Clean"> |
| 26 | + <Delete Files="@(_profrawFiles->'$(OutDir)instrumented\%(Filename)%(Extension)')" TreatErrorsAsWarnings="true" /> |
| 27 | + <Delete Files="$(OutDir)instrumented\profdata.profdata" TreatErrorsAsWarnings="true" /> |
| 28 | + </Target> |
| 29 | + |
12 | 30 | <ItemDefinitionGroup> |
13 | 31 | <ClCompile> |
14 | 32 | <AdditionalOptions>-Wno-deprecated-non-prototype -Wno-unused-label -Wno-pointer-sign -Wno-incompatible-pointer-types-discards-qualifiers -Wno-unused-function %(AdditionalOptions)</AdditionalOptions> |
15 | 33 | <AdditionalOptions Condition="$(Configuration) != 'Debug'">-flto %(AdditionalOptions)</AdditionalOptions> |
16 | | - <AdditionalOptions Condition="$(SupportPGO) and $(Configuration) == 'PGInstrument'">-fprofile-instr-generate=$(ClangProfileDir)\default_%m.profraw %(AdditionalOptions)</AdditionalOptions> |
17 | | - <AdditionalOptions Condition="$(SupportPGO) and $(Configuration) == 'PGUpdate'">-fprofile-instr-use=$(ClangProfileDir)\profdata.profdata %(AdditionalOptions)</AdditionalOptions> |
| 34 | + <AdditionalOptions Condition="$(SupportPGO) and $(Configuration) == 'PGInstrument'">-fprofile-instr-generate=$(OutDir)$(TargetName)_%m.profraw %(AdditionalOptions)</AdditionalOptions> |
| 35 | + <AdditionalOptions Condition="$(SupportPGO) and $(Configuration) == 'PGUpdate'">-fprofile-instr-use=$(OutDir)instrumented\profdata.profdata %(AdditionalOptions)</AdditionalOptions> |
18 | 36 | </ClCompile> |
19 | 37 | </ItemDefinitionGroup> |
20 | 38 |
|
|
0 commit comments