[MSLITE] split opencl.cmake to two third-party deps: opencl-headers and opencl-clhpp

This commit is contained in:
Zhu Guodong 2023-01-11 11:27:16 +08:00
parent 165f31036d
commit ef5b063565
14 changed files with 36 additions and 21 deletions

View File

@ -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()

View File

@ -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})

View File

@ -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()

View File

@ -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")

View File

@ -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()

View File

@ -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")

View File

@ -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()

View File

@ -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)

View File

@ -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()

View File

@ -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()

View File

@ -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()

View File

@ -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")

View File

@ -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()

View File

@ -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)