Skip to content

Commit 011271c

Browse files
KirkMunromirichmo
authored andcommitted
Add Build Check for MFC for Visual C++ During Windows Builds (#4185)
* added requirement check for atlbase.h * removed blank line mistakenly added * updated based on pull request feedback
1 parent 069c7a4 commit 011271c

1 file changed

Lines changed: 13 additions & 5 deletions

File tree

build.psm1

Lines changed: 13 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -222,9 +222,17 @@ Fix steps:
222222
throw 'Win 10 SDK not found. Run Start-PSBootstrap or install Microsoft Windows 10 SDK from https://developer.microsoft.com/en-US/windows/downloads/windows-10-sdk'
223223
}
224224

225-
$vcVarsPath = (Get-Item(Join-Path -Path "$env:VS140COMNTOOLS" -ChildPath '../../vc')).FullName
226-
if ((Test-Path -Path $vcVarsPath\vcvarsall.bat) -eq $false) {
227-
throw "Could not find Visual Studio vcvarsall.bat at $vcVarsPath. Please ensure the optional feature 'Common Tools for Visual C++' is installed."
225+
$vcPath = (Get-Item(Join-Path -Path "$env:VS140COMNTOOLS" -ChildPath '../../vc')).FullName
226+
$atlMfcIncludePath = Join-Path -Path $vcPath -ChildPath 'atlmfc/include'
227+
228+
# atlbase.h is included in the pwrshplugin project
229+
if ((Test-Path -Path $atlMfcIncludePath\atlbase.h) -eq $false) {
230+
throw "Could not find Visual Studio include file atlbase.h at $atlMfcIncludePath. Please ensure the optional feature 'Microsoft Foundation Classes for C++' is installed."
231+
}
232+
233+
# vcvarsall.bat is used to setup environment variables
234+
if ((Test-Path -Path $vcPath\vcvarsall.bat) -eq $false) {
235+
throw "Could not find Visual Studio vcvarsall.bat at $vcPath. Please ensure the optional feature 'Common Tools for Visual C++' is installed."
228236
}
229237

230238
# setup msbuild configuration
@@ -358,7 +366,7 @@ Fix steps:
358366
$nativeResourcesFolder = $_
359367
Get-ChildItem $nativeResourcesFolder -Filter "*.mc" | % {
360368
$command = @"
361-
cmd.exe /C cd /d "$currentLocation" "&" "$($vcVarsPath)\vcvarsall.bat" "$NativeHostArch" "&" mc.exe -o -d -c -U "$($_.FullName)" -h "$nativeResourcesFolder" -r "$nativeResourcesFolder"
369+
cmd.exe /C cd /d "$currentLocation" "&" "$($vcPath)\vcvarsall.bat" "$NativeHostArch" "&" mc.exe -o -d -c -U "$($_.FullName)" -h "$nativeResourcesFolder" -r "$nativeResourcesFolder"
362370
"@
363371
log " Executing mc.exe Command: $command"
364372
Start-NativeExecution { Invoke-Expression -Command:$command 2>&1 }
@@ -381,7 +389,7 @@ cmd.exe /C cd /d "$currentLocation" "&" "$($vcVarsPath)\vcvarsall.bat" "$NativeH
381389
$location = Get-Location
382390

383391
$command = @"
384-
cmd.exe /C cd /d "$location" "&" "$($vcVarsPath)\vcvarsall.bat" "$NativeHostArch" "&" cmake "$overrideFlags" -DBUILD_ONECORE=$OneCoreValue -DBUILD_TARGET_ARCH=$NativeHostArch -G "$cmakeGenerator" . "&" msbuild ALL_BUILD.vcxproj "/p:Configuration=$msbuildConfiguration"
392+
cmd.exe /C cd /d "$location" "&" "$($vcPath)\vcvarsall.bat" "$NativeHostArch" "&" cmake "$overrideFlags" -DBUILD_ONECORE=$OneCoreValue -DBUILD_TARGET_ARCH=$NativeHostArch -G "$cmakeGenerator" . "&" msbuild ALL_BUILD.vcxproj "/p:Configuration=$msbuildConfiguration"
385393
"@
386394
log " Executing Build Command: $command"
387395
Start-NativeExecution { Invoke-Expression -Command:$command }

0 commit comments

Comments
 (0)