From 56b27d1d00b08af2cba16197cc7b5f5eed98bca0 Mon Sep 17 00:00:00 2001 From: mmazaherit Date: Mon, 5 Jun 2017 21:11:09 -0400 Subject: [PATCH] -use metis library in vcpkg -improved port script --- ports/suitesparse/CONTROL | 2 +- .../suitesparse/fix-install-suitesparse.patch | 35 +++++---- ports/suitesparse/metis.patch | 13 ---- ports/suitesparse/portfile.cmake | 71 +++++++++---------- 4 files changed, 51 insertions(+), 70 deletions(-) delete mode 100644 ports/suitesparse/metis.patch diff --git a/ports/suitesparse/CONTROL b/ports/suitesparse/CONTROL index 2371122574f..a40b4ff2469 100644 --- a/ports/suitesparse/CONTROL +++ b/ports/suitesparse/CONTROL @@ -1,4 +1,4 @@ Source: suitesparse Version: 4.5.5 -Build-Depends: metis, clapack +Build-Depends:metis, clapack Description: algebra library diff --git a/ports/suitesparse/fix-install-suitesparse.patch b/ports/suitesparse/fix-install-suitesparse.patch index ca8cbbd972d..4da6e73f405 100644 --- a/ports/suitesparse/fix-install-suitesparse.patch +++ b/ports/suitesparse/fix-install-suitesparse.patch @@ -1,19 +1,16 @@ -diff --git "a/CMakeLists.txt" "b/CMakeLists.txt" -index 679df4e..0a01d47 100644 ---- "a/CMakeLists.txt" -+++ "b/CMakeLists.txt" -@@ -106,10 +106,10 @@ macro(install_suitesparse_project targetName headersList) - set_target_properties(${targetName} PROPERTIES PUBLIC_HEADER "${headersList}") - install(TARGETS ${targetName} - EXPORT SuiteSparse -- RUNTIME DESTINATION bin -- LIBRARY DESTINATION lib${LIB_POSTFIX} -- ARCHIVE DESTINATION lib${LIB_POSTFIX} -- PUBLIC_HEADER DESTINATION include/suitesparse -+ RUNTIME DESTINATION ${suitesparse_PKG_DIR}/$<$:Debug/>bin -+ LIBRARY DESTINATION ${suitesparse_PKG_DIR}/$<$:Debug/>lib -+ ARCHIVE DESTINATION ${suitesparse_PKG_DIR}/$<$:Debug/>lib -+ PUBLIC_HEADER DESTINATION ${suitesparse_PKG_DIR}/include/suitesparse - ) - endmacro() - +diff --git "a/SuiteSparse/CMakeLists.txt" "b/SuiteSparse/CMakeLists.txt" +index 7361363..8a48cf3 100644 +--- "a/SuiteSparse/CMakeLists.txt" ++++ "b/SuiteSparse/CMakeLists.txt" +@@ -10,7 +10,11 @@ ENDIF(CMAKE_COMPILER_IS_GNUCXX AND NOT CMAKE_BUILD_TYPE MATCHES "Debug") + IF (BUILD_METIS) + INCLUDE_DIRECTORIES("${METIS_SOURCE_DIR}/include") + ELSE (BUILD_METIS) ++ IF(USE_VCPKG_METIS) ++ INCLUDE_DIRECTORIES("${METIS_SOURCE_DIR}/include") ++ ELSE (USE_VCPKG_METIS) + ADD_DEFINITIONS(-DNPARTITION) ++ ENDIF(USE_VCPKG_METIS) + ENDIF ( BUILD_METIS) + + # Disable COMPLEX numbers: disable it by default, since it causes problems in some platforms. diff --git a/ports/suitesparse/metis.patch b/ports/suitesparse/metis.patch deleted file mode 100644 index aab5229af5f..00000000000 --- a/ports/suitesparse/metis.patch +++ /dev/null @@ -1,13 +0,0 @@ -diff --git "a/GKlib/gk_arch.h" "b/GKlib/gk_arch.h" -index 01c72e56..2cb80ccf 100644 ---- "a/GKlib/gk_arch.h" -+++ "b/GKlib/gk_arch.h" -@@ -60,7 +60,7 @@ typedef ptrdiff_t ssize_t; - - #ifdef __MSC__ - /* MSC does not have rint() function */ --#define rint(x) ((int)((x)+0.5)) -+//#define rint(x) ((int)((x)+0.5)) - - /* MSC does not have INFINITY defined */ - #ifndef INFINITY diff --git a/ports/suitesparse/portfile.cmake b/ports/suitesparse/portfile.cmake index 0e5e9ad4bb7..1deb3a39e6b 100644 --- a/ports/suitesparse/portfile.cmake +++ b/ports/suitesparse/portfile.cmake @@ -13,70 +13,67 @@ include(vcpkg_common_functions) set(SUITESPARSE_VER SuiteSparse-4.5.5) #if you change the version, becarefull of changing the SHA512 checksum accordingly -set(METIS_VER metis-5.1.0) set(SUITESPARSEWIN_PATH ${CURRENT_BUILDTREES_DIR}/src/suitesparse-metis-for-windows-1.3.1) set(SUITESPARSE_PATH ${SUITESPARSEWIN_PATH}/Suitesparse) -set(METIS_PATH ${SUITESPARSEWIN_PATH}/metis) -#CMake scripts for painless usage of SuiteSparse+METIS from Visual Studio and the rest of Windows/Linux/OSX IDEs supported by CMake -vcpkg_download_distfile(SUITESPARSEWIN -URLS "https://github.com/jlblancoc/suitesparse-metis-for-windows/archive/v1.3.1.zip" -FILENAME "suitesparse-metis-for-windows-1.3.1.zip" -SHA512 f8b9377420432f1c0a05bf884fe9e72f1f4eaf7e05663c66a383b5d8ddbd4fbfaa7d433727b4dc3e66b41dbb96b1327d380b68a51a424276465512666e63393d -) -#suitesparse libary +#download suitesparse libary vcpkg_download_distfile(SUITESPARSE URLS "http://faculty.cse.tamu.edu/davis/SuiteSparse/${SUITESPARSE_VER}.tar.gz" FILENAME "${SUITESPARSE_VER}.tar.gz" SHA512 4337c683027efca6c0800815587409db14db7d70df673451e307eb3ece5538815d06d90f3a831fa45071372f70b6f37eaa68fe951f69dbb52a5bfd84d2dc4913 ) -#Metis library -vcpkg_download_distfile(METIS - URLS "http://glaros.dtc.umn.edu/gkhome/fetch/sw/metis/${METIS_VER}.tar.gz" - FILENAME "${METIS_VER}.tar.gz" - SHA512 deea47749d13bd06fbeaf98a53c6c0b61603ddc17a43dae81d72c8015576f6495fd83c11b0ef68d024879ed5415c14ebdbd87ce49c181bdac680573bea8bdb25 + +#download suitesparse-metis-for-windows scripts, suitesparse does not have CMake build system, jlblancoc has made one for it +vcpkg_download_distfile(SUITESPARSEWIN +URLS "https://github.com/jlblancoc/suitesparse-metis-for-windows/archive/v1.3.1.zip" +FILENAME "suitesparse-metis-for-windows-1.3.1.zip" +SHA512 f8b9377420432f1c0a05bf884fe9e72f1f4eaf7e05663c66a383b5d8ddbd4fbfaa7d433727b4dc3e66b41dbb96b1327d380b68a51a424276465512666e63393d ) +#extract suitesparse-metis-for-windows first and merge with suitesparse library vcpkg_extract_source_archive(${SUITESPARSEWIN}) - -#extract suitesparse and copy into suitesparse folder in suitesparse-metis-for-windows package vcpkg_extract_source_archive(${SUITESPARSE} ${SUITESPARSEWIN_PATH}) -#extract metis and copy into metis folder in suitesparse-metis-for-windows package -vcpkg_extract_source_archive(${METIS}) -file(COPY ${CURRENT_BUILDTREES_DIR}/src/${METIS_VER} DESTINATION ${METIS_PATH}) - - -vcpkg_apply_patches( - SOURCE_PATH ${METIS_PATH} - PATCHES "${CMAKE_CURRENT_LIST_DIR}/metis.patch" -) vcpkg_apply_patches( SOURCE_PATH ${SUITESPARSEWIN_PATH} PATCHES "${CMAKE_CURRENT_LIST_DIR}/fix-install-suitesparse.patch" ) - vcpkg_configure_cmake( SOURCE_PATH ${SUITESPARSEWIN_PATH} - PREFER_NINJA # Disable this option if project cannot be built with Ninja + #PREFER_NINJA # Disable this option if project cannot be built with Ninja OPTIONS - -DBUILD_METIS=ON + + -DBUILD_METIS=OFF #Disable the option to build metis from source + -DUSE_VCPKG_METIS=ON #Force using vcpckg metis library + -DMETIS_SOURCE_DIR=${CURRENT_INSTALLED_DIR} + -DSUITESPARSE_USE_CUSTOM_BLAS_LAPACK_LIBS=ON - -DSUITESPARSE_CUSTOM_BLAS_LIB=${VCPKG_ROOT_DIR}/packages/openblas_${TARGET_TRIPLET}/lib/openblas.lib - -DSUITESPARSE_CUSTOM_LAPACK_LIB=${VCPKG_ROOT_DIR}/packages/clapack_${TARGET_TRIPLET}/lib/lapack.lib - -Dsuitesparse_PKG_DIR=${CURRENT_PACKAGES_DIR} - #OPTIONS_RELEASE - #OPTIONS_DEBUG + -DSUITESPARSE_CUSTOM_BLAS_LIB=${CURRENT_INSTALLED_DIR}/lib/openblas.lib + -DSUITESPARSE_CUSTOM_LAPACK_LIB=${CURRENT_INSTALLED_DIR}/lib/lapack.lib + + -DLIB_POSTFIX= + OPTIONS_DEBUG + -DSUITESPARSE_INSTALL_PREFIX=${CURRENT_PACKAGES_DIR}/debug + OPTIONS_RELEASE + -DSUITESPARSE_INSTALL_PREFIX=${CURRENT_PACKAGES_DIR} ) + vcpkg_install_cmake() +#clean folders +file(REMOVE_RECURSE ${CURRENT_PACKAGES_DIR}/debug/include) +file(REMOVE_RECURSE ${CURRENT_PACKAGES_DIR}/debug/cmake) +file(REMOVE_RECURSE ${CURRENT_PACKAGES_DIR}/cmake) +file(GLOB REMFILES ${CURRENT_PACKAGES_DIR}/debug/*.*) +file(REMOVE ${REMFILES}) +file(GLOB REMFILES ${CURRENT_PACKAGES_DIR}/*.*) +file(REMOVE ${REMFILES}) -# Handle copyright of suitesparse and metis +# Handle copyright of suitesparse and suitesparse-metis-for-windows file(COPY ${SUITESPARSE_PATH}/LICENSE.txt DESTINATION ${CURRENT_PACKAGES_DIR}/share/suitesparse) file(RENAME ${CURRENT_PACKAGES_DIR}/share/suitesparse/LICENSE.txt ${CURRENT_PACKAGES_DIR}/share/suitesparse/copyright) -file(COPY ${METIS_PATH}/LICENSE.txt DESTINATION ${CURRENT_PACKAGES_DIR}/share/suitesparse) -file(RENAME ${CURRENT_PACKAGES_DIR}/share/suitesparse/LICENSE.txt ${CURRENT_PACKAGES_DIR}/share/suitesparse/copyright_metis) +file(COPY ${SUITESPARSEWIN_PATH}/LICENSE.md DESTINATION ${CURRENT_PACKAGES_DIR}/share/suitesparse) +file(RENAME ${CURRENT_PACKAGES_DIR}/share/suitesparse/LICENSE.md ${CURRENT_PACKAGES_DIR}/share/suitesparse/copyright_suitesparse-metis-for-windows) -vcpkg_copy_pdbs() \ No newline at end of file