未验证 提交 a9d3cef9 编写于 作者: Z Zhenghai Zhang 提交者: GitHub

[cmake] add isl third_party cache (#55631)

* add isl third_party cache

* fix bug

* Update cinn.cmake
上级 dbd9743a
......@@ -331,7 +331,7 @@ set(ABSL_INCLUDE_DIR "${CMAKE_BINARY_DIR}/dist/third_party/absl/include")
include_directories(${ABSL_INCLUDE_DIR})
# Add isl
set(ISL_INCLUDE_DIR "${CMAKE_BINARY_DIR}/dist/third_party/isl/include")
set(ISL_INCLUDE_DIR "${CMAKE_BINARY_DIR}/third_party/install/isl/include")
include_directories(${ISL_INCLUDE_DIR})
# Add LLVM
......
......@@ -7,25 +7,62 @@ include(ExternalProject)
# static build
# CPPFLAGS="-fPIC -DPIC" ./configure --with-gmp-prefix=<gmp-install-path> --with-clang-prefix=<llvm-install-path> --enable-shared=no --enable-static=yes
set(ISL_FILE
"isl-6a1760fe.tar.gz"
CACHE STRING "" FORCE)
set(ISL_DOWNLOAD_URL
https://paddle-inference-dist.bj.bcebos.com/CINN/isl-6a1760fe.tar.gz)
set(ISL_MD5 fff10083fb79d394b8a7b7b2089f6183)
"https://paddle-inference-dist.bj.bcebos.com/CINN/${ISL_FILE}")
set(ISL_URL_MD5 fff10083fb79d394b8a7b7b2089f6183)
set(ISL_DOWNLOAD_DIR ${PADDLE_SOURCE_DIR}/third_party/isl)
set(ISL_PREFIX_DIR ${THIRD_PARTY_PATH}/isl)
set(ISL_INSTALL_DIR ${THIRD_PARTY_PATH}/install/isl)
function(download_isl)
message(
STATUS "Downloading ${ISL_DOWNLOAD_URL} to ${ISL_DOWNLOAD_DIR}/${ISL_FILE}")
file(
DOWNLOAD ${ISL_DOWNLOAD_URL} ${ISL_DOWNLOAD_DIR}/${ISL_FILE}
EXPECTED_MD5 ${ISL_URL_MD5}
STATUS ERR)
if(ERR EQUAL 0)
message(STATUS "Download ${ISL_FILE} success")
else()
message(
FATAL_ERROR
"Download failed, error: ${ERR}\n You can try downloading ${ISL_FILE} again"
)
endif()
endfunction()
# Download and check isl.
if(EXISTS ${ISL_DOWNLOAD_DIR}/${ISL_FILE})
file(MD5 ${ISL_DOWNLOAD_DIR}/${ISL_FILE} ISL_MD5)
if(NOT ISL_MD5 STREQUAL ISL_URL_MD5)
# clean build file
file(REMOVE_RECURSE ${ISL_PREFIX_DIR})
file(REMOVE_RECURSE ${ISL_INSTALL_DIR})
download_isl()
endif()
else()
download_isl()
endif()
ExternalProject_Add(
external_isl
${EXTERNAL_PROJECT_LOG_ARGS}
URL ${ISL_DOWNLOAD_URL}
URL_MD5 ${ISL_MD5}
PREFIX ${THIRD_PARTY_PATH}/isl
SOURCE_DIR ${THIRD_PARTY_PATH}/install/isl
URL ${ISL_DOWNLOAD_DIR}/${ISL_FILE}
URL_MD5 ${ISL_URL_MD5}
DOWNLOAD_DIR ${ISL_DOWNLOAD_DIR}
PREFIX ${ISL_PREFIX_DIR}
SOURCE_DIR ${ISL_INSTALL_DIR}
CONFIGURE_COMMAND ""
BUILD_COMMAND ""
UPDATE_COMMAND ""
INSTALL_COMMAND ""
BUILD_BYPRODUCTS ${THIRD_PARTY_PATH}/install/isl/lib/libisl.a)
BUILD_BYPRODUCTS ${ISL_INSTALL_DIR}/lib/libisl.a)
add_library(isl STATIC IMPORTED GLOBAL)
set_property(TARGET isl PROPERTY IMPORTED_LOCATION
${THIRD_PARTY_PATH}/install/isl/lib/libisl.a)
${ISL_INSTALL_DIR}/lib/libisl.a)
add_dependencies(isl external_isl)
include_directories(${THIRD_PARTY_PATH}/install/isl/include)
include_directories(${ISL_INSTALL_DIR}/include)
Markdown is supported
0% .
You are about to add 0 people to the discussion. Proceed with caution.
先完成此消息的编辑!
想要评论请 注册