Merge pull request #21531 from fengyuentau:add_3rdparty_mirrors
authorYuantao Feng <yuantao.feng@outlook.com>
Fri, 18 Mar 2022 09:50:21 +0000 (17:50 +0800)
committerGitHub <noreply@github.com>
Fri, 18 Mar 2022 09:50:21 +0000 (09:50 +0000)
commitf7ac724c5d2b7f7580e840c4c623609098b17bdc
tree4f2d60740da03de3452438f99db0d52e7abbff83
parent48cd2d190f28c002bac8a9a190d1fc16169eaece
Merge pull request #21531 from fengyuentau:add_3rdparty_mirrors

Support downloading 3rdparty resources from Gitcode & Gitlab-style mirrors

* replace github.com with gitcode.net for ocv_download

* replace raw.githubusercontent.com with gitcode.net for ocv_download

* rename funtions and remove some comments

* add options for custom mirrors, which simply replace domain github.com & githubusercontent.com

* run ocv_init_download once; replace DL_URL with mirrored one when calling ocv_download

* fix for empty download links when not using mirror

* fix bugs: set(.. .. PARENT_SCOPE) for ocv_init_download; correct macro names for replace github archives and raw githubusercontent

* adjusted mirror swapping impl: replace with mirrored link before each ocv_download; update md5sum for archives

* fix a bug: macro invoked with incorrect arguments by non-set vars

* enclose if statement

* workable impl

* shorten the var names of two key options

* scalable implementation of downloading from mirror and using custom mirror

* improve ocv_init_download help message

* fix the different extracted directory name in case of ADE & TBB which are downloaded from release page

* improve help message printing

* Download ADE & TBB using commit ids instead of from release pages

* support custom mirrors on downloading archives

* improve hints

* add missing parentheses

* reset ocv_download calls

* mirror support implementation using ocv_cmake_hook & ocv_cmake_hook_append

* move ocv_init_download into cmake/OpenCVDownload.cmake

* move ocv_cmake_hook before checking CMake cache

* improve hints when not fetching as git repo

* add WORKING_DIRECTORY  in execute_process in ocv_init_download

* use OPENCV_DOWNLOAD_MIRROR_ID

* add custom.cmake for custom mirror

* detect github origin

* fix broken var name

* download from github by default if custom tbb is set

* add checksum checks for gitcode.cmake before replacing urls and checksums

* add checksum checks for custom.cmake before replacing urls and checkusms

* use description specify instead of set for messages in custom.cmake; use warning message for warnings

* updates and fixes
cmake/OpenCVDownload.cmake
cmake/mirrors/custom.cmake [new file with mode: 0644]
cmake/mirrors/gitcode.cmake [new file with mode: 0644]