darknet/scripts/setup.ps1

33 lines
1.2 KiB
PowerShell
Raw Normal View History

2021-02-20 16:28:07 +08:00
#!/usr/bin/env pwsh
2021-02-20 16:28:07 +08:00
$install_cuda = $false
2021-02-20 16:28:07 +08:00
if ($null -eq (Get-Command "choco.exe" -ErrorAction SilentlyContinue)) {
# Download and install Chocolatey
Set-ExecutionPolicy unrestricted -Scope CurrentUser
Invoke-Expression ((New-Object System.Net.WebClient).DownloadString('https://chocolatey.org/install.ps1'))
2021-02-20 16:28:07 +08:00
Write-Host "Please close and re-open powershell and then re-run setup.ps1 script"
Break
}
2021-02-20 16:28:07 +08:00
Start-Process -FilePath "choco" -Verb runAs -ArgumentList " install -y cmake ninja powershell git vscode"
Start-Process -FilePath "choco" -Verb runAs -ArgumentList " install -y visualstudio2019buildtools --package-parameters `"--add Microsoft.VisualStudio.Component.VC.CoreBuildTools --includeRecommended --includeOptional --passive --locale en-US --lang en-US`""
if ($install_cuda) {
2021-02-20 16:28:07 +08:00
Start-Process -FilePath "choco" -Verb runAs -ArgumentList " install -y cuda"
2019-08-22 14:36:01 +08:00
$features = "full"
}
else {
if (-not $null -eq $env:CUDA_PATH) {
$features = "full"
}
else{
$features = "opencv-base,weights,weights-train"
}
}
git.exe clone https://github.com/microsoft/vcpkg
Set-Location vcpkg
.\bootstrap-vcpkg.bat -disableMetrics
2019-08-22 14:36:01 +08:00
.\vcpkg.exe install darknet[${features}]:x64-windows