Skip to content

Commit

Permalink
Clean 7zip deps: cmake always provide tar, right?
Browse files Browse the repository at this point in the history
  • Loading branch information
jlblancoc committed Feb 5, 2015
1 parent 7734d28 commit 6710cfd
Show file tree
Hide file tree
Showing 2 changed files with 15 additions and 43 deletions.
3 changes: 1 addition & 2 deletions README.md
Original file line number Diff line number Diff line change
Expand Up @@ -12,8 +12,7 @@ The goal is using one single CMake code to build against *SuiteSparse* in standa
* (1) Install [CMake](http://www.cmake.org/).
* (2) Only for Linux/Mac: Install LAPACK & BLAS. In Debian/Ubuntu: `sudo apt-get install liblapack-dev libblas-dev`
* (3) Clone or download this project ([latest release](https://github.com/jlblancoc/suitesparse-metis-for-windows/releases)) and extract it somewhere in your disk, say `SP_ROOT`.
* In Windows, install [7-Zip](http://www.7-zip.org/) if you want CMake to download SuiteSparse sources automatically for you.
* (OPTIONAL) Otherwise, manually install SuiteSparse as follows:
* (OPTIONAL) CMake will download SuiteSparse sources automatically for you (skip to step 4), but you may do it manually if preferred:
* Populate the directories within `SP_ROOT` with the original sources from each project:
* *`SuiteSparse`:*
* Download [SuiteSparse-X.Y.Z.tar.gz](http://www.cise.ufl.edu/research/sparse/SuiteSparse/) from Tim Davis' webpage.
Expand Down
55 changes: 14 additions & 41 deletions checkGetSuiteSparse.cmake
Original file line number Diff line number Diff line change
Expand Up @@ -12,47 +12,21 @@
## Created by jesnault (jerome.esnault@inria.fr) 2014-01-21
## Updated by jesnault (jerome.esnault@inria.fr) 2014-01-21

if(POLICY CMP0053)
cmake_policy(SET CMP0053 OLD) # To correctly interpret the 7-zip strings below
endif()

## try first with 7-Zip, and with standard cmake tar command otherwise
## use standard cmake tar command
macro(SuiteSparse_unzip whichZipFile)
find_program(7ZIP_CMD NAMES 7z DOC "7-zip executable"
PATHS "$ENV{PROGRAMFILES}/7-Zip" "$ENV{PROGRAMFILES(x86)}/7-Zip"
/usr/bin /usr/local/bin
)
if(OFF)
message(STATUS "unzip: please, wait until ${7ZIP_CMD} finished...")
execute_process( COMMAND ${7ZIP_CMD} x ${whichZipFile} -y
WORKING_DIRECTORY ${CMAKE_SOURCE_DIR} TIMEOUT 120
RESULT_VARIABLE resVar OUTPUT_VARIABLE outVar ERROR_VARIABLE errVar
)
if(${resVar} MATCHES "0")
message(STATUS "SuiteSparse just unziped in the source dir") ## OK
set(SUITESPARSE_DL_LAST OFF CACHE BOOL "get the last version of suiteSparse" FORCE)
else()
message(WARNING "something wrong with ${7ZIP_CMD} command, redo or try to unzip by yourself...")
message("unzip: outVar=${outVar}")
message("unzip: errVar=${errVar}")
endif()
get_filename_component(zipFile ${whichZipFile} NAME)
message(STATUS "unzip: please, wait until tar xzf ${whichZipFile} finished...")
execute_process( COMMAND ${CMAKE_COMMAND} -E tar xzf ${zipFile}
WORKING_DIRECTORY ${CMAKE_SOURCE_DIR} TIMEOUT 120
RESULT_VARIABLE resVar OUTPUT_VARIABLE outVar ERROR_VARIABLE errVar
)
if(${resVar} MATCHES "0")
message(STATUS "SuiteSparse just unziped in the source dir") ## OK
set(SUITESPARSE_DL_LAST OFF CACHE BOOL "get the last version of suiteSparse" FORCE)
else()
get_filename_component(zipFile ${whichZipFile} NAME)
message(STATUS "unzip: please, wait until tar xzf ${whichZipFile} finished...")
execute_process( COMMAND ${CMAKE_COMMAND} -E tar xzf ${zipFile}
WORKING_DIRECTORY ${CMAKE_SOURCE_DIR} TIMEOUT 120
RESULT_VARIABLE resVar OUTPUT_VARIABLE outVar ERROR_VARIABLE errVar
)
if(${resVar} MATCHES "0")
message(STATUS "SuiteSparse just unziped in the source dir") ## OK
set(SUITESPARSE_DL_LAST OFF CACHE BOOL "get the last version of suiteSparse" FORCE)
else()
message(WARNING "something wrong with cmake tar command, redo or try to unzip by yourself...")
message("unzip: outVar=${outVar}")
message("unzip: errVar=${errVar}")
message("Or try to get 7zip (http://www.7-zip.org/download.html) to unzip the downloaded dir.")
set(7ZIP_CMD "" CACHE FILEPATH "7-zip executable")
endif()
message(WARNING "something wrong with cmake tar command, redo or try to unzip by yourself...")
message("unzip: outVar=${outVar}")
message("unzip: errVar=${errVar}")
endif()
endmacro()

Expand Down Expand Up @@ -84,6 +58,5 @@ if(SUITESPARSE_DL_LAST)
endif()
if(EXISTS "${SUITESPARSE_ZIP}")
execute_process(COMMAND "${CMAKE_COMMAND}" -E remove "${SUITESPARSE_ZIP}")
endif()

endif()
endif()

0 comments on commit 6710cfd

Please sign in to comment.