mirror of
https://github.com/status-im/status-desktop.git
synced 2025-01-29 15:57:03 +00:00
refactor windows_build_setup.ps1 for easier re-usability
Now You can source the script with .(dot) and use individual functions. This also makes it easier to use in `infra-ci` Ansible roles. Signed-off-by: Jakub Sokołowski <jakub@status.im>
This commit is contained in:
parent
b03e5c72e8
commit
dc14bbe9ec
@ -2,51 +2,55 @@
|
|||||||
# Configures a build envrionment for nim-status-client on windows.
|
# Configures a build envrionment for nim-status-client on windows.
|
||||||
#---------------------------------------------------------------------
|
#---------------------------------------------------------------------
|
||||||
|
|
||||||
# Stop the script after first error
|
# Helpers
|
||||||
$ErrorActionPreference = 'Stop'
|
function Install-Scoop {
|
||||||
|
if ((Get-Command scoop -ErrorAction SilentlyContinue) -ne $null) {
|
||||||
|
Write-Host "Scoop already installed!"
|
||||||
|
} else {
|
||||||
|
Write-Host "Installing Scoop package manager..."
|
||||||
|
Invoke-Expression (New-Object System.Net.WebClient).DownloadString('https://get.scoop.sh')
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
#---------------------------------------------------------------------
|
|
||||||
Write-Host "Installing Scoop package manager..."
|
|
||||||
Invoke-Expression (New-Object System.Net.WebClient).DownloadString('https://get.scoop.sh')
|
|
||||||
|
|
||||||
#---------------------------------------------------------------------
|
|
||||||
# Install Git and other dependencies
|
# Install Git and other dependencies
|
||||||
Write-Host "Installing dependencies..."
|
function Install-Dependencies {
|
||||||
scoop install --global 7zip git fzf dos2unix findutils wget gcc go rcedit cmake python ntop jq
|
Write-Host "Installing dependencies..."
|
||||||
scoop bucket add extras
|
scoop install --global 7zip git dos2unix findutils wget make cmake gcc go rcedit
|
||||||
scoop install --global vcredist2017
|
scoop bucket add extras
|
||||||
|
scoop install --global vcredist2017
|
||||||
|
}
|
||||||
|
|
||||||
#---------------------------------------------------------------------
|
function Install-Qt-SDK {
|
||||||
$QtVersion = "5.14.2"
|
Write-Host "Installing Qt $QtVersion SDK..."
|
||||||
Write-Host "Installing Qt $QtVersion SDK..."
|
pip install aqtinstall
|
||||||
# Install Qt
|
aqt install --output "C:\Qt" $QtVersion windows desktop win64_msvc2017_64
|
||||||
pip install aqtinstall
|
}
|
||||||
aqt install --output "C:\Qt" $QtVersion windows desktop win64_msvc2017_64
|
|
||||||
|
|
||||||
#---------------------------------------------------------------------
|
|
||||||
# Install Microsoft Visual C++ Build Tools 15.8.9
|
# Install Microsoft Visual C++ Build Tools 15.8.9
|
||||||
$VCBuildToolsUrl = "https://download.visualstudio.microsoft.com/download/pr/e286f66e-4366-425f-bcc5-c88627c6e95a/0401d4decb00884a7d50f69732e1d680/vs_buildtools.exe"
|
function Install-VC-BuildTools {
|
||||||
$VCBuildToolsExe = "$HOME\Downloads\vs_BuildTools.exe"
|
$VCBuildToolsUrl = "https://download.visualstudio.microsoft.com/download/pr/e286f66e-4366-425f-bcc5-c88627c6e95a/0401d4decb00884a7d50f69732e1d680/vs_buildtools.exe"
|
||||||
|
$VCBuildToolsExe = "$HOME\Downloads\vs_BuildTools.exe"
|
||||||
|
|
||||||
Write-Host "Downloading Microsoft Visual C++ Build Tools..."
|
Write-Host "Downloading Microsoft Visual C++ Build Tools..."
|
||||||
(New-Object System.Net.WebClient).DownloadFile($VCBuildToolsUrl, $VCBuildToolsExe)
|
(New-Object System.Net.WebClient).DownloadFile($VCBuildToolsUrl, $VCBuildToolsExe)
|
||||||
|
|
||||||
Write-Host "Installing Microsoft Visual C++ Build Tools..."
|
Write-Host "Installing Microsoft Visual C++ Build Tools..."
|
||||||
$VCBuildToolsArgs = $(
|
$VCBuildToolsArgs = $(
|
||||||
"--installPath", "C:\BuildTools",
|
"--installPath", "C:\BuildTools",
|
||||||
"--quiet", "--wait", "--norestart", "--nocache",
|
"--quiet", "--wait", "--norestart", "--nocache",
|
||||||
"--add", "Microsoft.VisualStudio.Workload.MSBuildTools",
|
"--add", "Microsoft.VisualStudio.Workload.MSBuildTools",
|
||||||
"--add", "Microsoft.VisualStudio.Workload.VCTools",
|
"--add", "Microsoft.VisualStudio.Workload.VCTools",
|
||||||
"--add", "Microsoft.VisualStudio.Component.VC.Tools.x86.x64",
|
"--add", "Microsoft.VisualStudio.Component.VC.Tools.x86.x64",
|
||||||
"--add", "Microsoft.VisualStudio.Component.VC.Redist.14.Latest",
|
"--add", "Microsoft.VisualStudio.Component.VC.Redist.14.Latest",
|
||||||
"--add", "Microsoft.VisualStudio.Component.Windows10SDK.14393",
|
"--add", "Microsoft.VisualStudio.Component.Windows10SDK.14393",
|
||||||
"--add", "Microsoft.VisualStudio.Component.Windows81SDK",
|
"--add", "Microsoft.VisualStudio.Component.Windows81SDK",
|
||||||
"--add", "Microsoft.VisualStudio.ComponentGroup.NativeDesktop.Win81"
|
"--add", "Microsoft.VisualStudio.ComponentGroup.NativeDesktop.Win81"
|
||||||
)
|
)
|
||||||
Start-Process -Wait -PassThru -FilePath $VCBuildToolsExe -ArgumentList $VCBuildToolsArgs
|
Start-Process -Wait -PassThru -FilePath $VCBuildToolsExe -ArgumentList $VCBuildToolsArgs
|
||||||
|
}
|
||||||
|
|
||||||
#---------------------------------------------------------------------
|
function Show-Success-Message {
|
||||||
Write-Host @"
|
Write-Host @"
|
||||||
|
|
||||||
SUCCESS!
|
SUCCESS!
|
||||||
|
|
||||||
@ -60,3 +64,22 @@ You might also have to include the following paths in your `$PATH:
|
|||||||
|
|
||||||
export PATH=`"/c/BuildTools/MSBuild/Current/Bin:/c/BuildTools/VC/Tools/MSVC/14.27.29110/bin:`$PATH`"
|
export PATH=`"/c/BuildTools/MSBuild/Current/Bin:/c/BuildTools/VC/Tools/MSVC/14.27.29110/bin:`$PATH`"
|
||||||
"@
|
"@
|
||||||
|
}
|
||||||
|
|
||||||
|
#---------------------------------------------------------------------
|
||||||
|
|
||||||
|
# Stop the script after first error
|
||||||
|
$ErrorActionPreference = 'Stop'
|
||||||
|
# Version of Qt SDK available form aqt
|
||||||
|
$QtVersion = "5.14.2"
|
||||||
|
|
||||||
|
# Don't run when sourcing script
|
||||||
|
If ($MyInvocation.InvocationName -ne ".") {
|
||||||
|
Install-Scoop
|
||||||
|
Install-Dependencies
|
||||||
|
Install-Qt-SDK
|
||||||
|
Install-VC-BuildTools
|
||||||
|
Show-Success-Message
|
||||||
|
}
|
||||||
|
|
||||||
|
#---------------------------------------------------------------------
|
||||||
|
Loading…
x
Reference in New Issue
Block a user