From c0a9c741c34e0ad84e6cbbd4d6617b7fa99b089b Mon Sep 17 00:00:00 2001 From: Stefano Sinigardi Date: Thu, 13 Jun 2019 06:54:54 +0200 Subject: [PATCH] clean up of README about deprecated option, invert logic of vcpkg flag in build.ps1 for improved clarity --- README.md | 4 +--- build.ps1 | 19 ++++++++++--------- 2 files changed, 11 insertions(+), 12 deletions(-) diff --git a/README.md b/README.md index 52df1199..5a5c493c 100644 --- a/README.md +++ b/README.md @@ -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 ``` -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 - -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. +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. ### How to compile on Windows (legacy way) diff --git a/build.ps1 b/build.ps1 index b36d3054..8030ca99 100755 --- a/build.ps1 +++ b/build.ps1 @@ -1,7 +1,7 @@ #!/usr/bin/env pwsh $number_of_build_workers=8 -$force_using_include_libs=$false +$use_vcpkg=$true function getProgramFiles32bit() { $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" 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" Write-Host "Found vcpkg in WORKSPACE\vcpkg: $vcpkg_path" } 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 $vcpkg_triplet = "x64-windows" } -else { +elseif ($use_vcpkg) { $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!" } @@ -144,7 +144,7 @@ if (Test-Path env:CUDA_PATH) { } -if ($vcpkg_path) { +if ($use_vcpkg) { ## DEBUG #New-Item -Path .\build_win_debug -ItemType directory -Force #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+ #Remove-Item DarknetConfig.cmake #Remove-Item DarknetConfigVersion.cmake + #Copy-Item Debug\*.dll .. #Set-Location .. #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+ Remove-Item DarknetConfig.cmake Remove-Item DarknetConfigVersion.cmake - Copy-Item *.dll .. + Copy-Item Release\*.dll .. Set-Location .. Copy-Item cmake\Modules\*.cmake share\darknet\ }