Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Fix some issues in windows toolchain script #6

Merged
merged 8 commits into from
Dec 8, 2020
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
2 changes: 2 additions & 0 deletions win/.gitignore
Original file line number Diff line number Diff line change
Expand Up @@ -1647,3 +1647,5 @@ $RECYCLE.BIN/


# End of https://www.gitignore.io/api/c,svn,c++,cvs,vim,tex,java,ninja,xcode,maven,macos,linux,latex,emacs,clion,cmake,matlab,python,csharp,eclipse,android,windows,pycharm,intellij,notepadpp,autotools,mercurial,jetbrains,powershell,objective-c,sublimetext,libreoffice,tortoisegit,visualstudio,microsoftoffice,jupyternotebook,visualstudiocode

!pkgs/env
toothache marked this conversation as resolved.
Show resolved Hide resolved
34 changes: 30 additions & 4 deletions win/pkgs/env/toolchain.ps1
Original file line number Diff line number Diff line change
Expand Up @@ -93,7 +93,7 @@ if (-Not $Env:ROASTER_TOOLCHAIN_COMMITED)

if (${Env:PYTHONHOME} -eq $null -or -not $(Test-Path ${Env:PYTHONHOME}/python.exe -ErrorAction SilentlyContinue))
{
${Env:PYTHONHOME} = Join-Path ${Env:ProgramFiles} Python38
${Env:PYTHONHOME} = Join-Path ${Env:ProgramFiles} Python39
}

if (${Env:PYTHONHOME} -eq $null -or -not $(Test-Path ${Env:PYTHONHOME}/python.exe -ErrorAction SilentlyContinue))
Expand All @@ -105,9 +105,9 @@ if (-Not $Env:ROASTER_TOOLCHAIN_COMMITED)
Invoke-WebRequest -Uri $DownloadURL -OutFile $DownloadPath
Write-Host "Installing Python..."
& $DownloadPath /passive InstallAllUsers=1 PrependPath=1 | Out-Null
if ($(Test-Path ${Env:ProgramFiles}/Python38/python.exe -ErrorAction SilentlyContinue))
if ($(Test-Path ${Env:ProgramFiles}/Python39/python.exe -ErrorAction SilentlyContinue))
{
${Env:PYTHONHOME} = Join-Path ${Env:ProgramFiles} Python38
${Env:PYTHONHOME} = Join-Path ${Env:ProgramFiles} Python39
Write-Host "Python installed successfully."
}
else
Expand Down Expand Up @@ -169,8 +169,34 @@ if (-Not $Env:ROASTER_TOOLCHAIN_COMMITED)

if (${Env:VSCMD_VER} -eq $null)
{
${VS_HOME} = & "${Env:ProgramFiles(x86)}/Microsoft Visual Studio/Installer/vswhere.exe" -latest -property installationPath
${VS_HOME} = & "${Env:ProgramFiles(x86)}/Microsoft Visual Studio/Installer/vswhere.exe" `
-latest `
-products * `
-property installationPath `
-requires Microsoft.VisualStudio.Component.VC.Tools.x86.x64

$vcvars_script = "${VS_HOME}/VC/Auxiliary/Build/vcvarsall.bat"
if (-Not (Test-Path $vcvars_script))
{
Write-Host "Unable to locate Visual Studio command file: vcvarsall.bat. This is required for VC env import."
Exit 1
}

Invoke-Expression $($(cmd /c "`"${VS_HOME}/VC/Auxiliary/Build/vcvarsall.bat`" x64 10.0.16299.0 & set") -Match '^.+=' -Replace '^','${Env:' -Replace '=','}="' -Replace '$','"' | Out-String)

if ((${Env:VCToolsVersion} -eq $null) -or -not ${Env:VCToolsVersion}.StartsWith("14.2"))
{
# MSVC internal version numbering
# https://en.wikipedia.org/wiki/Microsoft_Visual_C++
Write-Host "Invalid MSVC version: ${Env:VCToolsVersion}. vc142 is expetced."
Exit 1
}

if ((${Env:WindowsSDKVersion} -eq $null) -or -not ${Env:WindowsSDKVersion}.StartsWith("10.0.16299.0"))
{
Write-Host "Invalid WinSDK version: ${Env:WindowsSDKVersion}, 10.0.16299.0 (Redstone3) is expetced."
Exit 1
}
}
}

Expand Down