-
-
Notifications
You must be signed in to change notification settings - Fork 0
Expand file tree
/
Copy pathDirectory.Build.targets
More file actions
65 lines (56 loc) · 3.17 KB
/
Copy pathDirectory.Build.targets
File metadata and controls
65 lines (56 loc) · 3.17 KB
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
<Project>
<!--
Fix: The WDK MessageCompile task does not honour KernelModeTypes=true.
It omits the -km flag regardless of SDK version, producing a 40-line
bare EVENT_DESCRIPTOR header instead of the 961-line kernel-mode wrapper
macro header that src/IntelAvbFilter.h must contain.
This target re-runs mc.exe with -km AFTER MessageCompile (which may have
generated the wrong header) and BEFORE ClCompile (which needs the macros).
TargetPlatformVersion is set to 10.0.22621.0 by Build-Driver.ps1.
Fixes CI: GitHub-hosted runners have SDK 10.0.26100.0 as default but the
install-wdk action installs 10.0.22621.0. Build-Driver.ps1 passes
/p:TargetPlatformVersion and /p:WindowsSdkVerBinPath to pin mc.exe.
-->
<Target Name="FixEtwKernelModeHeader"
AfterTargets="MessageCompile"
BeforeTargets="ClCompile">
<PropertyGroup>
<!-- Derive mc.exe from TargetPlatformVersion (same SDK as headers/libs). -->
<_KitsBase>C:\Program Files (x86)\Windows Kits\10</_KitsBase>
<_FixMcExe>$(_KitsBase)\bin\$(TargetPlatformVersion)\x64\mc.exe</_FixMcExe>
<!-- Fall back to x86 if x64 mc.exe is absent. -->
<_FixMcExe Condition="!Exists('$(_FixMcExe)')">$(_KitsBase)\bin\$(TargetPlatformVersion)\x86\mc.exe</_FixMcExe>
<!-- Absolute skip if we cannot find ANY mc.exe - diagnostics will catch it. -->
<_SkipFixEtw Condition="!Exists('$(_FixMcExe)')">true</_SkipFixEtw>
</PropertyGroup>
<Message Text="[FixEtwKernelModeHeader] mc.exe = $(_FixMcExe)" Importance="high" />
<Exec Condition="'$(_SkipFixEtw)' != 'true'"
Command=""$(_FixMcExe)" -km -h "$(MSBuildProjectDirectory)\src" -r "$(MSBuildProjectDirectory)\src" -z IntelAvbFilter "$(MSBuildProjectDirectory)\src\IntelAvbFilter.man"" />
<Warning Condition="'$(_SkipFixEtw)' == 'true'"
Text="[FixEtwKernelModeHeader] mc.exe not found for SDK $(TargetPlatformVersion) - ETW header may be incorrect" />
</Target>
<!--
Fix: FilesToPackage items in the vcxproj are hardcoded to
"build\x64\Debug\IntelAvbFilter\..." regardless of $(Configuration).
Introduced in commit 202ac68: "$(OutDir)"-based items were changed to
an absolute local-machine path (D:\Repos\...) and then to a relative
path still locked to the Debug folder. When building Release the
Debug path does not exist, causing MSB3030 in WindowsDriver.common.targets.
This ItemGroup runs at import time (after the vcxproj ItemGroups) and:
1. Removes the hardcoded Debug-only items.
2. Adds configuration-correct $(OutDir)-based replacements so that
both Debug and Release builds package the right files.
-->
<ItemGroup>
<FilesToPackage Remove="build\x64\Debug\IntelAvbFilter\IntelAvbFilter.inf" />
<FilesToPackage Remove="build\x64\Debug\IntelAvbFilter\IntelAvbFilter.sys" />
<FilesToPackage Include="$(OutDir)IntelAvbFilter.inf">
<PackageRelativeDirectory>
</PackageRelativeDirectory>
</FilesToPackage>
<FilesToPackage Include="$(OutDir)IntelAvbFilter.sys">
<PackageRelativeDirectory>
</PackageRelativeDirectory>
</FilesToPackage>
</ItemGroup>
</Project>