fix a bug when download from github instead but the subdir is changed to a wrong one

This commit is contained in:
fengyuentau 2022-09-16 16:04:20 +08:00
parent 45a7b71cac
commit 65998d8076

View File

@ -57,13 +57,14 @@ macro(ocv_download_url_gitcode_archive_commit_id)
message(WARNING "Package ${DL_ID} from mirror gitcode.net is outdated and will be downloaded from github.com instead.")
endif()
endmacro()
macro(ocv_download_url_gitcode_archive_release)
macro(ocv_download_url_gitcode_archive_release SUBDIR)
if(DL_HASH STREQUAL "${${DL_ID}_PKG_MD5_ORIGINAL}")
string(REPLACE "/" ";" DL_URL_split ${DL_URL})
list(GET DL_URL_split 3 __OWNER)
list(GET DL_URL_split 4 __REPO_NAME)
set(DL_URL "https://gitcode.net/${__OWNER}/${__REPO_NAME}/-/archive/${${DL_ID}_RELEASE_GITCODE}/${__REPO_NAME}-")
set(DL_HASH "${${DL_ID}_PKG_MD5_GITCODE}")
set(SUBDIR "${${DL_ID}_PKG_NAME_GITCODE}" PARENT_SCOPE)
else()
message(WARNING "Package ${DL_ID} from mirror gitcode.net is outdated and will be downloaded from github.com instead.")
endif()
@ -76,11 +77,9 @@ elseif(DL_ID STREQUAL "wechat_qrcode")
elseif((DL_ID STREQUAL "TENGINE") OR (DL_ID STREQUAL "NVIDIA_OPTICAL_FLOW") OR (DL_ID STREQUAL "TIM-VX"))
ocv_download_url_gitcode_archive_commit_id()
elseif(DL_ID STREQUAL "TBB")
ocv_download_url_gitcode_archive_release()
set(OPENCV_TBB_SUBDIR "${TBB_PKG_NAME_GITCODE}" PARENT_SCOPE)
ocv_download_url_gitcode_archive_release(OPENCV_TBB_SUBDIR)
elseif(DL_ID STREQUAL "ADE")
ocv_download_url_gitcode_archive_release()
set(ade_subdir "${ADE_PKG_NAME_GITCODE}" PARENT_SCOPE)
ocv_download_url_gitcode_archive_release(ade_subdir)
else()
message(STATUS "ocv_download: Unknown download ID ${DL_ID} for using mirror gitcode.net. Use original source instead.")
endif()