add kmeansiou to build targets (#8831)

This commit is contained in:
Stefano Sinigardi 2023-08-25 22:11:50 +02:00 committed by GitHub
parent d47d72cb70
commit f3a50b9aee
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23
3 changed files with 20 additions and 23 deletions

View File

@ -1,8 +1,8 @@
cmake_minimum_required(VERSION 3.19) cmake_minimum_required(VERSION 3.19)
include(CMakeDependentOption) include(CMakeDependentOption)
option(CMAKE_VERBOSE_MAKEFILE "Create verbose makefile" ON) option(CMAKE_VERBOSE_MAKEFILE "Create verbose makefile" OFF)
option(CUDA_VERBOSE_BUILD "Create verbose CUDA build" ON) option(CUDA_VERBOSE_BUILD "Create verbose CUDA build" OFF)
option(BUILD_SHARED_LIBS "Create dark as a shared library" ON) option(BUILD_SHARED_LIBS "Create dark as a shared library" ON)
option(BUILD_AS_CPP "Build Darknet using C++ compiler also for C files" OFF) option(BUILD_AS_CPP "Build Darknet using C++ compiler also for C files" OFF)
option(BUILD_USELIB_TRACK "Build uselib_track" ON) option(BUILD_USELIB_TRACK "Build uselib_track" ON)
@ -12,7 +12,7 @@ option(ENABLE_CUDA "Enable CUDA support" ON)
option(ENABLE_CUDNN "Enable CUDNN" ON) option(ENABLE_CUDNN "Enable CUDNN" ON)
option(ENABLE_CUDNN_HALF "Enable CUDNN Half precision" ON) option(ENABLE_CUDNN_HALF "Enable CUDNN Half precision" ON)
option(ENABLE_ZED_CAMERA "Enable ZED Camera support" ON) option(ENABLE_ZED_CAMERA "Enable ZED Camera support" ON)
option(ENABLE_VCPKG_INTEGRATION "Enable VCPKG integration" ON) option(ENABLE_VCPKG_INTEGRATION "Enable VCPKG integration" OFF)
option(ENABLE_DEPLOY_CUSTOM_CMAKE_MODULES "Copy custom CMake modules for downstream integration" OFF) option(ENABLE_DEPLOY_CUSTOM_CMAKE_MODULES "Copy custom CMake modules for downstream integration" OFF)
option(ENABLE_CSHARP_WRAPPER "Enable building a csharp wrapper" OFF) option(ENABLE_CSHARP_WRAPPER "Enable building a csharp wrapper" OFF)
option(VCPKG_BUILD_OPENCV_WITH_CUDA "Build OpenCV with CUDA extension integration" ON) option(VCPKG_BUILD_OPENCV_WITH_CUDA "Build OpenCV with CUDA extension integration" ON)
@ -169,6 +169,8 @@ set(INSTALL_LIB_DIR "${CMAKE_CURRENT_LIST_DIR}" CACHE PATH "Path where lib
set(INSTALL_INCLUDE_DIR "include/darknet" CACHE PATH "Path where headers will be installed") set(INSTALL_INCLUDE_DIR "include/darknet" CACHE PATH "Path where headers will be installed")
set(INSTALL_CMAKE_DIR "share/darknet" CACHE PATH "Path where cmake configs will be installed") set(INSTALL_CMAKE_DIR "share/darknet" CACHE PATH "Path where cmake configs will be installed")
find_library(MATH_LIBRARY m)
if(ENABLE_CUDA) if(ENABLE_CUDA)
include(CheckLanguage) include(CheckLanguage)
check_language(CUDA) check_language(CUDA)
@ -453,6 +455,11 @@ if(BUILD_AS_CPP)
set_target_properties(darknet PROPERTIES LINKER_LANGUAGE CXX) set_target_properties(darknet PROPERTIES LINKER_LANGUAGE CXX)
endif() endif()
add_executable(kmeansiou ${CMAKE_CURRENT_LIST_DIR}/scripts/kmeansiou.c)
if(MATH_LIBRARY)
target_link_libraries(kmeansiou PRIVATE ${MATH_LIBRARY})
endif()
target_include_directories(darknet PUBLIC $<BUILD_INTERFACE:${CMAKE_CURRENT_LIST_DIR}/include> $<BUILD_INTERFACE:${CMAKE_CURRENT_LIST_DIR}/src> $<INSTALL_INTERFACE:${INSTALL_INCLUDE_DIR}> $<BUILD_INTERFACE:${Stb_INCLUDE_DIR}>) target_include_directories(darknet PUBLIC $<BUILD_INTERFACE:${CMAKE_CURRENT_LIST_DIR}/include> $<BUILD_INTERFACE:${CMAKE_CURRENT_LIST_DIR}/src> $<INSTALL_INTERFACE:${INSTALL_INCLUDE_DIR}> $<BUILD_INTERFACE:${Stb_INCLUDE_DIR}>)
target_include_directories(dark PUBLIC $<BUILD_INTERFACE:${CMAKE_CURRENT_LIST_DIR}/include> $<BUILD_INTERFACE:${CMAKE_CURRENT_LIST_DIR}/src> $<INSTALL_INTERFACE:${INSTALL_INCLUDE_DIR}> $<BUILD_INTERFACE:${Stb_INCLUDE_DIR}>) target_include_directories(dark PUBLIC $<BUILD_INTERFACE:${CMAKE_CURRENT_LIST_DIR}/include> $<BUILD_INTERFACE:${CMAKE_CURRENT_LIST_DIR}/src> $<INSTALL_INTERFACE:${INSTALL_INCLUDE_DIR}> $<BUILD_INTERFACE:${Stb_INCLUDE_DIR}>)
target_include_directories(uselib PUBLIC $<BUILD_INTERFACE:${CMAKE_CURRENT_LIST_DIR}/include> $<BUILD_INTERFACE:${CMAKE_CURRENT_LIST_DIR}/src> $<INSTALL_INTERFACE:${INSTALL_INCLUDE_DIR}> $<BUILD_INTERFACE:${Stb_INCLUDE_DIR}>) target_include_directories(uselib PUBLIC $<BUILD_INTERFACE:${CMAKE_CURRENT_LIST_DIR}/include> $<BUILD_INTERFACE:${CMAKE_CURRENT_LIST_DIR}/src> $<INSTALL_INTERFACE:${INSTALL_INCLUDE_DIR}> $<BUILD_INTERFACE:${Stb_INCLUDE_DIR}>)
@ -492,9 +499,9 @@ if(OPENMP_FOUND)
target_link_libraries(dark PUBLIC OpenMP::OpenMP_C) target_link_libraries(dark PUBLIC OpenMP::OpenMP_C)
endif() endif()
if(CMAKE_COMPILER_IS_GNUCC) if(CMAKE_COMPILER_IS_GNUCC AND MATH_LIBRARY)
target_link_libraries(darknet PRIVATE m) target_link_libraries(darknet PRIVATE ${MATH_LIBRARY})
target_link_libraries(dark PUBLIC m) target_link_libraries(dark PUBLIC ${MATH_LIBRARY})
endif() endif()
if(MSVC) if(MSVC)
@ -575,7 +582,7 @@ install(TARGETS dark EXPORT DarknetTargets
PUBLIC_HEADER DESTINATION "${INSTALL_INCLUDE_DIR}" PUBLIC_HEADER DESTINATION "${INSTALL_INCLUDE_DIR}"
COMPONENT dev COMPONENT dev
) )
install(TARGETS uselib darknet install(TARGETS uselib darknet kmeansiou
DESTINATION "${INSTALL_BIN_DIR}" DESTINATION "${INSTALL_BIN_DIR}"
) )
if(OpenCV_FOUND AND OpenCV_VERSION VERSION_GREATER "3.0" AND BUILD_USELIB_TRACK) if(OpenCV_FOUND AND OpenCV_VERSION VERSION_GREATER "3.0" AND BUILD_USELIB_TRACK)

View File

@ -6,7 +6,7 @@
build build
Created By: Stefano Sinigardi Created By: Stefano Sinigardi
Created Date: February 18, 2019 Created Date: February 18, 2019
Last Modified Date: August 1, 2023 Last Modified Date: August 10, 2023
.DESCRIPTION .DESCRIPTION
Build tool using CMake, trying to properly setup the environment around compiler Build tool using CMake, trying to properly setup the environment around compiler
@ -189,7 +189,7 @@ param (
$global:DisableInteractive = $DisableInteractive $global:DisableInteractive = $DisableInteractive
$build_ps1_version = "3.4.0" $build_ps1_version = "3.4.1"
$script_name = $MyInvocation.MyCommand.Name $script_name = $MyInvocation.MyCommand.Name
Import-Module -Name $PSScriptRoot/scripts/utils.psm1 -Force Import-Module -Name $PSScriptRoot/scripts/utils.psm1 -Force
@ -729,15 +729,6 @@ if (($null -eq $vcpkg_path) -and $UseVCPKG) {
Write-Host "Found vcpkg in $PWD/vcpkg${VCPKGSuffix}: $vcpkg_path" Write-Host "Found vcpkg in $PWD/vcpkg${VCPKGSuffix}: $vcpkg_path"
$AdditionalBuildSetup = $AdditionalBuildSetup + " -DENABLE_VCPKG_INTEGRATION:BOOL=ON" $AdditionalBuildSetup = $AdditionalBuildSetup + " -DENABLE_VCPKG_INTEGRATION:BOOL=ON"
} }
else {
if (-not ($VCPKGSuffix -eq "")) {
MyThrow("Unable to find vcpkg${VCPKGSuffix}")
}
else {
Write-Host "Skipping vcpkg integration`n" -ForegroundColor Yellow
$AdditionalBuildSetup = $AdditionalBuildSetup + " -DENABLE_VCPKG_INTEGRATION:BOOL=OFF"
}
}
$vcpkg_branch_set_by_this_script = $false $vcpkg_branch_set_by_this_script = $false

View File

@ -83,7 +83,7 @@ function getLatestVisualStudioWithDesktopWorkloadPath([bool]$required = $true) {
$installationPath = $instance.InstallationPath -replace "\\$" # Remove potential trailing backslash $installationPath = $instance.InstallationPath -replace "\\$" # Remove potential trailing backslash
} }
if (!$installationPath) { if (!$installationPath) {
Write-Host "Warning: no full Visual Studio setup has been found, extending search to include also partial installations" -ForegroundColor Yellow #Write-Host "Warning: no full Visual Studio setup has been found, extending search to include also partial installations" -ForegroundColor Yellow
$output = & $vswhereExe -products * -latest -format xml $output = & $vswhereExe -products * -latest -format xml
[xml]$asXml = $output [xml]$asXml = $output
foreach ($instance in $asXml.instances.instance) { foreach ($instance in $asXml.instances.instance) {
@ -91,7 +91,7 @@ function getLatestVisualStudioWithDesktopWorkloadPath([bool]$required = $true) {
} }
} }
if (!$installationPath) { if (!$installationPath) {
Write-Host "Warning: no full Visual Studio setup has been found, extending search to include also pre-release installations" -ForegroundColor Yellow #Write-Host "Warning: no full Visual Studio setup has been found, extending search to include also pre-release installations" -ForegroundColor Yellow
$output = & $vswhereExe -prerelease -products * -latest -format xml $output = & $vswhereExe -prerelease -products * -latest -format xml
[xml]$asXml = $output [xml]$asXml = $output
foreach ($instance in $asXml.instances.instance) { foreach ($instance in $asXml.instances.instance) {
@ -130,7 +130,7 @@ function getLatestVisualStudioWithDesktopWorkloadVersion([bool]$required = $true
$installationVersion = $instance.InstallationVersion $installationVersion = $instance.InstallationVersion
} }
if (!$installationVersion) { if (!$installationVersion) {
Write-Host "Warning: no full Visual Studio setup has been found, extending search to include also partial installations" -ForegroundColor Yellow #Write-Host "Warning: no full Visual Studio setup has been found, extending search to include also partial installations" -ForegroundColor Yellow
$output = & $vswhereExe -products * -latest -format xml $output = & $vswhereExe -products * -latest -format xml
[xml]$asXml = $output [xml]$asXml = $output
foreach ($instance in $asXml.instances.instance) { foreach ($instance in $asXml.instances.instance) {
@ -138,7 +138,7 @@ function getLatestVisualStudioWithDesktopWorkloadVersion([bool]$required = $true
} }
} }
if (!$installationVersion) { if (!$installationVersion) {
Write-Host "Warning: no full Visual Studio setup has been found, extending search to include also pre-release installations" -ForegroundColor Yellow #Write-Host "Warning: no full Visual Studio setup has been found, extending search to include also pre-release installations" -ForegroundColor Yellow
$output = & $vswhereExe -prerelease -products * -latest -format xml $output = & $vswhereExe -prerelease -products * -latest -format xml
[xml]$asXml = $output [xml]$asXml = $output
foreach ($instance in $asXml.instances.instance) { foreach ($instance in $asXml.instances.instance) {
@ -340,4 +340,3 @@ Export-ModuleMember -Function DownloadNinja
Export-ModuleMember -Function DownloadAria2 Export-ModuleMember -Function DownloadAria2
Export-ModuleMember -Function Download7Zip Export-ModuleMember -Function Download7Zip
Export-ModuleMember -Function MyThrow Export-ModuleMember -Function MyThrow
Export-ModuleMember -Function CopyTexFile