Merge pull request #26303 from asmorkalov:as/kleidicv_offline

Skip KleidiCV in offline build
This commit is contained in:
Alexander Smorkalov 2024-11-13 20:05:13 +03:00 committed by GitHub
commit e1d66643b3
No known key found for this signature in database
GPG Key ID: B5690EEEBB952194
4 changed files with 41 additions and 21 deletions

View File

@ -1,24 +1,7 @@
project(kleidicv_hal)
set(KLEIDICV_SOURCE_PATH "" CACHE PATH "Directory containing KleidiCV sources")
ocv_update(KLEIDICV_SRC_COMMIT "0.2.0")
ocv_update(KLEIDICV_SRC_HASH "dabe522e8f55ac342d07a787391dab80")
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}")
if(HAVE_KLEIDICV)
option(KLEIDICV_ENABLE_SME2 "" OFF) # not compatible with some CLang versions in NDK
include("${KLEIDICV_SOURCE_PATH}/adapters/opencv/CMakeLists.txt")
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()
if(WITH_KLEIDICV)
if(HAVE_KLEIDICV)
ocv_debug_message(STATUS "Enable KleidiCV acceleration")
if(NOT ";${OpenCV_HAL};" MATCHES ";kleidicv;")
set(OpenCV_HAL "kleidicv;${OpenCV_HAL}")

View File

@ -161,3 +161,19 @@ if(WITH_CLP)
endif()
endif()
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)