CMake: support reading dependency zip files from a local mirror (#20005)

### Description
To test this feature, run 
```bat
python cmake\deps_update_and_upload.py --root-path mirror
```
Then run build.py as usual. 

The zip files will be cached local. To avoid being downloaded again and
again.
This commit is contained in:
Changming Sun 2024-03-21 17:58:59 -07:00 committed by GitHub
parent 983fd8393a
commit dafbef3a21
No known key found for this signature in database
GPG key ID: B5690EEEBB952194

View file

@ -14,6 +14,16 @@ foreach(ONNXRUNTIME_DEP IN LISTS ONNXRUNTIME_DEPS_LIST)
set(DEP_URL_${ONNXRUNTIME_DEP_NAME} ${ONNXRUNTIME_DEP_URL})
# The third column is SHA1 hash value
set(DEP_SHA1_${ONNXRUNTIME_DEP_NAME} ${ONNXRUNTIME_DEP})
if(ONNXRUNTIME_DEP_URL MATCHES "^https://")
# Search a local mirror folder
string(REGEX REPLACE "^https://" "${REPO_ROOT}/mirror/" LOCAL_URL "${ONNXRUNTIME_DEP_URL}")
if(EXISTS "${LOCAL_URL}")
cmake_path(ABSOLUTE_PATH LOCAL_URL)
set(DEP_URL_${ONNXRUNTIME_DEP_NAME} "${LOCAL_URL}")
endif()
endif()
endif()
endforeach()