diff --git a/CMakeLists.txt b/CMakeLists.txt index 1a8eef5e66b1c9045ec0bc75c31f709cb1643c72..80820c6487c506c4a34d9241032a9fe04a8a3746 100755 --- a/CMakeLists.txt +++ b/CMakeLists.txt @@ -98,6 +98,13 @@ else(WIN32) endif(WIN32) find_package(Git REQUIRED) + +# config GIT_URL with github mirrors to speed up dependent repos clone +option(GIT_URL "Git URL to clone dependent repos" ${GIT_URL}) +if(NOT GIT_URL) + set(GIT_URL "https://github.com") +endif() + find_package(Threads REQUIRED) include(simd) diff --git a/cmake/external/brpc.cmake b/cmake/external/brpc.cmake index ec42eaa759dbcd5b9e31ffdb07b56a9580282079..064e35112ff6f57eec8a03de176a3c2cbfa83011 100644 --- a/cmake/external/brpc.cmake +++ b/cmake/external/brpc.cmake @@ -40,7 +40,7 @@ ExternalProject_Add( extern_brpc ${EXTERNAL_PROJECT_LOG_ARGS} ${SHALLOW_CLONE} - GIT_REPOSITORY "https://github.com/apache/incubator-brpc.git" + GIT_REPOSITORY "${GIT_URL}/apache/incubator-brpc.git" GIT_TAG "ad00fe940b4f05225b214131959293bbed8744a0" #rdma branch's head now. PREFIX ${BRPC_SOURCES_DIR} UPDATE_COMMAND "" diff --git a/cmake/external/cryptopp.cmake b/cmake/external/cryptopp.cmake index 351ef1c7c7aebb698a5d41689352a913d0b950e8..3176e2a665c634d97ee413485003071394c7dedf 100644 --- a/cmake/external/cryptopp.cmake +++ b/cmake/external/cryptopp.cmake @@ -17,7 +17,7 @@ INCLUDE(ExternalProject) SET(CRYPTOPP_PREFIX_DIR ${THIRD_PARTY_PATH}/cryptopp) SET(CRYPTOPP_INSTALL_DIR ${THIRD_PARTY_PATH}/install/cryptopp) SET(CRYPTOPP_INCLUDE_DIR "${CRYPTOPP_INSTALL_DIR}/include" CACHE PATH "cryptopp include directory." FORCE) -SET(CRYPTOPP_REPOSITORY https://github.com/weidai11/cryptopp.git) +SET(CRYPTOPP_REPOSITORY ${GIT_URL}/weidai11/cryptopp.git) SET(CRYPTOPP_TAG CRYPTOPP_8_2_0) IF(WIN32) @@ -55,7 +55,7 @@ ExternalProject_Add( SOURCE_DIR ${CRYPTOPP_SOURCE_DIR} PATCH_COMMAND COMMAND ${CMAKE_COMMAND} -E remove_directory "/cmake/" - COMMAND git clone https://github.com/noloader/cryptopp-cmake "/cmake" + COMMAND git clone ${GIT_URL}/noloader/cryptopp-cmake "/cmake" COMMAND cd "/cmake" && git checkout tags/${CRYPTOPP_TAG} -b ${CRYPTOPP_TAG} COMMAND ${CMAKE_COMMAND} -E copy_directory "/cmake/" "/" INSTALL_DIR ${CRYPTOPP_INSTALL_DIR} diff --git a/cmake/external/cub.cmake b/cmake/external/cub.cmake index 6f790f1af8e1a03d1101244a4d82045331b44c13..a26568860f42dae5cdcce0b1bf51d06b531608c6 100644 --- a/cmake/external/cub.cmake +++ b/cmake/external/cub.cmake @@ -16,7 +16,7 @@ include(ExternalProject) set(CUB_PREFIX_DIR ${THIRD_PARTY_PATH}/cub) set(CUB_SOURCE_DIR ${THIRD_PARTY_PATH}/cub/src/extern_cub) -set(CUB_REPOSITORY https://github.com/NVlabs/cub.git) +set(CUB_REPOSITORY ${GIT_URL}/NVlabs/cub.git) set(CUB_TAG 1.8.0) cache_third_party(extern_cub diff --git a/cmake/external/dlpack.cmake b/cmake/external/dlpack.cmake index a5144f8e463d2d4dc06bfa6b5c5c360b34e1512a..87db181d953afb5bfb17d3167f1e5efac3353b79 100644 --- a/cmake/external/dlpack.cmake +++ b/cmake/external/dlpack.cmake @@ -17,7 +17,7 @@ include(ExternalProject) set(DLPACK_PREFIX_DIR ${THIRD_PARTY_PATH}/dlpack) set(DLPACK_SOURCE_DIR ${THIRD_PARTY_PATH}/dlpack/src/extern_dlpack) -set(DLPACK_REPOSITORY https://github.com/dmlc/dlpack.git) +set(DLPACK_REPOSITORY ${GIT_URL}/dmlc/dlpack.git) set(DLPACK_TAG v0.2) cache_third_party(extern_dlpack diff --git a/cmake/external/eigen.cmake b/cmake/external/eigen.cmake index 631803da31d5a0fad1534d266f70f4708882f7e8..b1e389789102790a09e3c79d46debb552da48085 100644 --- a/cmake/external/eigen.cmake +++ b/cmake/external/eigen.cmake @@ -22,14 +22,14 @@ set(EIGEN_TAG 4da2c6b1974827b1999bab652a3d4703e1992d26) # the recent version of eigen will cause compilation error on windows if(WIN32) - set(EIGEN_REPOSITORY https://github.com/eigenteam/eigen-git-mirror.git) + set(EIGEN_REPOSITORY ${GIT_URL}/eigenteam/eigen-git-mirror.git) set(EIGEN_TAG 917060c364181f33a735dc023818d5a54f60e54c) endif() # eigen on cuda9.1 missing header of math_funtions.hpp # https://stackoverflow.com/questions/43113508/math-functions-hpp-not-found-when-using-cuda-with-eigen if(WITH_AMD_GPU) - set(EIGEN_REPOSITORY https://github.com/sabreshao/hipeigen.git) + set(EIGEN_REPOSITORY ${GIT_URL}/sabreshao/hipeigen.git) set(EIGEN_TAG 7cb2b6e5a4b4a1efe658abb215cd866c6fb2275e) endif() diff --git a/cmake/external/gflags.cmake b/cmake/external/gflags.cmake index 2842d73081b7b8c16340316c2e443a89ffa0aa37..a077c8061b1a235b68db8a9bc6d0a2bc8b28e57b 100644 --- a/cmake/external/gflags.cmake +++ b/cmake/external/gflags.cmake @@ -18,7 +18,7 @@ SET(GFLAGS_PREFIX_DIR ${THIRD_PARTY_PATH}/gflags) SET(GFLAGS_SOURCE_DIR ${THIRD_PARTY_PATH}/gflags/src/extern_gflags) SET(GFLAGS_INSTALL_DIR ${THIRD_PARTY_PATH}/install/gflags) SET(GFLAGS_INCLUDE_DIR "${GFLAGS_INSTALL_DIR}/include" CACHE PATH "gflags include directory." FORCE) -set(GFLAGS_REPOSITORY https://github.com/gflags/gflags.git) +set(GFLAGS_REPOSITORY ${GIT_URL}/gflags/gflags.git) set(GFLAGS_TAG 77592648e3f3be87d6c7123eb81cbad75f9aef5a) IF(WIN32) set(GFLAGS_LIBRARIES "${GFLAGS_INSTALL_DIR}/lib/gflags_static.lib" CACHE FILEPATH "GFLAGS_LIBRARIES" FORCE) diff --git a/cmake/external/glog.cmake b/cmake/external/glog.cmake index f66ecce18a0474f3f0be0662623b0d16da015bba..649152bd436361493189f422c0c1dc2381fe70a7 100644 --- a/cmake/external/glog.cmake +++ b/cmake/external/glog.cmake @@ -18,7 +18,7 @@ SET(GLOG_PREFIX_DIR ${THIRD_PARTY_PATH}/glog) SET(GLOG_SOURCE_DIR ${THIRD_PARTY_PATH}/glog/src/extern_glog) SET(GLOG_INSTALL_DIR ${THIRD_PARTY_PATH}/install/glog) SET(GLOG_INCLUDE_DIR "${GLOG_INSTALL_DIR}/include" CACHE PATH "glog include directory." FORCE) -SET(GLOG_REPOSITORY https://github.com/google/glog.git) +SET(GLOG_REPOSITORY ${GIT_URL}/google/glog.git) SET(GLOG_TAG v0.3.5) IF(WIN32) diff --git a/cmake/external/gloo.cmake b/cmake/external/gloo.cmake index ace71a7f6341365574c9b0c777090016e25b9eaf..ea7af315e1a690578bd16c89cc83a158dacca4cf 100644 --- a/cmake/external/gloo.cmake +++ b/cmake/external/gloo.cmake @@ -21,7 +21,7 @@ SET(GLOO_INSTALL_DIR ${THIRD_PARTY_PATH}/install/gloo) SET(GLOO_INCLUDE_DIR "${GLOO_INSTALL_DIR}/include" CACHE PATH "gloo include directory." FORCE) SET(GLOO_LIBRARY_DIR "${GLOO_INSTALL_DIR}/lib" CACHE PATH "gloo library directory." FORCE) # As we add extra features for gloo, we use the non-official repo -SET(GLOO_REPOSITORY https://github.com/sandyhouse/gloo.git) +SET(GLOO_REPOSITORY ${GIT_URL}/sandyhouse/gloo.git) SET(GLOO_TAG v0.0.2) SET(GLOO_LIBRARIES "${GLOO_INSTALL_DIR}/lib/libgloo.a" CACHE FILEPATH "gloo library." FORCE) diff --git a/cmake/external/gtest.cmake b/cmake/external/gtest.cmake index 60061c44b78eb20b00444f5718dbc4bc8d564669..3db12f084eb5a3519e529afe90a151b33823fe82 100644 --- a/cmake/external/gtest.cmake +++ b/cmake/external/gtest.cmake @@ -25,7 +25,7 @@ SET(GTEST_PREFIX_DIR ${THIRD_PARTY_PATH}/gtest) SET(GTEST_SOURCE_DIR ${THIRD_PARTY_PATH}/gtest/src/extern_gtest) SET(GTEST_INSTALL_DIR ${THIRD_PARTY_PATH}/install/gtest) SET(GTEST_INCLUDE_DIR "${GTEST_INSTALL_DIR}/include" CACHE PATH "gtest include directory." FORCE) -set(GTEST_REPOSITORY https://github.com/google/googletest.git) +set(GTEST_REPOSITORY ${GIT_URL}/google/googletest.git) set(GTEST_TAG release-1.8.1) INCLUDE_DIRECTORIES(${GTEST_INCLUDE_DIR}) diff --git a/cmake/external/leveldb.cmake b/cmake/external/leveldb.cmake index 384268a2d814cf083ce1104eb0349c23b1637d6d..be6d70c82629b4eafeca1bc4f92766584ccd42e3 100644 --- a/cmake/external/leveldb.cmake +++ b/cmake/external/leveldb.cmake @@ -25,7 +25,7 @@ ExternalProject_Add( ${EXTERNAL_PROJECT_LOG_ARGS} ${SHALLOW_CLONE} PREFIX ${LEVELDB_SOURCES_DIR} - GIT_REPOSITORY "https://github.com/google/leveldb.git" + GIT_REPOSITORY "${GIT_URL}/google/leveldb.git" GIT_TAG v1.18 CONFIGURE_COMMAND "" BUILD_COMMAND CXXFLAGS=-fPIC make -j ${NUM_OF_PROCESSOR} libleveldb.a diff --git a/cmake/external/libxsmm.cmake b/cmake/external/libxsmm.cmake index b6ab2d1528447b03af5ec6bc6291ce48cb9fac13..0d09576286d907ec6964df69efb0efcf9885f57d 100644 --- a/cmake/external/libxsmm.cmake +++ b/cmake/external/libxsmm.cmake @@ -24,7 +24,7 @@ SET(LIBXSMM_LIBS "${LIBXSMM_LIBRARY_DIR}/libxsmm.a" ExternalProject_Add( extern_libxsmm ${SHALLOW_CLONE} - GIT_REPOSITORY "https://github.com/hfp/libxsmm.git" + GIT_REPOSITORY "${GIT_URL}/hfp/libxsmm.git" GIT_TAG "7cc03b5b342fdbc6b6d990b190671c5dbb8489a2" PREFIX ${LIBXSMM_SOURCES_DIR} UPDATE_COMMAND "" diff --git a/cmake/external/lite.cmake b/cmake/external/lite.cmake index 9781d339666794c02200a2b8c06bc4850d6c7f67..9cf305a4421d84554141ae525645ebe8d32047aa 100644 --- a/cmake/external/lite.cmake +++ b/cmake/external/lite.cmake @@ -62,7 +62,7 @@ if (NOT LITE_SOURCE_DIR OR NOT LITE_BINARY_DIR) ExternalProject_Add( ${LITE_PROJECT} ${EXTERNAL_PROJECT_LOG_ARGS} - GIT_REPOSITORY "https://github.com/PaddlePaddle/Paddle-Lite.git" + GIT_REPOSITORY "${GIT_URL}/PaddlePaddle/Paddle-Lite.git" GIT_TAG ${LITE_GIT_TAG} PREFIX ${LITE_SOURCES_DIR} PATCH_COMMAND mkdir -p ${LITE_SOURCES_DIR}/src/extern_lite-build/lite/gen_code && touch ${LITE_SOURCES_DIR}/src/extern_lite-build/lite/gen_code/__generated_code__.cc @@ -106,7 +106,7 @@ if (NOT LITE_SOURCE_DIR OR NOT LITE_BINARY_DIR) ExternalProject_Add( ${LITE_PROJECT} ${EXTERNAL_PROJECT_LOG_ARGS} - GIT_REPOSITORY "https://github.com/PaddlePaddle/Paddle-Lite.git" + GIT_REPOSITORY "${GIT_URL}/PaddlePaddle/Paddle-Lite.git" GIT_TAG ${LITE_GIT_TAG} PREFIX ${LITE_SOURCES_DIR} UPDATE_COMMAND "" diff --git a/cmake/external/mkldnn.cmake b/cmake/external/mkldnn.cmake index e3ac8624a809ab9c0821855bcd4ab1b2a162435f..9c9e1d18d90d6333b225e0b99e5d652c5c13d84a 100644 --- a/cmake/external/mkldnn.cmake +++ b/cmake/external/mkldnn.cmake @@ -19,7 +19,7 @@ SET(MKLDNN_PREFIX_DIR ${THIRD_PARTY_PATH}/mkldnn) SET(MKLDNN_SOURCE_DIR ${THIRD_PARTY_PATH}/mkldnn/src/extern_mkldnn) SET(MKLDNN_INSTALL_DIR ${THIRD_PARTY_PATH}/install/mkldnn) SET(MKLDNN_INC_DIR "${MKLDNN_INSTALL_DIR}/include" CACHE PATH "mkldnn include directory." FORCE) -SET(MKLDNN_REPOSITORY https://github.com/oneapi-src/oneDNN.git) +SET(MKLDNN_REPOSITORY ${GIT_URL}/oneapi-src/oneDNN.git) SET(MKLDNN_TAG 361725600224f41b7347a1c6bee9b04d1e6c14d7) # Introduce variables: diff --git a/cmake/external/openblas.cmake b/cmake/external/openblas.cmake index 5bc7eaaff3abe65e1a12a923880960bbb4268f87..5e67a91c3d85486a3f2069d662e9373ced77a50a 100644 --- a/cmake/external/openblas.cmake +++ b/cmake/external/openblas.cmake @@ -17,7 +17,7 @@ INCLUDE(ExternalProject) SET(CBLAS_PREFIX_DIR ${THIRD_PARTY_PATH}/openblas) SET(CBLAS_SOURCE_DIR ${THIRD_PARTY_PATH}/openblas/src/extern_openblas) SET(CBLAS_INSTALL_DIR ${THIRD_PARTY_PATH}/install/openblas) -SET(CBLAS_REPOSITORY https://github.com/xianyi/OpenBLAS.git) +SET(CBLAS_REPOSITORY ${GIT_URL}/xianyi/OpenBLAS.git) SET(CBLAS_TAG v0.3.7) IF(WITH_ARM) # Under the FT2000 architecture, the calculation result of blas.sgemm in openblas 0.3+ is wrong, diff --git a/cmake/external/protobuf.cmake b/cmake/external/protobuf.cmake index 82dd4fa2e8eae9ce6dbafa5f2d4acf47ce7ecd9f..905c17b9304ae7d8e2d7bb4b059ff7208511ec16 100644 --- a/cmake/external/protobuf.cmake +++ b/cmake/external/protobuf.cmake @@ -198,7 +198,7 @@ FUNCTION(build_protobuf TARGET_NAME BUILD_FOR_HOST) "-Dprotobuf_MSVC_STATIC_RUNTIME=${MSVC_STATIC_CRT}") ENDIF() - SET(PROTOBUF_REPOSITORY https://github.com/protocolbuffers/protobuf.git) + SET(PROTOBUF_REPOSITORY ${GIT_URL}/protocolbuffers/protobuf.git) SET(PROTOBUF_TAG 9f75c5aa851cd877fb0d93ccc31b8567a6706546) cache_third_party(${TARGET_NAME} diff --git a/cmake/external/pybind11.cmake b/cmake/external/pybind11.cmake index 1297d613839caa9c730b9e4e6a9281d907f119b5..3a0b3676db36e3243fb82d144bb151393504ee45 100644 --- a/cmake/external/pybind11.cmake +++ b/cmake/external/pybind11.cmake @@ -16,7 +16,7 @@ include(ExternalProject) set(PYBIND_PREFIX_DIR ${THIRD_PARTY_PATH}/pybind) set(PYBIND_SOURCE_DIR ${THIRD_PARTY_PATH}/pybind/src/extern_pybind) -SET(PYBIND_REPOSITORY https://github.com/pybind/pybind11.git) +SET(PYBIND_REPOSITORY ${GIT_URL}/pybind/pybind11.git) SET(PYBIND_TAG v2.2.4) cache_third_party(extern_pybind diff --git a/cmake/external/rocprim.cmake b/cmake/external/rocprim.cmake index 7cb765039714e5d665d594056f2335a765fa3314..6bcecb88e9886da7335e169d4357e2dfc0e67ff6 100644 --- a/cmake/external/rocprim.cmake +++ b/cmake/external/rocprim.cmake @@ -29,7 +29,7 @@ SET(ROCPRIM_INCLUDE_DIR ${ROCPRIM_INSTALL_DIR}/include) ExternalProject_Add( extern_rocprim ${SHALLOW_CLONE} - GIT_REPOSITORY "https://github.com/ROCmSoftwarePlatform/rocPRIM.git" + GIT_REPOSITORY "${GIT_URL}/ROCmSoftwarePlatform/rocPRIM.git" GIT_TAG 5bd41b96ab8d8343330fb2c3e1b96775bde3b3fc PREFIX ${ROCPRIM_SOURCE_DIR} UPDATE_COMMAND "" diff --git a/cmake/external/threadpool.cmake b/cmake/external/threadpool.cmake index 24827b5bdf954785005adb106f0a5fca6b2694c8..205e8d26d93ca1c25e5b59ecc3b063b4837db77b 100644 --- a/cmake/external/threadpool.cmake +++ b/cmake/external/threadpool.cmake @@ -16,7 +16,7 @@ INCLUDE(ExternalProject) SET(THREADPOOL_PREFIX_DIR ${THIRD_PARTY_PATH}/threadpool) SET(THREADPOOL_SOURCE_DIR ${THIRD_PARTY_PATH}/threadpool/src/extern_threadpool) -SET(THREADPOOL_REPOSITORY https://github.com/progschj/ThreadPool.git) +SET(THREADPOOL_REPOSITORY ${GIT_URL}/progschj/ThreadPool.git) SET(THREADPOOL_TAG 9a42ec1329f259a5f4881a291db1dcb8f2ad9040) cache_third_party(extern_threadpool diff --git a/cmake/external/warpctc.cmake b/cmake/external/warpctc.cmake index 7f2ab1fb11d847217a2294e4122904d5bada18fb..0ee3e2116a94b68d528a475a453d1c31f0464cf4 100644 --- a/cmake/external/warpctc.cmake +++ b/cmake/external/warpctc.cmake @@ -17,7 +17,7 @@ INCLUDE(ExternalProject) SET(WARPCTC_PREFIX_DIR ${THIRD_PARTY_PATH}/warpctc) SET(WARPCTC_SOURCE_DIR ${THIRD_PARTY_PATH}/warpctc/src/extern_warpctc) SET(WARPCTC_INSTALL_DIR ${THIRD_PARTY_PATH}/install/warpctc) -set(WARPCTC_REPOSITORY https://github.com/baidu-research/warp-ctc.git) +set(WARPCTC_REPOSITORY ${GIT_URL}/baidu-research/warp-ctc.git) set(WARPCTC_TAG 95a461eddeabd51099ef059dcfada1117eb1bfb8) SET(WARPCTC_INCLUDE_DIR "${WARPCTC_INSTALL_DIR}/include" diff --git a/cmake/external/xbyak.cmake b/cmake/external/xbyak.cmake index f990914ab73a6877e529c1bde5da6c1079bb0555..6627c4eed112f2eead20fc5831b190488406b8f3 100644 --- a/cmake/external/xbyak.cmake +++ b/cmake/external/xbyak.cmake @@ -19,7 +19,7 @@ set(XBYAK_PREFIX_DIR ${THIRD_PARTY_PATH}/xbyak) SET(XBYAK_SOURCE_DIR ${THIRD_PARTY_PATH}/xbyak/src/extern_xbyak) set(XBYAK_INSTALL_ROOT ${THIRD_PARTY_PATH}/install/xbyak) set(XBYAK_INC_DIR ${XBYAK_INSTALL_ROOT}/include) -set(XBYAK_REPOSITORY https://github.com/herumi/xbyak.git) +set(XBYAK_REPOSITORY ${GIT_URL}/herumi/xbyak.git) set(XBYAK_TAG v5.661) # Jul 26th include_directories(${XBYAK_INC_DIR}) diff --git a/cmake/external/xxhash.cmake b/cmake/external/xxhash.cmake index 3be938141f7e89ace533ddd505be81220db4d28f..bdd7df190ff106178266fbd47716e7d70fd229bd 100644 --- a/cmake/external/xxhash.cmake +++ b/cmake/external/xxhash.cmake @@ -18,7 +18,7 @@ set(XXHASH_PREFIX_DIR ${THIRD_PARTY_PATH}/xxhash) set(XXHASH_SOURCE_DIR ${THIRD_PARTY_PATH}/xxhash/src/extern_xxhash) set(XXHASH_INSTALL_DIR ${THIRD_PARTY_PATH}/install/xxhash) set(XXHASH_INCLUDE_DIR "${XXHASH_INSTALL_DIR}/include") -set(XXHASH_REPOSITORY https://github.com/Cyan4973/xxHash.git) +set(XXHASH_REPOSITORY ${GIT_URL}/Cyan4973/xxHash.git) set(XXHASH_TAG v0.6.5) cache_third_party(extern_xxhash diff --git a/cmake/external/zlib.cmake b/cmake/external/zlib.cmake index 2f2a6b74701150691109c361ff83c4d2d373bb8d..4464787a0c2a64066585e8f308c68a62286478e9 100644 --- a/cmake/external/zlib.cmake +++ b/cmake/external/zlib.cmake @@ -19,7 +19,7 @@ SET(ZLIB_SOURCE_DIR ${THIRD_PARTY_PATH}/zlib/src/extern_zlib) SET(ZLIB_INSTALL_DIR ${THIRD_PARTY_PATH}/install/zlib) SET(ZLIB_ROOT ${ZLIB_INSTALL_DIR} CACHE FILEPATH "zlib root directory." FORCE) SET(ZLIB_INCLUDE_DIR "${ZLIB_INSTALL_DIR}/include" CACHE PATH "zlib include directory." FORCE) -set(ZLIB_REPOSITORY https://github.com/madler/zlib.git) +set(ZLIB_REPOSITORY ${GIT_URL}/madler/zlib.git) set(ZLIB_TAG v1.2.8) INCLUDE_DIRECTORIES(${ZLIB_INCLUDE_DIR}) # For zlib code to include its own headers.