mirror of https://github.com/AlexeyAB/darknet.git
[build.ps1] fix 64bit build with developer powershell for VS19 (#7740)
* [build.ps1] use x64 also on developer powershell for VS * improve handling of errors on windows platform * [build.ps1] bump version * improve logic handling in uselib_track
This commit is contained in:
parent
ac8ebca063
commit
5853e51d60
|
@ -237,17 +237,19 @@ set(CMAKE_CXX_FLAGS "${ADDITIONAL_CXX_FLAGS} ${SHAREDLIB_CXX_FLAGS} ${CMAKE_CXX_
|
|||
set(CMAKE_C_FLAGS "${ADDITIONAL_C_FLAGS} ${SHAREDLIB_C_FLAGS} ${CMAKE_C_FLAGS}")
|
||||
|
||||
if(OpenCV_FOUND)
|
||||
if(ENABLE_CUDA AND NOT OpenCV_CUDA_VERSION)
|
||||
set(BUILD_USELIB_TRACK "FALSE" CACHE BOOL "Build uselib_track" FORCE)
|
||||
message(STATUS " -> darknet is fine for now, but uselib_track has been disabled!")
|
||||
message(STATUS " -> Please rebuild OpenCV from sources with CUDA support to enable it")
|
||||
elseif(ENABLE_CUDA AND OpenCV_CUDA_VERSION)
|
||||
if(ENABLE_CUDA AND OpenCV_CUDA_VERSION)
|
||||
if(TARGET opencv_cudaoptflow)
|
||||
list(APPEND OpenCV_LINKED_COMPONENTS "opencv_cudaoptflow")
|
||||
endif()
|
||||
if(TARGET opencv_cudaimgproc)
|
||||
list(APPEND OpenCV_LINKED_COMPONENTS "opencv_cudaimgproc")
|
||||
endif()
|
||||
elseif(ENABLE_CUDA AND NOT OpenCV_CUDA_VERSION)
|
||||
set(BUILD_USELIB_TRACK "FALSE" CACHE BOOL "Build uselib_track" FORCE)
|
||||
message(STATUS " -> darknet is fine for now, but uselib_track has been disabled!")
|
||||
message(STATUS " -> Please rebuild OpenCV from sources with CUDA support to enable it")
|
||||
else()
|
||||
set(BUILD_USELIB_TRACK "FALSE" CACHE BOOL "Build uselib_track" FORCE)
|
||||
endif()
|
||||
endif()
|
||||
|
||||
|
|
16
build.ps1
16
build.ps1
|
@ -22,7 +22,7 @@ param (
|
|||
[string]$AdditionalBuildSetup = "" # "-DCMAKE_CUDA_ARCHITECTURES=30"
|
||||
)
|
||||
|
||||
$build_ps1_version = "0.9.2"
|
||||
$build_ps1_version = "0.9.3"
|
||||
|
||||
Function MyThrow ($Message) {
|
||||
if ($DisableInteractive) {
|
||||
|
@ -252,7 +252,7 @@ else {
|
|||
|
||||
Push-Location $PSScriptRoot
|
||||
|
||||
$GIT_EXE = Get-Command git 2> $null | Select-Object -ExpandProperty Definition
|
||||
$GIT_EXE = Get-Command "git" -ErrorAction SilentlyContinue | Select-Object -ExpandProperty Definition
|
||||
if (-Not $GIT_EXE) {
|
||||
MyThrow("Could not find git, please install it")
|
||||
}
|
||||
|
@ -277,7 +277,7 @@ if (Test-Path "$PSScriptRoot/.git") {
|
|||
}
|
||||
}
|
||||
|
||||
$CMAKE_EXE = Get-Command cmake 2> $null | Select-Object -ExpandProperty Definition
|
||||
$CMAKE_EXE = Get-Command "cmake" -ErrorAction SilentlyContinue | Select-Object -ExpandProperty Definition
|
||||
if (-Not $CMAKE_EXE) {
|
||||
MyThrow("Could not find CMake, please install it")
|
||||
}
|
||||
|
@ -293,11 +293,11 @@ else {
|
|||
}
|
||||
|
||||
if (-Not $DoNotUseNinja) {
|
||||
$NINJA_EXE = Get-Command ninja 2> $null | Select-Object -ExpandProperty Definition
|
||||
$NINJA_EXE = Get-Command "ninja" -ErrorAction SilentlyContinue | Select-Object -ExpandProperty Definition
|
||||
if (-Not $NINJA_EXE) {
|
||||
DownloadNinja
|
||||
$env:PATH += ";${PSScriptRoot}/ninja"
|
||||
$NINJA_EXE = Get-Command ninja 2> $null | Select-Object -ExpandProperty Definition
|
||||
$NINJA_EXE = Get-Command "ninja" -ErrorAction SilentlyContinue | Select-Object -ExpandProperty Definition
|
||||
if (-Not $NINJA_EXE) {
|
||||
$DoNotUseNinja = $true
|
||||
Write-Host "Could not find Ninja, unable to download a portable ninja, using msbuild or make backends as a fallback" -ForegroundColor Yellow
|
||||
|
@ -482,7 +482,8 @@ if ($UseVCPKG -and $ForceVCPKGCacheRemoval) {
|
|||
}
|
||||
|
||||
if (-Not $DoNotSetupVS) {
|
||||
if ($null -eq (Get-Command "cl.exe" -ErrorAction SilentlyContinue)) {
|
||||
$CL_EXE = Get-Command "cl" -ErrorAction SilentlyContinue | Select-Object -ExpandProperty Definition
|
||||
if ((-Not $CL_EXE) -or ($CL_EXE -match "HostX86\\x86") -or ($CL_EXE -match "HostX64\\x86")) {
|
||||
$vsfound = getLatestVisualStudioWithDesktopWorkloadPath
|
||||
Write-Host "Found VS in ${vsfound}"
|
||||
Push-Location "${vsfound}\Common7\Tools"
|
||||
|
@ -528,7 +529,8 @@ if ($DoNotSetupVS -and $DoNotUseNinja) {
|
|||
Write-Host "Setting up environment to use CMake generator: $generator"
|
||||
|
||||
if (-Not $IsMacOS -and $EnableCUDA) {
|
||||
if ($null -eq (Get-Command "nvcc" -ErrorAction SilentlyContinue)) {
|
||||
$NVCC_EXE = Get-Command "nvcc" -ErrorAction SilentlyContinue | Select-Object -ExpandProperty Definition
|
||||
if (-Not $NVCC_EXE) {
|
||||
if (Test-Path env:CUDA_PATH) {
|
||||
$env:PATH += ";${env:CUDA_PATH}/bin"
|
||||
Write-Host "Found cuda in ${env:CUDA_PATH}"
|
||||
|
|
Loading…
Reference in New Issue