2021-02-20 16:28:07 +08:00
|
|
|
#!/usr/bin/env pwsh
|
2019-04-12 16:31:39 +08:00
|
|
|
|
2021-06-04 20:02:07 +08:00
|
|
|
param (
|
|
|
|
[switch]$InstallCUDA = $false
|
|
|
|
)
|
2021-02-19 05:22:39 +08:00
|
|
|
|
2022-07-01 22:46:41 +08:00
|
|
|
Import-Module -Name $PSScriptRoot/utils.psm1 -Force
|
|
|
|
|
2021-02-20 16:28:07 +08:00
|
|
|
if ($null -eq (Get-Command "choco.exe" -ErrorAction SilentlyContinue)) {
|
|
|
|
# Download and install Chocolatey
|
2021-02-19 05:22:39 +08:00
|
|
|
Invoke-Expression ((New-Object System.Net.WebClient).DownloadString('https://chocolatey.org/install.ps1'))
|
2021-04-22 00:25:46 +08:00
|
|
|
Throw "Please close and re-open powershell and then re-run setup.ps1 script"
|
2021-02-19 05:22:39 +08:00
|
|
|
}
|
2021-02-20 16:28:07 +08:00
|
|
|
|
|
|
|
Start-Process -FilePath "choco" -Verb runAs -ArgumentList " install -y cmake ninja powershell git vscode"
|
2022-03-07 06:41:08 +08:00
|
|
|
Start-Process -FilePath "choco" -Verb runAs -ArgumentList " install -y visualstudio2022buildtools --package-parameters `"--add Microsoft.VisualStudio.Component.VC.CoreBuildTools --includeRecommended --includeOptional --passive --locale en-US --lang en-US`""
|
2021-04-22 00:25:46 +08:00
|
|
|
Push-Location $PSScriptRoot
|
2019-04-12 16:31:39 +08:00
|
|
|
|
2021-06-04 20:02:07 +08:00
|
|
|
if ($InstallCUDA) {
|
|
|
|
& $PSScriptRoot/deploy-cuda.ps1
|
2022-07-01 22:46:41 +08:00
|
|
|
$env:CUDA_PATH = "C:\\Program Files\\NVIDIA GPU Computing Toolkit\\CUDA\\v${cuda_version_short}"
|
|
|
|
$env:CUDA_TOOLKIT_ROOT_DIR = "C:\\Program Files\\NVIDIA GPU Computing Toolkit\\CUDA\\v${cuda_version_short}"
|
|
|
|
$env:CUDACXX = "C:\\Program Files\\NVIDIA GPU Computing Toolkit\\CUDA\\v${cuda_version_short}\\bin\\nvcc.exe"
|
2021-06-04 20:02:07 +08:00
|
|
|
$CUDAisAvailable = $true
|
2019-04-12 16:31:39 +08:00
|
|
|
}
|
|
|
|
else {
|
2021-02-19 05:22:39 +08:00
|
|
|
if (-not $null -eq $env:CUDA_PATH) {
|
2021-06-04 20:02:07 +08:00
|
|
|
$CUDAisAvailable = $true
|
2021-02-19 05:22:39 +08:00
|
|
|
}
|
|
|
|
else{
|
2021-06-04 20:02:07 +08:00
|
|
|
$CUDAisAvailable = $false
|
2021-02-19 05:22:39 +08:00
|
|
|
}
|
2019-04-12 16:31:39 +08:00
|
|
|
}
|
|
|
|
|
2021-06-04 20:02:07 +08:00
|
|
|
if ($CUDAisAvailable) {
|
2022-08-17 02:20:48 +08:00
|
|
|
& $PSScriptRoot/../build.ps1 -UseVCPKG -EnableOPENCV -EnableCUDA -DisableInteractive -DoNotUpdateTOOL
|
|
|
|
#& $PSScriptRoot/../build.ps1 -UseVCPKG -EnableOPENCV -EnableCUDA -EnableOPENCV_CUDA -DisableInteractive -DoNotUpdateTOOL
|
2021-06-04 20:02:07 +08:00
|
|
|
}
|
|
|
|
else {
|
2022-08-17 02:20:48 +08:00
|
|
|
& $PSScriptRoot/../build.ps1 -UseVCPKG -EnableOPENCV -DisableInteractive -DoNotUpdateTOOL
|
2021-06-04 20:02:07 +08:00
|
|
|
}
|