diff --git a/cmake/external_libs/cmsis.cmake b/cmake/external_libs/cmsis.cmake index f78e6cd7948..d0bed341521 100644 --- a/cmake/external_libs/cmsis.cmake +++ b/cmake/external_libs/cmsis.cmake @@ -1,6 +1,6 @@ set(cmsis_pkg_name cmsis) -if(ENABLE_GITEE) +if(ENABLE_GITEE OR ENABLE_GITEE_EULER) # Channel GITEE_EULER is NOT supported now, use GITEE instead. set(REQ_URL "https://gitee.com/mirrors/CMSIS_5/repository/archive/5.7.0.tar.gz") set(SHA256 "1b4aa6d47c7d3a5032555049b95f4962a700e2022405f863781010606fe7f8f1") else() diff --git a/cmake/external_libs/flatbuffers.cmake b/cmake/external_libs/flatbuffers.cmake index b02bcb63015..7ec7071c3ec 100644 --- a/cmake/external_libs/flatbuffers.cmake +++ b/cmake/external_libs/flatbuffers.cmake @@ -17,7 +17,7 @@ if(ENABLE_GITEE_EULER) set(GIT_REPOSITORY "https://gitee.com/src-openeuler/flatbuffers.git") set(GIT_TAG "openEuler-22.03-LTS") set(SHA256 "d94ef2fb0c22198c7ffe2a6044e864bd467ca70b8cfdc52720dc94313321777b") - set(FLATBUFFER_SRC "${TOP_DIR}/mindspore/lite/build/_deps/flatbuffers-src") + set(FLATBUFFER_SRC "${CMAKE_BINARY_DIR}/_deps/flatbuffers-src") set(FLATBUFFER_DIR "${FLATBUFFER_SRC}/flatbuffers-2.0.0") __download_pkg_with_git(flatbuffers ${GIT_REPOSITORY} ${GIT_TAG} ${SHA256}) execute_process(COMMAND tar -xf ${FLATBUFFER_SRC}/v2.0.0.tar.gz WORKING_DIRECTORY ${FLATBUFFER_SRC}) diff --git a/cmake/external_libs/glog.cmake b/cmake/external_libs/glog.cmake index 267ffaa0b44..dda154f2d10 100644 --- a/cmake/external_libs/glog.cmake +++ b/cmake/external_libs/glog.cmake @@ -32,7 +32,7 @@ if(NOT ENABLE_GLIBCXX) set(glog_CXXFLAGS "${glog_CXXFLAGS} -D_GLIBCXX_USE_CXX11_ABI=0") endif() -if(ENABLE_GITEE) +if(ENABLE_GITEE OR ENABLE_GITEE_EULER) # Channel GITEE_EULER is NOT supported now, use GITEE instead. set(REQ_URL "https://gitee.com/mirrors/glog/repository/archive/v0.4.0.tar.gz") set(SHA256 "e17cd4bb7c06951a12fc9db5130ec63a9f090b84340b8556fa0d530f73c6b634") else() diff --git a/cmake/external_libs/json.cmake b/cmake/external_libs/json.cmake index 26a3c37dcc9..969b226b9f1 100644 --- a/cmake/external_libs/json.cmake +++ b/cmake/external_libs/json.cmake @@ -7,7 +7,7 @@ else() set(nlohmann_json3101_CFLAGS "-D_FORTIFY_SOURCE=2 -O2") endif() -if(ENABLE_GITEE) +if(ENABLE_GITEE OR ENABLE_GITEE_EULER) # Channel GITEE_EULER is NOT supported now, use GITEE instead. set(REQ_URL "https://gitee.com/mirrors/JSON-for-Modern-CPP/repository/archive/v3.10.1.zip") set(SHA256 "5c7d0a0542431fef628f8dc4c34fd022fe8747ccb577012d58f38672d8747e0d") set(INCLUDE "./include") diff --git a/cmake/external_libs/libevent.cmake b/cmake/external_libs/libevent.cmake index fe2e795b147..d652cf44aac 100644 --- a/cmake/external_libs/libevent.cmake +++ b/cmake/external_libs/libevent.cmake @@ -8,7 +8,7 @@ if(NOT MINDSPORE_PROJECT_DIR) set(MINDSPORE_PROJECT_DIR ${CMAKE_SOURCE_DIR}) endif() -if(ENABLE_GITEE) +if(ENABLE_GITEE OR ENABLE_GITEE_EULER) # Channel GITEE_EULER is NOT supported now, use GITEE instead. set(REQ_URL "https://gitee.com/mirrors/libevent/repository/archive/release-2.1.12-stable.tar.gz") set(SHA256 "7180a979aaa7000e1264da484f712d403fcf7679b1e9212c4e3d09f5c93efc24") else() diff --git a/cmake/external_libs/mkl_dnn.cmake b/cmake/external_libs/mkl_dnn.cmake index abd6c88f698..186e0e77c18 100644 --- a/cmake/external_libs/mkl_dnn.cmake +++ b/cmake/external_libs/mkl_dnn.cmake @@ -15,7 +15,7 @@ if(ENABLE_GITEE_EULER) set(GIT_TAG "0d726f1") set(SHA256 "4d655c0751ee6439584ef5e3d465953fe0c2f4ee2700bc02699bdc1d1572af0d") __download_pkg_with_git(ONEDNN ${GIT_REPOSITORY} ${GIT_TAG} ${SHA256}) - set(ONE_DNN_SRC "${TOP_DIR}/mindspore/lite/build/_deps/onednn-src") + set(ONE_DNN_SRC "${CMAKE_BINARY_DIR}/_deps/onednn-src") execute_process(COMMAND tar -xf ${ONE_DNN_SRC}/v2.2.tar.gz --strip-components 1 -C ${ONE_DNN_SRC}) endif() if(CMAKE_SYSTEM_NAME MATCHES "Windows") diff --git a/cmake/external_libs/opencl-clhpp.cmake b/cmake/external_libs/opencl-clhpp.cmake new file mode 100644 index 00000000000..96ba8f08e44 --- /dev/null +++ b/cmake/external_libs/opencl-clhpp.cmake @@ -0,0 +1,12 @@ +# Note: OpenCL-CLHPP depends on OpenCL-Headers +if(ENABLE_GITEE_EULER) + # Already downloaded in opencl-header.cmake +elseif(ENABLE_GITEE) + set(REQ_URL "https://gitee.com/mirrors/OpenCL-CLHPP/repository/archive/v2.0.12.tar.gz") + set(SHA256 "d5bdbfb614a6494de97abf7297db6d2c88a55a095b12949d797ce562f5d4fdce") + __download_pkg(OpenCL-CLHPP ${REQ_URL} ${SHA256}) +else() + set(REQ_URL "https://github.com/KhronosGroup/OpenCL-CLHPP/archive/v2.0.12.tar.gz") + set(SHA256 "20b28709ce74d3602f1a946d78a2024c1f6b0ef51358b9686612669897a58719") + __download_pkg(OpenCL-CLHPP ${REQ_URL} ${SHA256}) +endif() \ No newline at end of file diff --git a/cmake/external_libs/opencl.cmake b/cmake/external_libs/opencl-headers.cmake similarity index 71% rename from cmake/external_libs/opencl.cmake rename to cmake/external_libs/opencl-headers.cmake index e1cd1da82f8..7c8f1ee0cfd 100644 --- a/cmake/external_libs/opencl.cmake +++ b/cmake/external_libs/opencl-headers.cmake @@ -3,27 +3,29 @@ if(ENABLE_GITEE_EULER) set(GIT_TAG "7347fa1bb52ebee9f3d6c44ff65ef3c4253cab79") set(SHA256 "d41d8cd98f00b204e9800998ecf8427e") + if(EXISTS "${CMAKE_BINARY_DIR}/_deps/opencl-clhpp-src") + # Extracting tarball into git repository would make git-status tainted, and case cmake rebuild error. + # Here we clean source dir before rebuild to fix this error. + file(REMOVE_RECURSE "${CMAKE_BINARY_DIR}/_deps/opencl-clhpp-src") + file(REMOVE_RECURSE "${CMAKE_BINARY_DIR}/_deps/opencl-clhpp-build") + file(REMOVE_RECURSE "${CMAKE_BINARY_DIR}/_deps/opencl-clhpp-subbuild") + endif() + __download_pkg_with_git(OpenCL-CLHPP ${GIT_REPOSITORY} ${GIT_TAG} ${SHA256}) - set(OPENCL_CLHPP_SRC "${TOP_DIR}/mindspore/lite/build/_deps/opencl-clhpp-src") + set(OPENCL_CLHPP_SRC "${CMAKE_BINARY_DIR}/_deps/opencl-clhpp-src") execute_process(COMMAND tar -xf ${OPENCL_CLHPP_SRC}/v2.0.12.tar.gz --strip-components 1 -C ${OPENCL_CLHPP_SRC}) - set(OPENCL_HEADER_SRC "${TOP_DIR}/mindspore/lite/build/_deps/opencl-headers-src") - execute_process(COMMAND mkdir -p ${OPENCL_HEADER_SRC}) + set(OPENCL_HEADER_SRC "${CMAKE_BINARY_DIR}/_deps/opencl-headers-src") + file(MAKE_DIRECTORY "${OPENCL_HEADER_SRC}") execute_process(COMMAND tar -xf ${OPENCL_CLHPP_SRC}/v2020.12.18.tar.gz --strip-components 1 -C ${OPENCL_HEADER_SRC}) elseif(ENABLE_GITEE) set(REQ_URL "https://gitee.com/mirrors/OpenCL-Headers/repository/archive/v2020.12.18.tar.gz") set(SHA256 "076251b94284b931399ee525527bc9aef3f5f6f3f3b1964ae485218cc88956ba") __download_pkg(OpenCL-Headers ${REQ_URL} ${SHA256}) - set(REQ_URL "https://gitee.com/mirrors/OpenCL-CLHPP/repository/archive/v2.0.12.tar.gz") - set(SHA256 "d5bdbfb614a6494de97abf7297db6d2c88a55a095b12949d797ce562f5d4fdce") - __download_pkg(OpenCL-CLHPP ${REQ_URL} ${SHA256}) else() set(REQ_URL "https://github.com/KhronosGroup/OpenCL-Headers/archive/v2020.12.18.tar.gz") set(SHA256 "5dad6d436c0d7646ef62a39ef6cd1f3eba0a98fc9157808dfc1d808f3705ebc2") __download_pkg(OpenCL-Headers ${REQ_URL} ${SHA256}) - set(REQ_URL "https://github.com/KhronosGroup/OpenCL-CLHPP/archive/v2.0.12.tar.gz") - set(SHA256 "20b28709ce74d3602f1a946d78a2024c1f6b0ef51358b9686612669897a58719") - __download_pkg(OpenCL-CLHPP ${REQ_URL} ${SHA256}) endif() function(gene_opencl CL_SRC_DIR) diff --git a/cmake/external_libs/opencv.cmake b/cmake/external_libs/opencv.cmake index 0dfd5adc870..04c31505f44 100644 --- a/cmake/external_libs/opencv.cmake +++ b/cmake/external_libs/opencv.cmake @@ -28,7 +28,7 @@ if(ENABLE_GITEE_EULER) set(GIT_REPOSITORY "https://gitee.com/src-openeuler/opencv.git") set(GIT_TAG "openEuler-22.03-LTS") set(SHA256 "d8b00a5440c8e5d275aa5b141f89d69ee196d9dcd2d2032ddd8ef4b04010999a") - set(OPENCV_SRC "${TOP_DIR}/build/mindspore/_deps/opencv-src") + set(OPENCV_SRC "${CMAKE_BINARY_DIR}/_deps/opencv-src") __download_pkg_with_git(opencv ${GIT_REPOSITORY} ${GIT_TAG} ${SHA256}) execute_process(COMMAND tar -xf ${OPENCV_SRC}/opencv-4.5.2.tar.gz --strip-components 1 -C ${OPENCV_SRC}) else() diff --git a/cmake/external_libs/openssl.cmake b/cmake/external_libs/openssl.cmake index a506da22b40..b066aab39e9 100644 --- a/cmake/external_libs/openssl.cmake +++ b/cmake/external_libs/openssl.cmake @@ -1,4 +1,4 @@ -if(ENABLE_GITEE) +if(ENABLE_GITEE OR ENABLE_GITEE_EULER) # Channel GITEE_EULER is NOT supported now, use GITEE instead. set(REQ_URL "https://gitee.com/mirrors/openssl/repository/archive/OpenSSL_1_1_1k.tar.gz") set(SHA256 "b92f9d3d12043c02860e5e602e50a73ed21a69947bcc74d391f41148e9f6aa95") else() diff --git a/cmake/external_libs/protobuf.cmake b/cmake/external_libs/protobuf.cmake index fc19191f203..e4120b57530 100644 --- a/cmake/external_libs/protobuf.cmake +++ b/cmake/external_libs/protobuf.cmake @@ -50,7 +50,7 @@ set(CMAKE_CXX_FLAGS ${_ms_tmp_CMAKE_CXX_FLAGS}) string(REPLACE " -Wall" "" CMAKE_CXX_FLAGS "${CMAKE_CXX_FLAGS}") string(REPLACE " -Werror" "" CMAKE_CXX_FLAGS "${CMAKE_CXX_FLAGS}") -if(ENABLE_GITEE) +if(ENABLE_GITEE OR ENABLE_GITEE_EULER) # Channel GITEE_EULER is NOT supported now, use GITEE instead. set(REQ_URL "https://gitee.com/mirrors/protobuf_source/repository/archive/v3.13.0.tar.gz") set(SHA256 "ab9b39e7053a6fb06b01bf75fb6ec6a71a1ada5a5f8e2446f927336e97b9e7bb") else() diff --git a/cmake/external_libs/pybind11.cmake b/cmake/external_libs/pybind11.cmake index dff8d5f76a3..cb7245f0bc5 100644 --- a/cmake/external_libs/pybind11.cmake +++ b/cmake/external_libs/pybind11.cmake @@ -1,6 +1,6 @@ set(PYTHON_VERSION ${Python3_VERSION_MAJOR}.${Python3_VERSION_MINOR}) -if(ENABLE_GITEE) +if(ENABLE_GITEE OR ENABLE_GITEE_EULER) # Channel GITEE_EULER is NOT supported now, use GITEE instead. if(PYTHON_VERSION MATCHES "3.9") set(REQ_URL "https://gitee.com/mirrors/pybind11/repository/archive/v2.6.1.tar.gz") set(SHA256 "c840509be94ac97216c3b4a3ed9f3fdba9948dbe38c16fcfaee3acc6dc93ed0e") diff --git a/cmake/external_libs/robin.cmake b/cmake/external_libs/robin.cmake index 56889ec380f..85956c4a424 100644 --- a/cmake/external_libs/robin.cmake +++ b/cmake/external_libs/robin.cmake @@ -1,4 +1,4 @@ -if(ENABLE_GITEE) +if(ENABLE_GITEE OR ENABLE_GITEE_EULER) # Channel GITEE_EULER is NOT supported now, use GITEE instead. set(REQ_URL "https://gitee.com/mirrors/robin-hood-hashing/repository/archive/3.11.5.zip") set(SHA256 "8d1f5d5ee447e5827032d1eb8b1609134618b1cc5c5bcadfcbfed99a2d3583d4") else() diff --git a/mindspore/lite/cmake/lite_dependences.cmake b/mindspore/lite/cmake/lite_dependences.cmake index 1f5d107df4e..750540cf6b1 100644 --- a/mindspore/lite/cmake/lite_dependences.cmake +++ b/mindspore/lite/cmake/lite_dependences.cmake @@ -11,7 +11,8 @@ if(MSLITE_DEPS_FLATBUFFERS) endif() if(MSLITE_DEPS_OPENCL) - include(${TOP_DIR}/cmake/external_libs/opencl.cmake) + include(${TOP_DIR}/cmake/external_libs/opencl-headers.cmake) + include(${TOP_DIR}/cmake/external_libs/opencl-clhpp.cmake) endif() if(MSLITE_DEPS_JSON)