clean up of README about deprecated option, invert logic of vcpkg flag in build.ps1 for improved clarity

This commit is contained in:
Stefano Sinigardi 2019-06-13 06:54:54 +02:00
parent b78db932cd
commit c0a9c741c3
2 changed files with 11 additions and 12 deletions

View File

@ -197,9 +197,7 @@ PS \> cd $env:VCPKG_ROOT
PS Code\vcpkg> .\vcpkg install pthreads opencv[ffmpeg] #replace with opencv[cuda,ffmpeg] in case you want to use cuda-accelerated openCV PS Code\vcpkg> .\vcpkg install pthreads opencv[ffmpeg] #replace with opencv[cuda,ffmpeg] in case you want to use cuda-accelerated openCV
``` ```
8. [necessary only with CUDA] Customize the `build.ps1` script enabling the appropriate `my_cuda_compute_model` line. If not manually defined, CMake toolchain will automatically use the very low 3.0 CUDA compute model 8. Open Powershell, go to the `darknet` folder and build with the command `.\build.ps1`. If you want to use Visual Studio, you will find two custom solutions created for you by CMake after the build, one in `build_win_debug` and the other in `build_win_release`, containing all the appropriate config flags for your system.
9. Open Powershell, go to the `darknet` folder and build with the command `.\build.ps1`. If you want to use Visual Studio, you will find two custom solutions created for you by CMake after the build, one in `build_win_debug` and the other in `build_win_release`, containing all the appropriate config flags for your system.
### How to compile on Windows (legacy way) ### How to compile on Windows (legacy way)

View File

@ -1,7 +1,7 @@
#!/usr/bin/env pwsh #!/usr/bin/env pwsh
$number_of_build_workers=8 $number_of_build_workers=8
$force_using_include_libs=$false $use_vcpkg=$true
function getProgramFiles32bit() { function getProgramFiles32bit() {
$out = ${env:PROGRAMFILES(X86)} $out = ${env:PROGRAMFILES(X86)}
@ -72,27 +72,27 @@ function getLatestVisualStudioWithDesktopWorkloadVersion() {
} }
if ((Test-Path env:VCPKG_ROOT) -and -not $force_using_include_libs) { if ((Test-Path env:VCPKG_ROOT) -and $use_vcpkg) {
$vcpkg_path = "$env:VCPKG_ROOT" $vcpkg_path = "$env:VCPKG_ROOT"
Write-Host "Found vcpkg in VCPKG_ROOT: $vcpkg_path" Write-Host "Found vcpkg in VCPKG_ROOT: $vcpkg_path"
} }
elseif ((Test-Path "${env:WORKSPACE}\vcpkg") -and -not $force_using_include_libs) { elseif ((Test-Path "${env:WORKSPACE}\vcpkg") -and $use_vcpkg) {
$vcpkg_path = "${env:WORKSPACE}\vcpkg" $vcpkg_path = "${env:WORKSPACE}\vcpkg"
Write-Host "Found vcpkg in WORKSPACE\vcpkg: $vcpkg_path" Write-Host "Found vcpkg in WORKSPACE\vcpkg: $vcpkg_path"
} }
else { else {
Write-Host "Skipping vcpkg-enabled builds because the VCPKG_ROOT environment variable is not defined, using self-distributed libs`n" -ForegroundColor Yellow Write-Host "Skipping vcpkg-enabled builds because the VCPKG_ROOT environment variable is not defined or you requested to avoid VCPKG, using self-distributed libs`n" -ForegroundColor Yellow
} }
if ($null -eq $env:VCPKG_DEFAULT_TRIPLET) { if ($null -eq $env:VCPKG_DEFAULT_TRIPLET -and $use_vcpkg) {
Write-Host "No default triplet has been set-up for vcpkg. Defaulting to x64-windows" -ForegroundColor Yellow Write-Host "No default triplet has been set-up for vcpkg. Defaulting to x64-windows" -ForegroundColor Yellow
$vcpkg_triplet = "x64-windows" $vcpkg_triplet = "x64-windows"
} }
else { elseif ($use_vcpkg) {
$vcpkg_triplet = $env:VCPKG_DEFAULT_TRIPLET $vcpkg_triplet = $env:VCPKG_DEFAULT_TRIPLET
} }
if ($vcpkg_triplet -Match "x86") { if ($vcpkg_triplet -Match "x86" -and $use_vcpkg) {
Throw "darknet is supported only in x64 builds!" Throw "darknet is supported only in x64 builds!"
} }
@ -144,7 +144,7 @@ if (Test-Path env:CUDA_PATH) {
} }
if ($vcpkg_path) { if ($use_vcpkg) {
## DEBUG ## DEBUG
#New-Item -Path .\build_win_debug -ItemType directory -Force #New-Item -Path .\build_win_debug -ItemType directory -Force
#Set-Location build_win_debug #Set-Location build_win_debug
@ -153,6 +153,7 @@ if ($vcpkg_path) {
##cmake --build . --config Debug --parallel ${number_of_build_workers} --target install #valid only for CMake 3.12+ ##cmake --build . --config Debug --parallel ${number_of_build_workers} --target install #valid only for CMake 3.12+
#Remove-Item DarknetConfig.cmake #Remove-Item DarknetConfig.cmake
#Remove-Item DarknetConfigVersion.cmake #Remove-Item DarknetConfigVersion.cmake
#Copy-Item Debug\*.dll ..
#Set-Location .. #Set-Location ..
#Copy-Item cmake\Modules\*.cmake share\darknet\ #Copy-Item cmake\Modules\*.cmake share\darknet\
@ -164,7 +165,7 @@ if ($vcpkg_path) {
#cmake --build . --config Release --parallel ${number_of_build_workers} --target install #valid only for CMake 3.12+ #cmake --build . --config Release --parallel ${number_of_build_workers} --target install #valid only for CMake 3.12+
Remove-Item DarknetConfig.cmake Remove-Item DarknetConfig.cmake
Remove-Item DarknetConfigVersion.cmake Remove-Item DarknetConfigVersion.cmake
Copy-Item *.dll .. Copy-Item Release\*.dll ..
Set-Location .. Set-Location ..
Copy-Item cmake\Modules\*.cmake share\darknet\ Copy-Item cmake\Modules\*.cmake share\darknet\
} }