mirror of
https://github.com/PowerShell/PowerShell
synced 2026-06-08 12:12:50 +00:00
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
This commit is contained in:
committed by
Mike Richmond
parent
069c7a4b6f
commit
011271ca25
+13
-5
@@ -222,9 +222,17 @@ Fix steps:
|
||||
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'
|
||||
}
|
||||
|
||||
$vcVarsPath = (Get-Item(Join-Path -Path "$env:VS140COMNTOOLS" -ChildPath '../../vc')).FullName
|
||||
if ((Test-Path -Path $vcVarsPath\vcvarsall.bat) -eq $false) {
|
||||
throw "Could not find Visual Studio vcvarsall.bat at $vcVarsPath. Please ensure the optional feature 'Common Tools for Visual C++' is installed."
|
||||
$vcPath = (Get-Item(Join-Path -Path "$env:VS140COMNTOOLS" -ChildPath '../../vc')).FullName
|
||||
$atlMfcIncludePath = Join-Path -Path $vcPath -ChildPath 'atlmfc/include'
|
||||
|
||||
# atlbase.h is included in the pwrshplugin project
|
||||
if ((Test-Path -Path $atlMfcIncludePath\atlbase.h) -eq $false) {
|
||||
throw "Could not find Visual Studio include file atlbase.h at $atlMfcIncludePath. Please ensure the optional feature 'Microsoft Foundation Classes for C++' is installed."
|
||||
}
|
||||
|
||||
# vcvarsall.bat is used to setup environment variables
|
||||
if ((Test-Path -Path $vcPath\vcvarsall.bat) -eq $false) {
|
||||
throw "Could not find Visual Studio vcvarsall.bat at $vcPath. Please ensure the optional feature 'Common Tools for Visual C++' is installed."
|
||||
}
|
||||
|
||||
# setup msbuild configuration
|
||||
@@ -358,7 +366,7 @@ Fix steps:
|
||||
$nativeResourcesFolder = $_
|
||||
Get-ChildItem $nativeResourcesFolder -Filter "*.mc" | % {
|
||||
$command = @"
|
||||
cmd.exe /C cd /d "$currentLocation" "&" "$($vcVarsPath)\vcvarsall.bat" "$NativeHostArch" "&" mc.exe -o -d -c -U "$($_.FullName)" -h "$nativeResourcesFolder" -r "$nativeResourcesFolder"
|
||||
cmd.exe /C cd /d "$currentLocation" "&" "$($vcPath)\vcvarsall.bat" "$NativeHostArch" "&" mc.exe -o -d -c -U "$($_.FullName)" -h "$nativeResourcesFolder" -r "$nativeResourcesFolder"
|
||||
"@
|
||||
log " Executing mc.exe Command: $command"
|
||||
Start-NativeExecution { Invoke-Expression -Command:$command 2>&1 }
|
||||
@@ -381,7 +389,7 @@ cmd.exe /C cd /d "$currentLocation" "&" "$($vcVarsPath)\vcvarsall.bat" "$NativeH
|
||||
$location = Get-Location
|
||||
|
||||
$command = @"
|
||||
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"
|
||||
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"
|
||||
"@
|
||||
log " Executing Build Command: $command"
|
||||
Start-NativeExecution { Invoke-Expression -Command:$command }
|
||||
|
||||
Reference in New Issue
Block a user