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
This suppresses the interpretation of string literals by switching the ocv_download_log from a macro to a function.
This avoid crashes when the string to log contains escape characters.
More details about the problem this PR fixes are available at: https://github.com/opencv/opencv_contrib/issues/1131
- more aggressive cache for files under CMAKE_BINARY_CACHE
* don't re-read files MD5
* don't repack archives
- add support for ENV{OPENCV_DOWNLOAD_PATH}
- added ID parameter as project/group identifier
- non-flat .cache directory (based on ID)
- download message prefix based on ID
- more detailed logging via ocv_download_log() macro
- force .gitignore file for .cache folder (with '*' pattern)