Skip KleidiCV in offline build.

This commit is contained in:
Alexander Smorkalov 2024-10-14 17:15:37 +03:00 committed by Alexander Smorkalov
parent 67f07b16cb
commit 1a775198ce
4 changed files with 41 additions and 21 deletions

View File

@ -1,24 +1,7 @@
project(kleidicv_hal) project(kleidicv_hal)
set(KLEIDICV_SOURCE_PATH "" CACHE PATH "Directory containing KleidiCV sources") if(HAVE_KLEIDICV)
ocv_update(KLEIDICV_SRC_COMMIT "0.2.0") option(KLEIDICV_ENABLE_SME2 "" OFF) # not compatible with some CLang versions in NDK
ocv_update(KLEIDICV_SRC_HASH "dabe522e8f55ac342d07a787391dab80") include("${KLEIDICV_SOURCE_PATH}/adapters/opencv/CMakeLists.txt")
if(KLEIDICV_SOURCE_PATH)
set(THE_ROOT "${KLEIDICV_SOURCE_PATH}")
else()
ocv_download(FILENAME "kleidicv-${KLEIDICV_SRC_COMMIT}.tar.gz"
HASH ${KLEIDICV_SRC_HASH}
URL
"${OPENCV_KLEIDICV_URL}"
"$ENV{OPENCV_KLEIDICV_URL}"
"https://gitlab.arm.com/kleidi/kleidicv/-/archive/${KLEIDICV_SRC_COMMIT}/"
DESTINATION_DIR "${OpenCV_BINARY_DIR}/3rdparty/kleidicv/"
ID KLEIDICV
STATUS res
UNPACK RELATIVE_URL)
set(THE_ROOT "${OpenCV_BINARY_DIR}/3rdparty/kleidicv/kleidicv-${KLEIDICV_SRC_COMMIT}")
endif() endif()
option(KLEIDICV_ENABLE_SME2 "" OFF) # not compatible with some CLang versions in NDK
include("${THE_ROOT}/adapters/opencv/CMakeLists.txt")

21
3rdparty/kleidicv/kleidicv.cmake vendored Normal file
View File

@ -0,0 +1,21 @@
function(download_kleidicv root_var)
set(${root_var} "" PARENT_SCOPE)
ocv_update(KLEIDICV_SRC_COMMIT "0.2.0")
ocv_update(KLEIDICV_SRC_HASH "dabe522e8f55ac342d07a787391dab80")
set(THE_ROOT "${OpenCV_BINARY_DIR}/3rdparty/kleidicv")
ocv_download(FILENAME "kleidicv-${KLEIDICV_SRC_COMMIT}.tar.gz"
HASH ${KLEIDICV_SRC_HASH}
URL
"${OPENCV_KLEIDICV_URL}"
"$ENV{OPENCV_KLEIDICV_URL}"
"https://gitlab.arm.com/kleidi/kleidicv/-/archive/${KLEIDICV_SRC_COMMIT}/"
DESTINATION_DIR ${THE_ROOT}
ID KLEIDICV
STATUS res
UNPACK RELATIVE_URL)
if(res)
set(${root_var} "${OpenCV_BINARY_DIR}/3rdparty/kleidicv/kleidicv-${KLEIDICV_SRC_COMMIT}" PARENT_SCOPE)
endif()
endfunction()

View File

@ -935,7 +935,7 @@ if(HAVE_OPENVX)
endif() endif()
endif() endif()
if(WITH_KLEIDICV) if(HAVE_KLEIDICV)
ocv_debug_message(STATUS "Enable KleidiCV acceleration") ocv_debug_message(STATUS "Enable KleidiCV acceleration")
if(NOT ";${OpenCV_HAL};" MATCHES ";kleidicv;") if(NOT ";${OpenCV_HAL};" MATCHES ";kleidicv;")
set(OpenCV_HAL "kleidicv;${OpenCV_HAL}") set(OpenCV_HAL "kleidicv;${OpenCV_HAL}")

View File

@ -161,3 +161,19 @@ if(WITH_CLP)
endif() endif()
endif() endif()
endif(WITH_CLP) endif(WITH_CLP)
# --- ARM KleidiCV
if(WITH_KLEIDICV)
if(KLEIDICV_SOURCE_PATH AND EXISTS "${KLEIDICV_SOURCE_PATH}/adapters/opencv/CMakeLists.txt")
set(HAVE_KLEIDICV ON)
endif()
if(NOT HAVE_KLEIDICV)
include("${OpenCV_SOURCE_DIR}/3rdparty/kleidicv/kleidicv.cmake")
download_kleidicv(KLEIDICV_SOURCE_PATH)
if(KLEIDICV_SOURCE_PATH)
set(HAVE_KLEIDICV ON)
endif()
else()
set(HAVE_KLEIDICV OFF)
endif()
endif(WITH_KLEIDICV)