Skip to content

Commit

Permalink
[cmake] fix file check (#54614)
Browse files Browse the repository at this point in the history
* [cmake] fix file check error

* [cmake] fix file check
  • Loading branch information
gouzil authored Jun 19, 2023
1 parent 3355c0c commit bae32a0
Show file tree
Hide file tree
Showing 4 changed files with 20 additions and 32 deletions.
13 changes: 5 additions & 8 deletions cmake/external/cusparselt.cmake
Original file line number Diff line number Diff line change
Expand Up @@ -65,16 +65,13 @@ function(download_cusparselt)
endif()
endfunction()

find_file(
LOCAL_CUSPARSELT_LIB_ZIP
NAMES ${CUSPARSELT_CACHE_FILENAME}
PATHS ${CUSPARSELT_DOWNLOAD_DIR}
NO_DEFAULT_PATH)

if(LOCAL_CUSPARSELT_LIB_ZIP)
if(EXISTS ${CUSPARSELT_DOWNLOAD_DIR}/${CUSPARSELT_CACHE_FILENAME})
file(MD5 ${CUSPARSELT_DOWNLOAD_DIR}/${CUSPARSELT_CACHE_FILENAME}
CUSPARSELT_MD5)
if(NOT CUSPARSELT_MD5 EQUAL CUSPARSELT_URL_MD5)
if(NOT CUSPARSELT_MD5 STREQUAL CUSPARSELT_URL_MD5)
# clean build file
file(REMOVE_RECURSE ${CUSPARSELT_PREFIX_DIR})
file(REMOVE_RECURSE ${CUSPARSELT_INSTALL_DIR})
download_cusparselt()
endif()
else()
Expand Down
13 changes: 5 additions & 8 deletions cmake/external/lapack.cmake
Original file line number Diff line number Diff line change
Expand Up @@ -81,16 +81,13 @@ function(download_lapack)
endif()
endfunction()

find_file(
LOCAL_LAPACK_LIB_ZIP
NAMES ${LAPACK_FILE}
PATHS ${LAPACK_DOWNLOAD_DIR}
NO_DEFAULT_PATH)

# Download and check lapack.
if(LOCAL_LAPACK_LIB_ZIP)
if(EXISTS ${LAPACK_DOWNLOAD_DIR}/${LAPACK_FILE})
file(MD5 ${LAPACK_DOWNLOAD_DIR}/${LAPACK_FILE} LAPACK_MD5)
if(NOT LAPACK_MD5 EQUAL LAPACK_URL_MD5)
if(NOT LAPACK_MD5 STREQUAL LAPACK_URL_MD5)
# clean build file
file(REMOVE_RECURSE ${LAPACK_PREFIX_DIR})
file(REMOVE_RECURSE ${LAPACK_INSTALL_DIR})
download_lapack()
endif()
else()
Expand Down
13 changes: 5 additions & 8 deletions cmake/external/mklml.cmake
Original file line number Diff line number Diff line change
Expand Up @@ -71,16 +71,13 @@ function(download_mklml)
endif()
endfunction()

find_file(
LOCAL_MKLML_LIB_ZIP
NAMES ${MKLML_FILE}
PATHS ${MKLML_DOWNLOAD_DIR}
NO_DEFAULT_PATH)

# Download and check mklml.
if(LOCAL_MKLML_LIB_ZIP)
if(EXISTS ${MKLML_DOWNLOAD_DIR}/${MKLML_FILE})
file(MD5 ${MKLML_DOWNLOAD_DIR}/${MKLML_FILE} MKLML_MD5)
if(NOT MKLML_MD5 EQUAL MKLML_URL_MD5)
if(NOT MKLML_MD5 STREQUAL MKLML_URL_MD5)
# clean build file
file(REMOVE_RECURSE ${MKLML_PREFIX_DIR})
file(REMOVE_RECURSE ${MKLML_INSTALL_DIR})
download_mklml()
endif()
else()
Expand Down
13 changes: 5 additions & 8 deletions cmake/external/onnxruntime.cmake
Original file line number Diff line number Diff line change
Expand Up @@ -129,16 +129,13 @@ function(download_onnxruntime)
endif()
endfunction()

find_file(
LOCAL_ONNXRUNTIME_LIB_ZIP
NAMES ${ONNXRUNTIME_CACHE_FILENAME}
PATHS ${ONNXRUNTIME_DOWNLOAD_DIR}
NO_DEFAULT_PATH)

if(LOCAL_ONNXRUNTIME_LIB_ZIP)
if(EXISTS ${ONNXRUNTIME_DOWNLOAD_DIR}/${ONNXRUNTIME_CACHE_FILENAME})
file(MD5 ${ONNXRUNTIME_DOWNLOAD_DIR}/${ONNXRUNTIME_CACHE_FILENAME}
ONNXRUNTIME_MD5)
if(NOT ONNXRUNTIME_MD5 EQUAL ONNXRUNTIME_URL_MD5)
if(NOT ONNXRUNTIME_MD5 STREQUAL ONNXRUNTIME_URL_MD5)
# clean build file
file(REMOVE_RECURSE ${ONNXRUNTIME_PREFIX_DIR})
file(REMOVE_RECURSE ${ONNXRUNTIME_INSTALL_DIR})
download_onnxruntime()
endif()
else()
Expand Down

0 comments on commit bae32a0

Please sign in to comment.