Skip to content

Commit 642ee28

Browse files
Improve Windows Kits detection and project includes
Added automatic detection of Windows Kits version and SDK directory in the build workflow, passing them to msbuild for driver builds. Removed manual inclusion of wudfwdm.h from the project files to rely on SDK headers, streamlining build configuration and reducing local dependencies.
1 parent 7290cd6 commit 642ee28

File tree

3 files changed

+52
-12
lines changed

3 files changed

+52
-12
lines changed

.github/workflows/build-and-sign-sequential.yml

Lines changed: 50 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -53,6 +53,52 @@ jobs:
5353
5454
choco install innosetup -y
5555
if ($LASTEXITCODE -ne 0) { exit 1 }
56+
57+
- name: Detect Windows Kits version (WDF/UMDF headers)
58+
shell: pwsh
59+
run: |
60+
$kitsRoot = Join-Path ${env:ProgramFiles(x86)} "Windows Kits"
61+
if (-not (Test-Path $kitsRoot)) {
62+
Write-Error "Windows Kits root not found: $kitsRoot"
63+
exit 1
64+
}
65+
66+
$includeRoots =
67+
Get-ChildItem -Path $kitsRoot -Directory |
68+
ForEach-Object { Join-Path $_.FullName "Include" } |
69+
Where-Object { Test-Path $_ }
70+
71+
if (-not $includeRoots -or $includeRoots.Count -eq 0) {
72+
Write-Error "No Windows Kits Include directories found under: $kitsRoot"
73+
exit 1
74+
}
75+
76+
$candidates = foreach ($includeRoot in $includeRoots) {
77+
Get-ChildItem -Path $includeRoot -Directory -ErrorAction SilentlyContinue |
78+
Where-Object { Test-Path (Join-Path $_.FullName "wdf\umdf\wudfwdm.h") } |
79+
ForEach-Object {
80+
[PSCustomObject]@{
81+
Version = $_.Name
82+
IncludeRoot = $includeRoot
83+
}
84+
}
85+
}
86+
87+
$best = $candidates | Sort-Object -Property Version -Descending | Select-Object -First 1
88+
$kitVersion = $best.Version
89+
90+
if (-not $kitVersion) {
91+
Write-Error "Could not find any Windows Kits version containing wdf\umdf\wudfwdm.h under: $kitsRoot"
92+
Write-Output "Discovered Include roots:"
93+
$includeRoots | ForEach-Object { Write-Output ("- " + $_) }
94+
exit 1
95+
}
96+
97+
$windowsSdkDir = (Split-Path $best.IncludeRoot -Parent) + "\"
98+
Write-Output "Using WindowsTargetPlatformVersion: $kitVersion"
99+
Write-Output "Using WindowsSdkDir: $windowsSdkDir"
100+
"WINDOWS_TARGET_PLATFORM_VERSION=$kitVersion" | Out-File -FilePath $env:GITHUB_ENV -Encoding utf8 -Append
101+
"WINDOWS_SDK_DIR=$windowsSdkDir" | Out-File -FilePath $env:GITHUB_ENV -Encoding utf8 -Append
56102
57103
- name: Setup .NET
58104
uses: actions/setup-dotnet@v4
@@ -71,7 +117,7 @@ jobs:
71117
$vddSln = "Virtual Display Driver (HDR)/MTTVDD.sln"
72118
if (Test-Path $vddSln) {
73119
Write-Output "Found VDD solution: $vddSln"
74-
msbuild $vddSln /p:Configuration=$env:BUILD_CONFIGURATION /p:Platform=ARM64 /verbosity:minimal
120+
msbuild $vddSln /p:Configuration=$env:BUILD_CONFIGURATION /p:Platform=ARM64 /p:WindowsSdkDir=$env:WINDOWS_SDK_DIR /p:WindowsTargetPlatformVersion=$env:WINDOWS_TARGET_PLATFORM_VERSION /verbosity:minimal
75121
if ($LASTEXITCODE -eq 0) {
76122
Write-Output "✅ ARM64 VDD build completed successfully"
77123
@@ -105,7 +151,7 @@ jobs:
105151
Write-Output "Building ARM64 VAD with validation disabled..."
106152
107153
# Build with validation disabled to avoid x86 tool conflicts with ARM64 outputs
108-
msbuild $vadSln /p:Configuration=$env:BUILD_CONFIGURATION /p:Platform=ARM64 /p:EnableInfVerif=false /p:RunApiValidator=false /verbosity:minimal
154+
msbuild $vadSln /p:Configuration=$env:BUILD_CONFIGURATION /p:Platform=ARM64 /p:WindowsSdkDir=$env:WINDOWS_SDK_DIR /p:WindowsTargetPlatformVersion=$env:WINDOWS_TARGET_PLATFORM_VERSION /p:EnableInfVerif=false /p:RunApiValidator=false /verbosity:minimal
109155
110156
if ($LASTEXITCODE -eq 0) {
111157
Write-Output "✅ ARM64 VAD build completed successfully!"
@@ -133,7 +179,7 @@ jobs:
133179
$vddSln = "Virtual Display Driver (HDR)/MTTVDD.sln"
134180
if (Test-Path $vddSln) {
135181
Write-Output "Found VDD solution: $vddSln"
136-
msbuild $vddSln /p:Configuration=$env:BUILD_CONFIGURATION /p:Platform=x64 /verbosity:minimal
182+
msbuild $vddSln /p:Configuration=$env:BUILD_CONFIGURATION /p:Platform=x64 /p:WindowsSdkDir=$env:WINDOWS_SDK_DIR /p:WindowsTargetPlatformVersion=$env:WINDOWS_TARGET_PLATFORM_VERSION /verbosity:minimal
137183
if ($LASTEXITCODE -eq 0) {
138184
Write-Output "✅ x64 VDD build completed successfully"
139185
@@ -162,7 +208,7 @@ jobs:
162208
$vadSln = "Virtual-Audio-Driver (Latest Stable)/VirtualAudioDriver.sln"
163209
if (Test-Path $vadSln) {
164210
Write-Output "Found VAD solution: $vadSln"
165-
msbuild $vadSln /p:Configuration=$env:BUILD_CONFIGURATION /p:Platform=x64 /verbosity:minimal
211+
msbuild $vadSln /p:Configuration=$env:BUILD_CONFIGURATION /p:Platform=x64 /p:WindowsSdkDir=$env:WINDOWS_SDK_DIR /p:WindowsTargetPlatformVersion=$env:WINDOWS_TARGET_PLATFORM_VERSION /verbosity:minimal
166212
if ($LASTEXITCODE -eq 0) {
167213
Write-Output "✅ x64 VAD build completed successfully"
168214

Virtual Display Driver (HDR)/MttVDD/MttVDD.vcxproj

Lines changed: 1 addition & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -1,4 +1,4 @@
1-
<?xml version="1.0" encoding="utf-8"?>
1+
<?xml version="1.0" encoding="utf-8"?>
22
<Project DefaultTargets="Build" xmlns="http://schemas.microsoft.com/developer/msbuild/2003">
33
<ItemGroup Label="ProjectConfigurations">
44
<ProjectConfiguration Include="Debug|Win32">
@@ -38,9 +38,6 @@
3838
<ClCompile Include="Driver.cpp" />
3939
</ItemGroup>
4040
<ItemGroup>
41-
<ClInclude Include="..\..\..\..\Downloads\wudfwdm.h">
42-
<DeploymentContent>true</DeploymentContent>
43-
</ClInclude>
4441
<ClInclude Include="Driver.h" />
4542
<ClInclude Include="Trace.h" />
4643
</ItemGroup>

Virtual Display Driver (HDR)/MttVDD/MttVDD.vcxproj.filters

Lines changed: 1 addition & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -1,4 +1,4 @@
1-
<?xml version="1.0" encoding="utf-8"?>
1+
<?xml version="1.0" encoding="utf-8"?>
22
<Project ToolsVersion="4.0" xmlns="http://schemas.microsoft.com/developer/msbuild/2003">
33
<ItemGroup>
44
<Filter Include="Source Files">
@@ -30,9 +30,6 @@
3030
<ClInclude Include="Trace.h">
3131
<Filter>Header Files</Filter>
3232
</ClInclude>
33-
<ClInclude Include="..\..\..\..\Downloads\wudfwdm.h">
34-
<Filter>Header Files</Filter>
35-
</ClInclude>
3633
</ItemGroup>
3734
<ItemGroup>
3835
<ClCompile Include="Driver.cpp">

0 commit comments

Comments
 (0)