mirror of https://github.com/AlexeyAB/darknet.git
fix regression
This commit is contained in:
parent
15a19c4e83
commit
2c4c96f50c
|
@ -83,7 +83,30 @@ endif()
|
|||
if(ENABLE_OPENCV)
|
||||
find_package(OpenCV)
|
||||
if(OpenCV_FOUND)
|
||||
list(APPEND OpenCV_LINKED_COMPONENTS "opencv_video")
|
||||
if(TARGET opencv_world)
|
||||
list(APPEND OpenCV_LINKED_COMPONENTS "opencv_world")
|
||||
else()
|
||||
if(TARGET opencv_video)
|
||||
list(APPEND OpenCV_LINKED_COMPONENTS "opencv_video")
|
||||
endif()
|
||||
if(OpenCV_VERSION VERSION_LESS "4.0")
|
||||
if(TARGET opencv_videoio)
|
||||
list(APPEND OpenCV_LINKED_COMPONENTS "opencv_videoio")
|
||||
endif()
|
||||
if(TARGET opencv_highgui)
|
||||
list(APPEND OpenCV_LINKED_COMPONENTS "opencv_highgui")
|
||||
endif()
|
||||
if(TARGET opencv_imgproc)
|
||||
list(APPEND OpenCV_LINKED_COMPONENTS "opencv_imgproc")
|
||||
endif()
|
||||
if(TARGET opencv_imgcodecs)
|
||||
list(APPEND OpenCV_LINKED_COMPONENTS "opencv_imgcodecs")
|
||||
endif()
|
||||
if(TARGET opencv_core)
|
||||
list(APPEND OpenCV_LINKED_COMPONENTS "opencv_core")
|
||||
endif()
|
||||
endif()
|
||||
endif()
|
||||
endif()
|
||||
endif()
|
||||
find_package(Stb REQUIRED)
|
||||
|
@ -128,8 +151,13 @@ if(OpenCV_FOUND)
|
|||
set(SKIP_USELIB_TRACK "TRUE" CACHE BOOL "Skip building 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()
|
||||
list(APPEND OpenCV_LINKED_COMPONENTS "opencv_cudaoptflow")
|
||||
elseif(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()
|
||||
endif()
|
||||
endif()
|
||||
|
||||
|
|
|
@ -9,8 +9,6 @@ if(@OpenCV_FOUND@)
|
|||
find_dependency(OpenCV)
|
||||
endif()
|
||||
|
||||
find_dependency(Stb)
|
||||
|
||||
if(@ENABLE_CUDA@)
|
||||
enable_language(CUDA)
|
||||
find_dependency(CUDA)
|
||||
|
|
65
build.ps1
65
build.ps1
|
@ -2,6 +2,7 @@
|
|||
|
||||
$number_of_build_workers=8
|
||||
$use_vcpkg=$true
|
||||
$force_ninja=$true
|
||||
|
||||
function getProgramFiles32bit() {
|
||||
$out = ${env:PROGRAMFILES(X86)}
|
||||
|
@ -112,17 +113,22 @@ if ($null -eq (Get-Command "cl.exe" -ErrorAction SilentlyContinue)) {
|
|||
|
||||
$tokens = getLatestVisualStudioWithDesktopWorkloadVersion
|
||||
$tokens = $tokens.split('.')
|
||||
if ($tokens[0] -eq "14") {
|
||||
$generator = "Visual Studio 14 2015"
|
||||
}
|
||||
elseif ($tokens[0] -eq "15") {
|
||||
$generator = "Visual Studio 15 2017"
|
||||
}
|
||||
elseif ($tokens[0] -eq "16") {
|
||||
$generator = "Visual Studio 16 2019"
|
||||
if($force_ninja) {
|
||||
$generator = "Ninja"
|
||||
}
|
||||
else {
|
||||
throw "Unknown Visual Studio version, unsupported configuration"
|
||||
if ($tokens[0] -eq "14") {
|
||||
$generator = "Visual Studio 14 2015"
|
||||
}
|
||||
elseif ($tokens[0] -eq "15") {
|
||||
$generator = "Visual Studio 15 2017"
|
||||
}
|
||||
elseif ($tokens[0] -eq "16") {
|
||||
$generator = "Visual Studio 16 2019"
|
||||
}
|
||||
else {
|
||||
throw "Unknown Visual Studio version, unsupported configuration"
|
||||
}
|
||||
}
|
||||
Write-Host "Setting up environment to use CMake generator: $generator" -ForegroundColor Yellow
|
||||
|
||||
|
@ -148,24 +154,44 @@ if ($use_vcpkg) {
|
|||
## DEBUG
|
||||
#New-Item -Path .\build_win_debug -ItemType directory -Force
|
||||
#Set-Location build_win_debug
|
||||
#cmake -G "$generator" -T "host=x64" -A "x64" "-DCMAKE_TOOLCHAIN_FILE=$vcpkg_path\scripts\buildsystems\vcpkg.cmake" "-DVCPKG_TARGET_TRIPLET=$vcpkg_triplet" #"-DCMAKE_BUILD_TYPE=Debug" $additional_build_setup ..
|
||||
#if ($force_ninja) {
|
||||
#cmake -G "$generator" "-DCMAKE_TOOLCHAIN_FILE=$vcpkg_path\scripts\buildsystems\vcpkg.cmake" "-DVCPKG_TARGET_TRIPLET=$vcpkg_triplet" #"-DCMAKE_BUILD_TYPE=Debug" $additional_build_setup ..
|
||||
#$dllfolder = "."
|
||||
#}
|
||||
#else {
|
||||
#cmake -G "$generator" -T "host=x64" -A "x64" "-DCMAKE_TOOLCHAIN_FILE=$vcpkg_path\scripts\buildsystems\vcpkg.cmake" "-DVCPKG_TARGET_TRIPLET=$vcpkg_triplet" "-DCMAKE_BUILD_TYPE=Debug" $additional_build_setup ..
|
||||
#$dllfolder = "Debug"
|
||||
#}
|
||||
#cmake --build . --config Debug --target install
|
||||
##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 ..
|
||||
#$dllfiles = Get-ChildItem ${dllfolder}\*.dll
|
||||
#if ($dllfiles) {
|
||||
# Copy-Item $dllfiles ..
|
||||
#}
|
||||
#Set-Location ..
|
||||
#Copy-Item cmake\Modules\*.cmake share\darknet\
|
||||
|
||||
# RELEASE
|
||||
New-Item -Path .\build_win_release -ItemType directory -Force
|
||||
Set-Location build_win_release
|
||||
cmake -G "$generator" -T "host=x64" -A "x64" "-DCMAKE_TOOLCHAIN_FILE=$vcpkg_path\scripts\buildsystems\vcpkg.cmake" "-DVCPKG_TARGET_TRIPLET=$vcpkg_triplet" "-DCMAKE_BUILD_TYPE=Release" $additional_build_setup ..
|
||||
if($force_ninja) {
|
||||
cmake -G "$generator" "-DCMAKE_TOOLCHAIN_FILE=$vcpkg_path\scripts\buildsystems\vcpkg.cmake" "-DVCPKG_TARGET_TRIPLET=$vcpkg_triplet" "-DCMAKE_BUILD_TYPE=Release" $additional_build_setup ..
|
||||
$dllfolder = "."
|
||||
}
|
||||
else {
|
||||
cmake -G "$generator" -T "host=x64" -A "x64" "-DCMAKE_TOOLCHAIN_FILE=$vcpkg_path\scripts\buildsystems\vcpkg.cmake" "-DVCPKG_TARGET_TRIPLET=$vcpkg_triplet" "-DCMAKE_BUILD_TYPE=Release" $additional_build_setup ..
|
||||
$dllfolder = "Release"
|
||||
}
|
||||
cmake --build . --config Release --target install
|
||||
#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 Release\*.dll ..
|
||||
$dllfiles = Get-ChildItem ${dllfolder}\*.dll
|
||||
if ($dllfiles) {
|
||||
Copy-Item $dllfiles ..
|
||||
}
|
||||
Set-Location ..
|
||||
Copy-Item cmake\Modules\*.cmake share\darknet\
|
||||
}
|
||||
|
@ -174,12 +200,21 @@ else {
|
|||
# if you want to manually force this case, remove VCPKG_ROOT env variable and remember to use "vcpkg integrate remove" in case you had enabled user-wide vcpkg integration
|
||||
New-Item -Path .\build_win_release_novcpkg -ItemType directory -Force
|
||||
Set-Location build_win_release_novcpkg
|
||||
cmake -G "$generator" -T "host=x64" -A "x64" $additional_build_setup ..
|
||||
if($force_ninja) {
|
||||
cmake -G "$generator" $additional_build_setup ..
|
||||
}
|
||||
else {
|
||||
cmake -G "$generator" -T "host=x64" -A "x64" $additional_build_setup ..
|
||||
}
|
||||
cmake --build . --config Release --target install
|
||||
#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 ..\3rdparty\pthreads\bin\*.dll ..
|
||||
$dllfolder = "..\3rdparty\pthreads\bin"
|
||||
$dllfiles = Get-ChildItem ${dllfolder}\*.dll
|
||||
if ($dllfiles) {
|
||||
Copy-Item $dllfiles ..
|
||||
}
|
||||
Set-Location ..
|
||||
Copy-Item cmake\Modules\*.cmake share\darknet\
|
||||
}
|
||||
|
|
Loading…
Reference in New Issue