From 62db2c9b4883a1dd3f9700abd2aa505999a70825 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Markus=20M=C3=BCtzel?= Date: Mon, 18 Sep 2023 12:34:37 +0200 Subject: [PATCH 01/24] Add root CMakeLists.txt for SuiteSparse_config and AMD --- AMD/CMakeLists.txt | 46 ++++++++-------- CMakeLists.txt | 90 +++++++++++++++++++++++++++++++ SuiteSparse_config/CMakeLists.txt | 27 ++++++---- 3 files changed, 130 insertions(+), 33 deletions(-) create mode 100644 CMakeLists.txt diff --git a/AMD/CMakeLists.txt b/AMD/CMakeLists.txt index 4f03c34f7..4c3dbd966 100644 --- a/AMD/CMakeLists.txt +++ b/AMD/CMakeLists.txt @@ -2,7 +2,7 @@ # SuiteSparse/AMD/CMakeLists.txt: cmake for AMD #------------------------------------------------------------------------------- -# Copyright (c) 1996-2022, Timothy A. Davis, Patrick Amestoy, Iain Duff. +# Copyright (c) 1996-2023, Timothy A. Davis, Patrick Amestoy, Iain Duff. # All Rights Reserved. # SPDX-License-Identifier: BSD-3-clause @@ -13,48 +13,47 @@ cmake_minimum_required ( VERSION 3.20 ) set ( AMD_DATE "Sept 18, 2023" ) -set ( AMD_VERSION_MAJOR 3 ) -set ( AMD_VERSION_MINOR 2 ) -set ( AMD_VERSION_SUB 1 ) +set ( AMD_VERSION_MAJOR 3 CACHE STRING "" FORCE ) +set ( AMD_VERSION_MINOR 2 CACHE STRING "" FORCE ) +set ( AMD_VERSION_SUB 1 CACHE STRING "" FORCE ) message ( STATUS "Building AMD version: v" ${AMD_VERSION_MAJOR}. ${AMD_VERSION_MINOR}. ${AMD_VERSION_SUB} " (" ${AMD_DATE} ")" ) +#------------------------------------------------------------------------------- +# define the project +#------------------------------------------------------------------------------- + +project ( amd + VERSION "${AMD_VERSION_MAJOR}.${AMD_VERSION_MINOR}.${AMD_VERSION_SUB}" + LANGUAGES C ) + #------------------------------------------------------------------------------- # SuiteSparse policies #------------------------------------------------------------------------------- set ( CMAKE_MODULE_PATH ${CMAKE_MODULE_PATH} - ${CMAKE_SOURCE_DIR}/../SuiteSparse_config/cmake_modules ) + ${PROJECT_SOURCE_DIR}/../SuiteSparse_config/cmake_modules ) include ( SuiteSparsePolicy ) -#------------------------------------------------------------------------------- -# define the project -#------------------------------------------------------------------------------- - if ( NOT NFORTRAN ) # Fortan is available and enabled - project ( amd - VERSION "${AMD_VERSION_MAJOR}.${AMD_VERSION_MINOR}.${AMD_VERSION_SUB}" - LANGUAGES C Fortran ) -else ( ) - # no Fortran compiler available; do not compile Source/*.f or Demo/*.f - project ( amd - VERSION "${AMD_VERSION_MAJOR}.${AMD_VERSION_MINOR}.${AMD_VERSION_SUB}" - LANGUAGES C ) + enable_language ( Fortran ) endif ( ) #------------------------------------------------------------------------------- # find library dependencies #------------------------------------------------------------------------------- -find_package ( SuiteSparse_config 7.2.0 - PATHS ${CMAKE_SOURCE_DIR}/../SuiteSparse_config/build NO_DEFAULT_PATH ) -if ( NOT TARGET SuiteSparse::SuiteSparseConfig ) - find_package ( SuiteSparse_config 7.2.0 REQUIRED ) +if ( NOT SUITESPARSE_ROOT_CMAKELISTS ) + find_package ( SuiteSparse_config 7.2.0 + PATHS ${CMAKE_SOURCE_DIR}/../SuiteSparse_config/build NO_DEFAULT_PATH ) + if ( NOT TARGET SuiteSparse::SuiteSparseConfig ) + find_package ( SuiteSparse_config 7.2.0 REQUIRED ) + endif ( ) endif ( ) #------------------------------------------------------------------------------- @@ -271,5 +270,6 @@ endif ( ) # report status #------------------------------------------------------------------------------- -include ( SuiteSparseReport ) - +if ( NOT SUITESPARSE_ROOT_CMAKELISTS ) + include ( SuiteSparseReport ) +endif ( ) diff --git a/CMakeLists.txt b/CMakeLists.txt new file mode 100644 index 000000000..366866766 --- /dev/null +++ b/CMakeLists.txt @@ -0,0 +1,90 @@ +#------------------------------------------------------------------------------- +# SuiteSparse/CMakeLists.txt: root CMake build rules +#------------------------------------------------------------------------------- + +# Copyright (c) 2023, Timothy A. Davis. +# All Rights Reserved. + +# The actually required minimum CMake version might be higher depending on the +# selected SuiteSparse projects. +cmake_minimum_required ( VERSION 3.20 ) + +project ( "SuiteSparse" ) + +#------------------------------------------------------------------------------- +# build options +#------------------------------------------------------------------------------- + +# lower-case list of all projects that can be built by this root CMake file +set ( SUITESPARSE_KNOWN_PROJECTS + "suitesparse_config;amd" ) + +set ( SUITESPARSE_ENABLE_PROJECTS "all" CACHE STRING + "Semicolon-separated list of SuiteSparse projects to be built (${SUITESPARSE_KNOWN_PROJECTS}, or \"all\")" ) + +# expand "all" early on +if ( SUITESPARSE_ENABLE_PROJECTS STREQUAL "all" ) + set ( SUITESPARSE_ENABLE_PROJECTS ${SUITESPARSE_KNOWN_PROJECTS} ) +endif ( ) + +# check for unknown projects in list +foreach ( proj ${SUITESPARSE_ENABLE_PROJECTS} ) + if ( NOT "${proj}" IN_LIST SUITESPARSE_KNOWN_PROJECTS ) + message ( FATAL_ERROR "${proj} is not a known project: ${SUITESPARSE_KNOWN_PROJECTS}." ) + endif ( ) +endforeach ( ) + +#------------------------------------------------------------------------------- +# global variables +#------------------------------------------------------------------------------- + +# Set to indicate that we are building from a root CMake file. +# That will change the directory layout and (imported) target names (namespace!) +# during the build process. +set ( SUITESPARSE_ROOT_CMAKELISTS ON ) + +#------------------------------------------------------------------------------- +# common SuiteSparse modules +#------------------------------------------------------------------------------- + +set ( CMAKE_MODULE_PATH ${CMAKE_MODULE_PATH} + ${CMAKE_SOURCE_DIR}/SuiteSparse_config/cmake_modules ) + +include ( SuiteSparsePolicy ) + +#------------------------------------------------------------------------------- +# check/add project dependencies +#------------------------------------------------------------------------------- + +if ( "amd" IN_LIST SUITESPARSE_ENABLE_PROJECTS ) + if ( NOT "suitesparse_config" IN_LIST SUITESPARSE_ENABLE_PROJECTS ) + message ( STATUS "Adding \"suitesparse_config\" to the list of built targets." ) + list ( APPEND SUITESPARSE_ENABLE_PROJECTS "suitesparse_config" ) + endif ( ) +endif ( ) + +#------------------------------------------------------------------------------- +# include selected projects +#------------------------------------------------------------------------------- + +if ( "suitesparse_config" IN_LIST SUITESPARSE_ENABLE_PROJECTS ) + add_subdirectory ( "SuiteSparse_config" ) + add_library ( SuiteSparse::SuiteSparseConfig ALIAS SuiteSparseConfig ) + if ( NOT NSTATIC ) + add_library ( SuiteSparse::SuiteSparseConfig_static ALIAS SuiteSparseConfig_static ) + endif ( ) +endif ( ) + +if ( "amd" IN_LIST SUITESPARSE_ENABLE_PROJECTS ) + add_subdirectory ( "AMD" ) + add_library ( SuiteSparse::AMD ALIAS AMD ) + if ( NOT NSTATIC ) + add_library ( SuiteSparse::AMD_static ALIAS AMD_static ) + endif ( ) +endif ( ) + +#------------------------------------------------------------------------------- +# report status +#------------------------------------------------------------------------------- + +include ( SuiteSparseReport ) diff --git a/SuiteSparse_config/CMakeLists.txt b/SuiteSparse_config/CMakeLists.txt index 7add4060d..287e3499f 100644 --- a/SuiteSparse_config/CMakeLists.txt +++ b/SuiteSparse_config/CMakeLists.txt @@ -18,18 +18,29 @@ set ( SUITESPARSE_DATE "Oct 31, 2023" ) set ( SUITESPARSE_VERSION_MAJOR 7 ) set ( SUITESPARSE_VERSION_MINOR 3 ) set ( SUITESPARSE_VERSION_SUB 1 ) +set ( SUITESPARSE_CONFIG_VERSION_MAJOR ${SUITESPARSE_VERSION_MAJOR} CACHE STRING "" FORCE ) +set ( SUITESPARSE_CONFIG_VERSION_MINOR ${SUITESPARSE_VERSION_MINOR} CACHE STRING "" FORCE ) +set ( SUITESPARSE_CONFIG_VERSION_PATCH ${SUITESPARSE_VERSION_SUB} CACHE STRING "" FORCE ) message ( STATUS "Building SuiteSparse_config version: v" ${SUITESPARSE_VERSION_MAJOR}. ${SUITESPARSE_VERSION_MINOR}. ${SUITESPARSE_VERSION_SUB} " (" ${SUITESPARSE_DATE} ")" ) +#------------------------------------------------------------------------------- +# define the project +#------------------------------------------------------------------------------- + +project ( SuiteSparseConfig + VERSION "${SUITESPARSE_VERSION_MAJOR}.${SUITESPARSE_VERSION_MINOR}.${SUITESPARSE_VERSION_SUB}" + LANGUAGES C ) + #------------------------------------------------------------------------------- # SuiteSparse policies #------------------------------------------------------------------------------- set ( CMAKE_MODULE_PATH ${CMAKE_MODULE_PATH} - ${CMAKE_SOURCE_DIR}/cmake_modules ) + ${PROJECT_SOURCE_DIR}/cmake_modules ) include ( SuiteSparsePolicy ) @@ -41,14 +52,6 @@ else ( ) set ( FortranCInterface_GLOBAL__MACRO ${SUITESPARSE_C_TO_FORTRAN} ) endif ( ) -#------------------------------------------------------------------------------- -# define the project -#------------------------------------------------------------------------------- - -project ( SuiteSparseConfig - VERSION "${SUITESPARSE_VERSION_MAJOR}.${SUITESPARSE_VERSION_MINOR}.${SUITESPARSE_VERSION_SUB}" - LANGUAGES C ) - #------------------------------------------------------------------------------- # find library dependencies #------------------------------------------------------------------------------- @@ -232,6 +235,10 @@ if ( NOT MSVC ) DESTINATION ${SUITESPARSE_PKGFILEDIR}/pkgconfig ) endif ( ) +#------------------------------------------------------------------------------- +# report status #------------------------------------------------------------------------------- -include ( SuiteSparseReport ) +if ( NOT SUITESPARSE_ROOT_CMAKELISTS ) + include ( SuiteSparseReport ) +endif ( ) From 9fdc34b0145ef3f968b4c11c4a8d67800c228bb6 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Markus=20M=C3=BCtzel?= Date: Mon, 18 Sep 2023 12:53:24 +0200 Subject: [PATCH 02/24] Add Mongoose to the root CMakeLists.txt --- CMakeLists.txt | 13 ++++++++-- Mongoose/CMakeLists.txt | 56 ++++++++++++++++++++++++++++------------- 2 files changed, 49 insertions(+), 20 deletions(-) diff --git a/CMakeLists.txt b/CMakeLists.txt index 366866766..5a3f9fcde 100644 --- a/CMakeLists.txt +++ b/CMakeLists.txt @@ -17,7 +17,7 @@ project ( "SuiteSparse" ) # lower-case list of all projects that can be built by this root CMake file set ( SUITESPARSE_KNOWN_PROJECTS - "suitesparse_config;amd" ) + "suitesparse_config;mongoose;amd" ) set ( SUITESPARSE_ENABLE_PROJECTS "all" CACHE STRING "Semicolon-separated list of SuiteSparse projects to be built (${SUITESPARSE_KNOWN_PROJECTS}, or \"all\")" ) @@ -56,7 +56,8 @@ include ( SuiteSparsePolicy ) # check/add project dependencies #------------------------------------------------------------------------------- -if ( "amd" IN_LIST SUITESPARSE_ENABLE_PROJECTS ) +if ( "mongoose" IN_LIST SUITESPARSE_ENABLE_PROJECTS + OR "amd" IN_LIST SUITESPARSE_ENABLE_PROJECTS ) if ( NOT "suitesparse_config" IN_LIST SUITESPARSE_ENABLE_PROJECTS ) message ( STATUS "Adding \"suitesparse_config\" to the list of built targets." ) list ( APPEND SUITESPARSE_ENABLE_PROJECTS "suitesparse_config" ) @@ -75,6 +76,14 @@ if ( "suitesparse_config" IN_LIST SUITESPARSE_ENABLE_PROJECTS ) endif ( ) endif ( ) +if ( "mongoose" IN_LIST SUITESPARSE_ENABLE_PROJECTS ) + add_subdirectory ( "Mongoose" ) + add_library ( SuiteSparse::Mongoose ALIAS Mongoose ) + if ( NOT NSTATIC ) + add_library ( SuiteSparse::Mongoose_static ALIAS Mongoose_static ) + endif ( ) +endif ( ) + if ( "amd" IN_LIST SUITESPARSE_ENABLE_PROJECTS ) add_subdirectory ( "AMD" ) add_library ( SuiteSparse::AMD ALIAS AMD ) diff --git a/Mongoose/CMakeLists.txt b/Mongoose/CMakeLists.txt index 396b53b43..b998d9bfa 100644 --- a/Mongoose/CMakeLists.txt +++ b/Mongoose/CMakeLists.txt @@ -29,29 +29,54 @@ # # make distclean +#------------------------------------------------------------------------------- +# get the version +#------------------------------------------------------------------------------- + cmake_minimum_required ( VERSION 3.20 ) +set ( Mongoose_DATE "Sept 18, 2023" ) +set ( Mongoose_NUMERIC_DATE "2023-09-18" ) +set ( Mongoose_VERSION_MAJOR 3 CACHE STRING "" FORCE ) +set ( Mongoose_VERSION_MINOR 2 CACHE STRING "" FORCE ) +set ( Mongoose_VERSION_PATCH 1 CACHE STRING "" FORCE ) + +message ( STATUS "Building Mongoose version: v" + ${Mongoose_VERSION_MAJOR}. + ${Mongoose_VERSION_MINOR}. + ${Mongoose_VERSION_PATCH} " (" ${Mongoose_DATE} ")" ) + +#------------------------------------------------------------------------------- +# define the project +#------------------------------------------------------------------------------- + +project(Mongoose + VERSION "${Mongoose_VERSION_MAJOR}.${Mongoose_VERSION_MINOR}.${Mongoose_VERSION_PATCH}" + LANGUAGES CXX C) + #------------------------------------------------------------------------------- # SuiteSparse policies #------------------------------------------------------------------------------- set ( CMAKE_MODULE_PATH ${CMAKE_MODULE_PATH} - ${CMAKE_SOURCE_DIR}/cmake_modules - ${CMAKE_SOURCE_DIR}/../SuiteSparse_config/cmake_modules ) + ${PROJECT_SOURCE_DIR}/cmake_modules + ${PROJECT_SOURCE_DIR}/../SuiteSparse_config/cmake_modules ) include ( SuiteSparsePolicy ) +#------------------------------------------------------------------------------- +# find library dependencies #------------------------------------------------------------------------------- -set(Mongoose_DATE "Sept 18, 2023") -set(Mongoose_NUMERIC_DATE "2023-09-18") -set(Mongoose_VERSION_MAJOR 3) -set(Mongoose_VERSION_MINOR 2) -set(Mongoose_VERSION_PATCH 1) +if ( NOT SUITESPARSE_ROOT_CMAKELISTS ) + find_package ( SuiteSparse_config 7.2.0 + PATHS ${CMAKE_SOURCE_DIR}/../SuiteSparse_config/build NO_DEFAULT_PATH ) + if ( NOT TARGET SuiteSparse::SuiteSparseConfig ) + find_package ( SuiteSparse_config 7.2.0 REQUIRED ) + endif ( ) +endif ( ) -project(Mongoose - VERSION "${Mongoose_VERSION_MAJOR}.${Mongoose_VERSION_MINOR}.${Mongoose_VERSION_PATCH}" - LANGUAGES CXX C) +#------------------------------------------------------------------------------- # Mongoose installation location include ( GNUInstallDirs ) @@ -73,12 +98,6 @@ configure_file ( NEWLINE_STYLE LF ) -find_package ( SuiteSparse_config 7.2.0 - PATHS ${CMAKE_SOURCE_DIR}/../SuiteSparse_config/build NO_DEFAULT_PATH ) -if ( NOT TARGET SuiteSparse::SuiteSparseConfig ) - find_package ( SuiteSparse_config 7.2.0 REQUIRED ) -endif ( ) - include_directories("${PROJECT_BINARY_DIR}") set(MONGOOSE_FILES @@ -555,5 +574,6 @@ endif ( ) # report status #------------------------------------------------------------------------------- -include ( SuiteSparseReport ) - +if ( NOT SUITESPARSE_ROOT_CMAKELISTS ) + include ( SuiteSparseReport ) +endif ( ) From 05bf703cb188b113c34fdbea11d0629ee7f4097d Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Markus=20M=C3=BCtzel?= Date: Mon, 18 Sep 2023 12:58:42 +0200 Subject: [PATCH 03/24] Add BTF to the root CMakeLists.txt --- BTF/CMakeLists.txt | 41 ++++++++++++++++++++++------------------- CMakeLists.txt | 13 +++++++++++-- 2 files changed, 33 insertions(+), 21 deletions(-) diff --git a/BTF/CMakeLists.txt b/BTF/CMakeLists.txt index 53527fa8a..633270dcb 100644 --- a/BTF/CMakeLists.txt +++ b/BTF/CMakeLists.txt @@ -2,7 +2,7 @@ # SuiteSparse/BTF/CMakeLists.txt: cmake for BTF #------------------------------------------------------------------------------- -# BTF, Copyright (c) 2004-2022, University of Florida. All Rights Reserved. +# BTF, Copyright (c) 2004-2023, University of Florida. All Rights Reserved. # Author: Timothy A. Davis. # SPDX-License-Identifier: LGPL-2.1+ @@ -13,24 +13,15 @@ cmake_minimum_required ( VERSION 3.20 ) set ( BTF_DATE "Sept 18, 2023" ) -set ( BTF_VERSION_MAJOR 2 ) -set ( BTF_VERSION_MINOR 2 ) -set ( BTF_VERSION_SUB 1 ) +set ( BTF_VERSION_MAJOR 2 CACHE STRING "" FORCE ) +set ( BTF_VERSION_MINOR 2 CACHE STRING "" FORCE ) +set ( BTF_VERSION_SUB 1 CACHE STRING "" FORCE ) message ( STATUS "Building BTF version: v" ${BTF_VERSION_MAJOR}. ${BTF_VERSION_MINOR}. ${BTF_VERSION_SUB} " (" ${BTF_DATE} ")" ) -#------------------------------------------------------------------------------- -# SuiteSparse policies -#------------------------------------------------------------------------------- - -set ( CMAKE_MODULE_PATH ${CMAKE_MODULE_PATH} - ${CMAKE_SOURCE_DIR}/../SuiteSparse_config/cmake_modules ) - -include ( SuiteSparsePolicy ) - #------------------------------------------------------------------------------- # define the project #------------------------------------------------------------------------------- @@ -39,14 +30,25 @@ project ( btf VERSION "${BTF_VERSION_MAJOR}.${BTF_VERSION_MINOR}.${BTF_VERSION_SUB}" LANGUAGES C ) +#------------------------------------------------------------------------------- +# SuiteSparse policies +#------------------------------------------------------------------------------- + +set ( CMAKE_MODULE_PATH ${CMAKE_MODULE_PATH} + ${PROJECT_SOURCE_DIR}/../SuiteSparse_config/cmake_modules ) + +include ( SuiteSparsePolicy ) + #------------------------------------------------------------------------------- # find library dependencies #------------------------------------------------------------------------------- -find_package ( SuiteSparse_config 7.2.0 - PATHS ${CMAKE_SOURCE_DIR}/../SuiteSparse_config/build NO_DEFAULT_PATH ) -if ( NOT TARGET SuiteSparse::SuiteSparseConfig ) - find_package ( SuiteSparse_config 7.2.0 REQUIRED ) +if ( NOT SUITESPARSE_ROOT_CMAKELISTS ) + find_package ( SuiteSparse_config 7.2.0 + PATHS ${CMAKE_SOURCE_DIR}/../SuiteSparse_config/build NO_DEFAULT_PATH ) + if ( NOT TARGET SuiteSparse::SuiteSparseConfig ) + find_package ( SuiteSparse_config 7.2.0 REQUIRED ) + endif ( ) endif ( ) #------------------------------------------------------------------------------- @@ -213,5 +215,6 @@ endif ( ) # report status #------------------------------------------------------------------------------- -include ( SuiteSparseReport ) - +if ( NOT SUITESPARSE_ROOT_CMAKELISTS ) + include ( SuiteSparseReport ) +endif ( ) diff --git a/CMakeLists.txt b/CMakeLists.txt index 5a3f9fcde..d1ea13ec3 100644 --- a/CMakeLists.txt +++ b/CMakeLists.txt @@ -17,7 +17,7 @@ project ( "SuiteSparse" ) # lower-case list of all projects that can be built by this root CMake file set ( SUITESPARSE_KNOWN_PROJECTS - "suitesparse_config;mongoose;amd" ) + "suitesparse_config;mongoose;amd;btf" ) set ( SUITESPARSE_ENABLE_PROJECTS "all" CACHE STRING "Semicolon-separated list of SuiteSparse projects to be built (${SUITESPARSE_KNOWN_PROJECTS}, or \"all\")" ) @@ -57,7 +57,8 @@ include ( SuiteSparsePolicy ) #------------------------------------------------------------------------------- if ( "mongoose" IN_LIST SUITESPARSE_ENABLE_PROJECTS - OR "amd" IN_LIST SUITESPARSE_ENABLE_PROJECTS ) + OR "amd" IN_LIST SUITESPARSE_ENABLE_PROJECTS + OR "btf" IN_LIST SUITESPARSE_ENABLE_PROJECTS ) if ( NOT "suitesparse_config" IN_LIST SUITESPARSE_ENABLE_PROJECTS ) message ( STATUS "Adding \"suitesparse_config\" to the list of built targets." ) list ( APPEND SUITESPARSE_ENABLE_PROJECTS "suitesparse_config" ) @@ -92,6 +93,14 @@ if ( "amd" IN_LIST SUITESPARSE_ENABLE_PROJECTS ) endif ( ) endif ( ) +if ( "btf" IN_LIST SUITESPARSE_ENABLE_PROJECTS ) + add_subdirectory ( "BTF" ) + add_library ( SuiteSparse::BTF ALIAS BTF ) + if ( NOT NSTATIC ) + add_library ( SuiteSparse::BTF_static ALIAS BTF_static ) + endif ( ) +endif ( ) + #------------------------------------------------------------------------------- # report status #------------------------------------------------------------------------------- From ab93400413920724b41c742efdd8647287bf03bf Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Markus=20M=C3=BCtzel?= Date: Mon, 18 Sep 2023 13:03:29 +0200 Subject: [PATCH 04/24] Add CAMD to the root CMakeLists.txt --- CAMD/CMakeLists.txt | 39 +++++++++++++++++++++------------------ CMakeLists.txt | 13 +++++++++++-- 2 files changed, 32 insertions(+), 20 deletions(-) diff --git a/CAMD/CMakeLists.txt b/CAMD/CMakeLists.txt index 6f94fad9a..1a5c60a3a 100644 --- a/CAMD/CMakeLists.txt +++ b/CAMD/CMakeLists.txt @@ -12,24 +12,15 @@ cmake_minimum_required ( VERSION 3.20 ) set ( CAMD_DATE "Sept 18, 2023" ) -set ( CAMD_VERSION_MAJOR 3 ) -set ( CAMD_VERSION_MINOR 2 ) -set ( CAMD_VERSION_SUB 1 ) +set ( CAMD_VERSION_MAJOR 3 CACHE STRING "" FORCE ) +set ( CAMD_VERSION_MINOR 2 CACHE STRING "" FORCE ) +set ( CAMD_VERSION_SUB 1 CACHE STRING "" FORCE ) message ( STATUS "Building CAMD version: v" ${CAMD_VERSION_MAJOR}. ${CAMD_VERSION_MINOR}. ${CAMD_VERSION_SUB} " (" ${CAMD_DATE} ")" ) -#------------------------------------------------------------------------------- -# SuiteSparse policies -#------------------------------------------------------------------------------- - -set ( CMAKE_MODULE_PATH ${CMAKE_MODULE_PATH} - ${CMAKE_SOURCE_DIR}/../SuiteSparse_config/cmake_modules ) - -include ( SuiteSparsePolicy ) - #------------------------------------------------------------------------------- # define the project #------------------------------------------------------------------------------- @@ -38,14 +29,25 @@ project ( camd VERSION "${CAMD_VERSION_MAJOR}.${CAMD_VERSION_MINOR}.${CAMD_VERSION_SUB}" LANGUAGES C ) +#------------------------------------------------------------------------------- +# SuiteSparse policies +#------------------------------------------------------------------------------- + +set ( CMAKE_MODULE_PATH ${CMAKE_MODULE_PATH} + ${PROJECT_SOURCE_DIR}/../SuiteSparse_config/cmake_modules ) + +include ( SuiteSparsePolicy ) + #------------------------------------------------------------------------------- # find library dependencies #------------------------------------------------------------------------------- -find_package ( SuiteSparse_config 7.2.0 - PATHS ${CMAKE_SOURCE_DIR}/../SuiteSparse_config/build NO_DEFAULT_PATH ) -if ( NOT TARGET SuiteSparse::SuiteSparseConfig ) - find_package ( SuiteSparse_config 7.2.0 REQUIRED ) +if ( NOT SUITESPARSE_ROOT_CMAKELISTS ) + find_package ( SuiteSparse_config 7.2.0 + PATHS ${CMAKE_SOURCE_DIR}/../SuiteSparse_config/build NO_DEFAULT_PATH ) + if ( NOT TARGET SuiteSparse::SuiteSparseConfig ) + find_package ( SuiteSparse_config 7.2.0 REQUIRED ) + endif ( ) endif ( ) #------------------------------------------------------------------------------- @@ -253,5 +255,6 @@ endif ( ) # report status #------------------------------------------------------------------------------- -include ( SuiteSparseReport ) - +if ( NOT SUITESPARSE_ROOT_CMAKELISTS ) + include ( SuiteSparseReport ) +endif ( ) diff --git a/CMakeLists.txt b/CMakeLists.txt index d1ea13ec3..37e18a77e 100644 --- a/CMakeLists.txt +++ b/CMakeLists.txt @@ -17,7 +17,7 @@ project ( "SuiteSparse" ) # lower-case list of all projects that can be built by this root CMake file set ( SUITESPARSE_KNOWN_PROJECTS - "suitesparse_config;mongoose;amd;btf" ) + "suitesparse_config;mongoose;amd;btf;camd" ) set ( SUITESPARSE_ENABLE_PROJECTS "all" CACHE STRING "Semicolon-separated list of SuiteSparse projects to be built (${SUITESPARSE_KNOWN_PROJECTS}, or \"all\")" ) @@ -58,7 +58,8 @@ include ( SuiteSparsePolicy ) if ( "mongoose" IN_LIST SUITESPARSE_ENABLE_PROJECTS OR "amd" IN_LIST SUITESPARSE_ENABLE_PROJECTS - OR "btf" IN_LIST SUITESPARSE_ENABLE_PROJECTS ) + OR "btf" IN_LIST SUITESPARSE_ENABLE_PROJECTS + OR "camd" IN_LIST SUITESPARSE_ENABLE_PROJECTS ) if ( NOT "suitesparse_config" IN_LIST SUITESPARSE_ENABLE_PROJECTS ) message ( STATUS "Adding \"suitesparse_config\" to the list of built targets." ) list ( APPEND SUITESPARSE_ENABLE_PROJECTS "suitesparse_config" ) @@ -101,6 +102,14 @@ if ( "btf" IN_LIST SUITESPARSE_ENABLE_PROJECTS ) endif ( ) endif ( ) +if ( "camd" IN_LIST SUITESPARSE_ENABLE_PROJECTS ) + add_subdirectory ( "CAMD" ) + add_library ( SuiteSparse::CAMD ALIAS CAMD ) + if ( NOT NSTATIC ) + add_library ( SuiteSparse::CAMD_static ALIAS CAMD_static ) + endif ( ) +endif ( ) + #------------------------------------------------------------------------------- # report status #------------------------------------------------------------------------------- From 86c4d6536d2d3f2a2c6a6e301a7a942f9682963c Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Markus=20M=C3=BCtzel?= Date: Mon, 18 Sep 2023 13:06:45 +0200 Subject: [PATCH 05/24] Add CCOLAMD to the root CMakeLists.txt --- CCOLAMD/CMakeLists.txt | 39 +++++++++++++++++++++------------------ CMakeLists.txt | 13 +++++++++++-- 2 files changed, 32 insertions(+), 20 deletions(-) diff --git a/CCOLAMD/CMakeLists.txt b/CCOLAMD/CMakeLists.txt index e88360844..4bd82db1c 100644 --- a/CCOLAMD/CMakeLists.txt +++ b/CCOLAMD/CMakeLists.txt @@ -12,24 +12,15 @@ cmake_minimum_required ( VERSION 3.20 ) set ( CCOLAMD_DATE "Sept 18, 2023" ) -set ( CCOLAMD_VERSION_MAJOR 3 ) -set ( CCOLAMD_VERSION_MINOR 2 ) -set ( CCOLAMD_VERSION_SUB 1 ) +set ( CCOLAMD_VERSION_MAJOR 3 CACHE STRING "" FORCE ) +set ( CCOLAMD_VERSION_MINOR 2 CACHE STRING "" FORCE ) +set ( CCOLAMD_VERSION_SUB 1 CACHE STRING "" FORCE ) message ( STATUS "Building CCOLAMD version: v" ${CCOLAMD_VERSION_MAJOR}. ${CCOLAMD_VERSION_MINOR}. ${CCOLAMD_VERSION_SUB} " (" ${CCOLAMD_DATE} ")" ) -#------------------------------------------------------------------------------- -# SuiteSparse policies -#------------------------------------------------------------------------------- - -set ( CMAKE_MODULE_PATH ${CMAKE_MODULE_PATH} - ${CMAKE_SOURCE_DIR}/../SuiteSparse_config/cmake_modules ) - -include ( SuiteSparsePolicy ) - #------------------------------------------------------------------------------- # define the project #------------------------------------------------------------------------------- @@ -38,14 +29,25 @@ project ( ccolamd VERSION "${CCOLAMD_VERSION_MAJOR}.${CCOLAMD_VERSION_MINOR}.${CCOLAMD_VERSION_SUB}" LANGUAGES C ) +#------------------------------------------------------------------------------- +# SuiteSparse policies +#------------------------------------------------------------------------------- + +set ( CMAKE_MODULE_PATH ${CMAKE_MODULE_PATH} + ${PROJECT_SOURCE_DIR}/../SuiteSparse_config/cmake_modules ) + +include ( SuiteSparsePolicy ) + #------------------------------------------------------------------------------- # find library dependencies #------------------------------------------------------------------------------- -find_package ( SuiteSparse_config 7.2.0 - PATHS ${CMAKE_SOURCE_DIR}/../SuiteSparse_config/build NO_DEFAULT_PATH ) -if ( NOT TARGET SuiteSparse::SuiteSparseConfig ) - find_package ( SuiteSparse_config 7.2.0 REQUIRED ) +if ( NOT SUITESPARSE_ROOT_CMAKELISTS ) + find_package ( SuiteSparse_config 7.2.0 + PATHS ${CMAKE_SOURCE_DIR}/../SuiteSparse_config/build NO_DEFAULT_PATH ) + if ( NOT TARGET SuiteSparse::SuiteSparseConfig ) + find_package ( SuiteSparse_config 7.2.0 REQUIRED ) + endif ( ) endif ( ) #------------------------------------------------------------------------------- @@ -246,5 +248,6 @@ endif ( ) # report status #------------------------------------------------------------------------------- -include ( SuiteSparseReport ) - +if ( NOT SUITESPARSE_ROOT_CMAKELISTS ) + include ( SuiteSparseReport ) +endif ( ) diff --git a/CMakeLists.txt b/CMakeLists.txt index 37e18a77e..693e3e631 100644 --- a/CMakeLists.txt +++ b/CMakeLists.txt @@ -17,7 +17,7 @@ project ( "SuiteSparse" ) # lower-case list of all projects that can be built by this root CMake file set ( SUITESPARSE_KNOWN_PROJECTS - "suitesparse_config;mongoose;amd;btf;camd" ) + "suitesparse_config;mongoose;amd;btf;camd;ccolamd" ) set ( SUITESPARSE_ENABLE_PROJECTS "all" CACHE STRING "Semicolon-separated list of SuiteSparse projects to be built (${SUITESPARSE_KNOWN_PROJECTS}, or \"all\")" ) @@ -59,7 +59,8 @@ include ( SuiteSparsePolicy ) if ( "mongoose" IN_LIST SUITESPARSE_ENABLE_PROJECTS OR "amd" IN_LIST SUITESPARSE_ENABLE_PROJECTS OR "btf" IN_LIST SUITESPARSE_ENABLE_PROJECTS - OR "camd" IN_LIST SUITESPARSE_ENABLE_PROJECTS ) + OR "camd" IN_LIST SUITESPARSE_ENABLE_PROJECTS + OR "ccolamd" IN_LIST SUITESPARSE_ENABLE_PROJECTS ) if ( NOT "suitesparse_config" IN_LIST SUITESPARSE_ENABLE_PROJECTS ) message ( STATUS "Adding \"suitesparse_config\" to the list of built targets." ) list ( APPEND SUITESPARSE_ENABLE_PROJECTS "suitesparse_config" ) @@ -110,6 +111,14 @@ if ( "camd" IN_LIST SUITESPARSE_ENABLE_PROJECTS ) endif ( ) endif ( ) +if ( "ccolamd" IN_LIST SUITESPARSE_ENABLE_PROJECTS ) + add_subdirectory ( "CCOLAMD" ) + add_library ( SuiteSparse::CCOLAMD ALIAS CCOLAMD ) + if ( NOT NSTATIC ) + add_library ( SuiteSparse::CCOLAMD_static ALIAS CCOLAMD_static ) + endif ( ) +endif ( ) + #------------------------------------------------------------------------------- # report status #------------------------------------------------------------------------------- From 88bf0c42f72171e59043f203227b822631d2f51c Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Markus=20M=C3=BCtzel?= Date: Mon, 18 Sep 2023 13:17:03 +0200 Subject: [PATCH 06/24] Add COLAMD to the root CMakeLists.txt --- CMakeLists.txt | 13 +++++++++++-- COLAMD/CMakeLists.txt | 39 +++++++++++++++++++++------------------ 2 files changed, 32 insertions(+), 20 deletions(-) diff --git a/CMakeLists.txt b/CMakeLists.txt index 693e3e631..2a2b6753a 100644 --- a/CMakeLists.txt +++ b/CMakeLists.txt @@ -17,7 +17,7 @@ project ( "SuiteSparse" ) # lower-case list of all projects that can be built by this root CMake file set ( SUITESPARSE_KNOWN_PROJECTS - "suitesparse_config;mongoose;amd;btf;camd;ccolamd" ) + "suitesparse_config;mongoose;amd;btf;camd;ccolamd;colamd" ) set ( SUITESPARSE_ENABLE_PROJECTS "all" CACHE STRING "Semicolon-separated list of SuiteSparse projects to be built (${SUITESPARSE_KNOWN_PROJECTS}, or \"all\")" ) @@ -60,7 +60,8 @@ if ( "mongoose" IN_LIST SUITESPARSE_ENABLE_PROJECTS OR "amd" IN_LIST SUITESPARSE_ENABLE_PROJECTS OR "btf" IN_LIST SUITESPARSE_ENABLE_PROJECTS OR "camd" IN_LIST SUITESPARSE_ENABLE_PROJECTS - OR "ccolamd" IN_LIST SUITESPARSE_ENABLE_PROJECTS ) + OR "ccolamd" IN_LIST SUITESPARSE_ENABLE_PROJECTS + OR "colamd" IN_LIST SUITESPARSE_ENABLE_PROJECTS ) if ( NOT "suitesparse_config" IN_LIST SUITESPARSE_ENABLE_PROJECTS ) message ( STATUS "Adding \"suitesparse_config\" to the list of built targets." ) list ( APPEND SUITESPARSE_ENABLE_PROJECTS "suitesparse_config" ) @@ -119,6 +120,14 @@ if ( "ccolamd" IN_LIST SUITESPARSE_ENABLE_PROJECTS ) endif ( ) endif ( ) +if ( "colamd" IN_LIST SUITESPARSE_ENABLE_PROJECTS ) + add_subdirectory ( "COLAMD" ) + add_library ( SuiteSparse::COLAMD ALIAS COLAMD ) + if ( NOT NSTATIC ) + add_library ( SuiteSparse::COLAMD_static ALIAS COLAMD_static ) + endif ( ) +endif ( ) + #------------------------------------------------------------------------------- # report status #------------------------------------------------------------------------------- diff --git a/COLAMD/CMakeLists.txt b/COLAMD/CMakeLists.txt index d967831e5..c2ef219d6 100644 --- a/COLAMD/CMakeLists.txt +++ b/COLAMD/CMakeLists.txt @@ -12,24 +12,15 @@ cmake_minimum_required ( VERSION 3.20 ) set ( COLAMD_DATE "Sept 18, 2023" ) -set ( COLAMD_VERSION_MAJOR 3 ) -set ( COLAMD_VERSION_MINOR 2 ) -set ( COLAMD_VERSION_SUB 1 ) +set ( COLAMD_VERSION_MAJOR 3 CACHE STRING "" FORCE ) +set ( COLAMD_VERSION_MINOR 2 CACHE STRING "" FORCE ) +set ( COLAMD_VERSION_SUB 1 CACHE STRING "" FORCE ) message ( STATUS "Building COLAMD version: v" ${COLAMD_VERSION_MAJOR}. ${COLAMD_VERSION_MINOR}. ${COLAMD_VERSION_SUB} " (" ${COLAMD_DATE} ")" ) -#------------------------------------------------------------------------------- -# SuiteSparse policies -#------------------------------------------------------------------------------- - -set ( CMAKE_MODULE_PATH ${CMAKE_MODULE_PATH} - ${CMAKE_SOURCE_DIR}/../SuiteSparse_config/cmake_modules ) - -include ( SuiteSparsePolicy ) - #------------------------------------------------------------------------------- # define the project #------------------------------------------------------------------------------- @@ -38,14 +29,25 @@ project ( colamd VERSION "${COLAMD_VERSION_MAJOR}.${COLAMD_VERSION_MINOR}.${COLAMD_VERSION_SUB}" LANGUAGES C ) +#------------------------------------------------------------------------------- +# SuiteSparse policies +#------------------------------------------------------------------------------- + +set ( CMAKE_MODULE_PATH ${CMAKE_MODULE_PATH} + ${PROJECT_SOURCE_DIR}/../SuiteSparse_config/cmake_modules ) + +include ( SuiteSparsePolicy ) + #------------------------------------------------------------------------------- # find library dependencies #------------------------------------------------------------------------------- -find_package ( SuiteSparse_config 7.2.0 - PATHS ${CMAKE_SOURCE_DIR}/../SuiteSparse_config/build NO_DEFAULT_PATH ) -if ( NOT TARGET SuiteSparse::SuiteSparseConfig ) - find_package ( SuiteSparse_config 7.2.0 REQUIRED ) +if ( NOT SUITESPARSE_ROOT_CMAKELISTS ) + find_package ( SuiteSparse_config 7.2.0 + PATHS ${CMAKE_SOURCE_DIR}/../SuiteSparse_config/build NO_DEFAULT_PATH ) + if ( NOT TARGET SuiteSparse::SuiteSparseConfig ) + find_package ( SuiteSparse_config 7.2.0 REQUIRED ) + endif ( ) endif ( ) #------------------------------------------------------------------------------- @@ -246,5 +248,6 @@ endif ( ) # report status #------------------------------------------------------------------------------- -include ( SuiteSparseReport ) - +if ( NOT SUITESPARSE_ROOT_CMAKELISTS ) + include ( SuiteSparseReport ) +endif ( ) From 481f73ada77e6b5108f4a0ac79f391f69c2a0fe6 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Markus=20M=C3=BCtzel?= Date: Mon, 18 Sep 2023 13:31:20 +0200 Subject: [PATCH 07/24] Add CHOLMOD to the root CMakeLists.txt --- CHOLMOD/CMakeLists.txt | 87 +++++++++++++++++++++--------------------- CMakeLists.txt | 43 ++++++++++++++++++++- 2 files changed, 84 insertions(+), 46 deletions(-) diff --git a/CHOLMOD/CMakeLists.txt b/CHOLMOD/CMakeLists.txt index ddee5f143..db5c4e5f0 100644 --- a/CHOLMOD/CMakeLists.txt +++ b/CHOLMOD/CMakeLists.txt @@ -2,7 +2,7 @@ # SuiteSparse/CHOLMOD/CMakeLists.txt: cmake for CHOLMOD #------------------------------------------------------------------------------- -# CHOLMOD: Copyright (c) 2005-2022, Timothy A. Davis. +# CHOLMOD: Copyright (c) 2005-2023, Timothy A. Davis. # Copyright and license varies by module. #------------------------------------------------------------------------------- @@ -13,22 +13,30 @@ cmake_minimum_required ( VERSION 3.22 ) set ( CHOLMOD_DATE "Oct 31, 2023" ) -set ( CHOLMOD_VERSION_MAJOR 5 ) -set ( CHOLMOD_VERSION_MINOR 0 ) -set ( CHOLMOD_VERSION_SUB 1 ) +set ( CHOLMOD_VERSION_MAJOR 5 CACHE STRING "" FORCE ) +set ( CHOLMOD_VERSION_MINOR 0 CACHE STRING "" FORCE ) +set ( CHOLMOD_VERSION_SUB 1 CACHE STRING "" FORCE ) message ( STATUS "Building CHOLMOD version: v" ${CHOLMOD_VERSION_MAJOR}. ${CHOLMOD_VERSION_MINOR}. ${CHOLMOD_VERSION_SUB} " (" ${CHOLMOD_DATE} ")" ) +#------------------------------------------------------------------------------- +# define the project +#------------------------------------------------------------------------------- + +project ( cholmod + VERSION "${CHOLMOD_VERSION_MAJOR}.${CHOLMOD_VERSION_MINOR}.${CHOLMOD_VERSION_SUB}" + LANGUAGES C ) + #------------------------------------------------------------------------------- # SuiteSparse policies #------------------------------------------------------------------------------- set ( CMAKE_MODULE_PATH ${CMAKE_MODULE_PATH} - ${CMAKE_SOURCE_DIR}/cmake_modules - ${CMAKE_SOURCE_DIR}/../SuiteSparse_config/cmake_modules ) + ${PROJECT_SOURCE_DIR}/cmake_modules + ${PROJECT_SOURCE_DIR}/../SuiteSparse_config/cmake_modules ) option ( ENABLE_CUDA "Enable CUDA acceleration" on ) @@ -50,20 +58,9 @@ if ( NOT HAVE_SSIZE_T ) add_compile_definitions ( NO_SSIZE_T ) endif ( ) -#------------------------------------------------------------------------------- -# define the project -#------------------------------------------------------------------------------- - if ( SUITESPARSE_CUDA ) # CHOLMOD with CUDA - project ( cholmod - VERSION "${CHOLMOD_VERSION_MAJOR}.${CHOLMOD_VERSION_MINOR}.${CHOLMOD_VERSION_SUB}" - LANGUAGES CUDA C CXX ) -else ( ) - # CHOLMOD without CUDA - project ( cholmod - VERSION "${CHOLMOD_VERSION_MAJOR}.${CHOLMOD_VERSION_MINOR}.${CHOLMOD_VERSION_SUB}" - LANGUAGES C ) + enable_language ( CUDA CXX ) endif ( ) #------------------------------------------------------------------------------- @@ -78,22 +75,24 @@ else ( ) find_package ( OpenMP ) endif ( ) -find_package ( SuiteSparse_config 7.3.1 - PATHS ${CMAKE_SOURCE_DIR}/../SuiteSparse_config/build NO_DEFAULT_PATH ) -if ( NOT TARGET SuiteSparse::SuiteSparseConfig ) - find_package ( SuiteSparse_config 7.3.1 REQUIRED ) -endif ( ) +if ( NOT SUITESPARSE_ROOT_CMAKELISTS ) + find_package ( SuiteSparse_config 7.3.1 + PATHS ${CMAKE_SOURCE_DIR}/../SuiteSparse_config/build NO_DEFAULT_PATH ) + if ( NOT TARGET SuiteSparse::SuiteSparseConfig ) + find_package ( SuiteSparse_config 7.3.1 REQUIRED ) + endif ( ) -find_package ( COLAMD 3.2.1 - PATHS ${CMAKE_SOURCE_DIR}/../COLAMD/build NO_DEFAULT_PATH ) -if ( NOT TARGET SuiteSparse::COLAMD ) - find_package ( COLAMD 3.2.1 REQUIRED ) -endif ( ) + find_package ( AMD 3.2.1 + PATHS ${CMAKE_SOURCE_DIR}/../AMD/build NO_DEFAULT_PATH ) + if ( NOT TARGET SuiteSparse::AMD ) + find_package ( AMD 3.2.1 REQUIRED ) + endif ( ) -find_package ( AMD 3.2.1 - PATHS ${CMAKE_SOURCE_DIR}/../AMD/build NO_DEFAULT_PATH ) -if ( NOT TARGET SuiteSparse::AMD ) - find_package ( AMD 3.2.1 REQUIRED ) + find_package ( COLAMD 3.2.1 + PATHS ${CMAKE_SOURCE_DIR}/../COLAMD/build NO_DEFAULT_PATH ) + if ( NOT TARGET SuiteSparse::COLAMD ) + find_package ( COLAMD 3.2.1 REQUIRED ) + endif ( ) endif ( ) #------------------------------------------------------------------------------- @@ -124,7 +123,7 @@ endif ( ) option ( NCHECK "ON: do not use Check Module. OFF (default): use Check Module" off ) - if ( NOT EXISTS ${CMAKE_SOURCE_DIR}/Check ) + if ( NOT EXISTS ${PROJECT_SOURCE_DIR}/Check ) # Check module does not appear so don't use it set ( NCHECK true ) endif ( ) @@ -139,7 +138,7 @@ endif ( ) option ( NMATRIXOPS "ON: do not use MatrixOps Module. OFF (default): use MatrixOps Module" off ) - if ( NOT EXISTS ${CMAKE_SOURCE_DIR}/MatrixOps ) + if ( NOT EXISTS ${PROJECT_SOURCE_DIR}/MatrixOps ) # MatrixOps module does not appear so don't use it set ( NMATRIXOPS true ) endif ( ) @@ -154,7 +153,7 @@ endif ( ) option ( NCHOLESKY "ON: do not use Cholesky Module. OFF (default): use Cholesky Module" off ) - if ( NOT EXISTS ${CMAKE_SOURCE_DIR}/Cholesky ) + if ( NOT EXISTS ${PROJECT_SOURCE_DIR}/Cholesky ) # Cholesky module does not appear so don't use it set ( NCHOLESKY true ) endif ( ) @@ -172,7 +171,7 @@ endif ( ) option ( NMODIFY "ON: do not use Modify Module. OFF (default): use Modify Module" off ) - if ( NOT EXISTS ${CMAKE_SOURCE_DIR}/Modify ) + if ( NOT EXISTS ${PROJECT_SOURCE_DIR}/Modify ) # Modify module does not appear so don't use it set ( NMODIFY true ) endif ( ) @@ -185,7 +184,7 @@ endif ( ) # interfaces to CAMD and CCOLAMD #--------------------------------------------------------------------------- - option ( NCAMD "ON: do not use CAMD/CCOLAMD. OFF (default): use CAMD/CCOLAMD" off ) + option ( NCAMD "ON: do not use CAMD/CCOLAMD. OFF (default): use CAMD/CCOLAMD" OFF ) # The CHOLMOD interfaces to CAMD and CCOLAMD are in the Partition module # (cholmod_camd, cholmod_ccolamd, cholmod_csymamd). The Partition module @@ -194,7 +193,7 @@ endif ( ) # future, the CAMD and CCOLAMD interfaces will be split into their own # module to make this dependency more clear. - if ( NOT NCAMD ) + if ( NOT NCAMD AND NOT SUITESPARSE_ROOT_CMAKELISTS ) # find CAMD and CCOLAMD find_package ( CAMD 3.2.1 PATHS ${CMAKE_SOURCE_DIR}/../CAMD/build NO_DEFAULT_PATH ) @@ -226,7 +225,7 @@ endif ( ) option ( NPARTITION "ON: do not use METIS. OFF (default): use METIS" off ) - if ( NOT EXISTS ${CMAKE_SOURCE_DIR}/Partition ) + if ( NOT EXISTS ${PROJECT_SOURCE_DIR}/Partition ) # Partition module does not appear so don't use it. Since this # folder also includes the CAMD and CCOLAMD interfaces, NCAMD must # be set true here as well. @@ -249,7 +248,7 @@ endif ( ) option ( NSUPERNODAL "ON: do not use Supernodal Module. OFF (default): use Supernodal Module" off ) - if ( NOT EXISTS ${CMAKE_SOURCE_DIR}/Supernodal ) + if ( NOT EXISTS ${PROJECT_SOURCE_DIR}/Supernodal ) # Supernodal module does not appear so don't use it set ( NSUPERNODAL true ) endif ( ) @@ -291,7 +290,7 @@ configure_file ( "Config/cholmod_version.tex.in" #------------------------------------------------------------------------------- include_directories ( Check Cholesky Utility MatrixOps Modify Partition - Supernodal Include ${CMAKE_SOURCE_DIR} ) + Supernodal Include ${PROJECT_SOURCE_DIR} ) #------------------------------------------------------------------------------- # dynamic cholmod library properties @@ -663,6 +662,6 @@ endif ( ) # report status #------------------------------------------------------------------------------- -include ( SuiteSparseReport ) - - +if ( NOT SUITESPARSE_ROOT_CMAKELISTS ) + include ( SuiteSparseReport ) +endif ( ) diff --git a/CMakeLists.txt b/CMakeLists.txt index 2a2b6753a..7c38c3820 100644 --- a/CMakeLists.txt +++ b/CMakeLists.txt @@ -17,7 +17,7 @@ project ( "SuiteSparse" ) # lower-case list of all projects that can be built by this root CMake file set ( SUITESPARSE_KNOWN_PROJECTS - "suitesparse_config;mongoose;amd;btf;camd;ccolamd;colamd" ) + "suitesparse_config;mongoose;amd;btf;camd;ccolamd;colamd;cholmod" ) set ( SUITESPARSE_ENABLE_PROJECTS "all" CACHE STRING "Semicolon-separated list of SuiteSparse projects to be built (${SUITESPARSE_KNOWN_PROJECTS}, or \"all\")" ) @@ -34,6 +34,9 @@ foreach ( proj ${SUITESPARSE_ENABLE_PROJECTS} ) endif ( ) endforeach ( ) +# CHOLMOD options affecting dependencies +option ( NCAMD "ON: do not use CAMD/CCOLAMD. OFF (default): use CAMD/CCOLAMD" OFF ) + #------------------------------------------------------------------------------- # global variables #------------------------------------------------------------------------------- @@ -61,13 +64,35 @@ if ( "mongoose" IN_LIST SUITESPARSE_ENABLE_PROJECTS OR "btf" IN_LIST SUITESPARSE_ENABLE_PROJECTS OR "camd" IN_LIST SUITESPARSE_ENABLE_PROJECTS OR "ccolamd" IN_LIST SUITESPARSE_ENABLE_PROJECTS - OR "colamd" IN_LIST SUITESPARSE_ENABLE_PROJECTS ) + OR "colamd" IN_LIST SUITESPARSE_ENABLE_PROJECTS + OR "cholmod" IN_LIST SUITESPARSE_ENABLE_PROJECTS ) if ( NOT "suitesparse_config" IN_LIST SUITESPARSE_ENABLE_PROJECTS ) message ( STATUS "Adding \"suitesparse_config\" to the list of built targets." ) list ( APPEND SUITESPARSE_ENABLE_PROJECTS "suitesparse_config" ) endif ( ) endif ( ) +if ( "cholmod" IN_LIST SUITESPARSE_ENABLE_PROJECTS ) + if ( NOT "amd" IN_LIST SUITESPARSE_ENABLE_PROJECTS ) + message ( STATUS "Adding \"amd\" to the list of built targets." ) + list ( APPEND SUITESPARSE_ENABLE_PROJECTS "amd" ) + endif ( ) + if ( NOT "colamd" IN_LIST SUITESPARSE_ENABLE_PROJECTS ) + message ( STATUS "Adding \"colamd\" to the list of built targets." ) + list ( APPEND SUITESPARSE_ENABLE_PROJECTS "colamd" ) + endif ( ) + if ( NOT NCAMD ) + if ( NOT "camd" IN_LIST SUITESPARSE_ENABLE_PROJECTS ) + message ( STATUS "Adding \"camd\" to the list of built targets." ) + list ( APPEND SUITESPARSE_ENABLE_PROJECTS "camd" ) + endif ( ) + if ( NOT "ccolamd" IN_LIST SUITESPARSE_ENABLE_PROJECTS ) + message ( STATUS "Adding \"ccolamd\" to the list of built targets." ) + list ( APPEND SUITESPARSE_ENABLE_PROJECTS "ccolamd" ) + endif ( ) + endif ( ) +endif ( ) + #------------------------------------------------------------------------------- # include selected projects #------------------------------------------------------------------------------- @@ -128,6 +153,20 @@ if ( "colamd" IN_LIST SUITESPARSE_ENABLE_PROJECTS ) endif ( ) endif ( ) +if ( "cholmod" IN_LIST SUITESPARSE_ENABLE_PROJECTS ) + add_subdirectory ( "CHOLMOD" ) + add_library ( SuiteSparse::CHOLMOD ALIAS CHOLMOD ) + if ( NOT NSTATIC ) + add_library ( SuiteSparse::CHOLMOD_static ALIAS CHOLMOD_static ) + endif ( ) + if ( TARGET CHOLMOD_CUDA ) + add_library ( SuiteSparse::CHOLMOD_CUDA ALIAS CHOLMOD_CUDA ) + endif ( ) + if ( TARGET CHOLMOD_CUDA_static ) + add_library ( SuiteSparse::CHOLMOD_CUDA_static ALIAS CHOLMOD_CUDA_static ) + endif ( ) +endif ( ) + #------------------------------------------------------------------------------- # report status #------------------------------------------------------------------------------- From 9dc82e4e27200fc54d9b83c745437b18d6f28d38 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Markus=20M=C3=BCtzel?= Date: Mon, 18 Sep 2023 13:36:18 +0200 Subject: [PATCH 08/24] Add CXSparse to the root CMakeLists.txt --- CMakeLists.txt | 13 +++++++++++-- CXSparse/CMakeLists.txt | 39 +++++++++++++++++++++------------------ 2 files changed, 32 insertions(+), 20 deletions(-) diff --git a/CMakeLists.txt b/CMakeLists.txt index 7c38c3820..f286ed5f2 100644 --- a/CMakeLists.txt +++ b/CMakeLists.txt @@ -17,7 +17,7 @@ project ( "SuiteSparse" ) # lower-case list of all projects that can be built by this root CMake file set ( SUITESPARSE_KNOWN_PROJECTS - "suitesparse_config;mongoose;amd;btf;camd;ccolamd;colamd;cholmod" ) + "suitesparse_config;mongoose;amd;btf;camd;ccolamd;colamd;cholmod;cxsparse" ) set ( SUITESPARSE_ENABLE_PROJECTS "all" CACHE STRING "Semicolon-separated list of SuiteSparse projects to be built (${SUITESPARSE_KNOWN_PROJECTS}, or \"all\")" ) @@ -65,7 +65,8 @@ if ( "mongoose" IN_LIST SUITESPARSE_ENABLE_PROJECTS OR "camd" IN_LIST SUITESPARSE_ENABLE_PROJECTS OR "ccolamd" IN_LIST SUITESPARSE_ENABLE_PROJECTS OR "colamd" IN_LIST SUITESPARSE_ENABLE_PROJECTS - OR "cholmod" IN_LIST SUITESPARSE_ENABLE_PROJECTS ) + OR "cholmod" IN_LIST SUITESPARSE_ENABLE_PROJECTS + OR "cxsparse" IN_LIST SUITESPARSE_ENABLE_PROJECTS ) if ( NOT "suitesparse_config" IN_LIST SUITESPARSE_ENABLE_PROJECTS ) message ( STATUS "Adding \"suitesparse_config\" to the list of built targets." ) list ( APPEND SUITESPARSE_ENABLE_PROJECTS "suitesparse_config" ) @@ -167,6 +168,14 @@ if ( "cholmod" IN_LIST SUITESPARSE_ENABLE_PROJECTS ) endif ( ) endif ( ) +if ( "cxsparse" IN_LIST SUITESPARSE_ENABLE_PROJECTS ) + add_subdirectory ( "CXSparse" ) + add_library ( SuiteSparse::CXSparse ALIAS CXSparse ) + if ( NOT NSTATIC ) + add_library ( SuiteSparse::CXSparse_static ALIAS CXSparse_static ) + endif ( ) +endif ( ) + #------------------------------------------------------------------------------- # report status #------------------------------------------------------------------------------- diff --git a/CXSparse/CMakeLists.txt b/CXSparse/CMakeLists.txt index 65a73c518..1edcee4ab 100644 --- a/CXSparse/CMakeLists.txt +++ b/CXSparse/CMakeLists.txt @@ -12,21 +12,29 @@ cmake_minimum_required ( VERSION 3.20 ) set ( CXSPARSE_DATE "Sept 18, 2023" ) -set ( CXSPARSE_VERSION_MAJOR 4 ) -set ( CXSPARSE_VERSION_MINOR 2 ) -set ( CXSPARSE_VERSION_SUB 1 ) +set ( CXSPARSE_VERSION_MAJOR 4 CACHE STRING "" FORCE ) +set ( CXSPARSE_VERSION_MINOR 2 CACHE STRING "" FORCE ) +set ( CXSPARSE_VERSION_SUB 1 CACHE STRING "" FORCE ) message ( STATUS "Building CXSparse version: v" ${CXSPARSE_VERSION_MAJOR}. ${CXSPARSE_VERSION_MINOR}. ${CXSPARSE_VERSION_SUB} " (" ${CXSPARSE_DATE} ")" ) +#------------------------------------------------------------------------------- +# define the project +#------------------------------------------------------------------------------- + +project ( cxsparse + VERSION "${CXSPARSE_VERSION_MAJOR}.${CXSPARSE_VERSION_MINOR}.${CXSPARSE_VERSION_SUB}" + LANGUAGES C ) + #------------------------------------------------------------------------------- # SuiteSparse policies #------------------------------------------------------------------------------- set ( CMAKE_MODULE_PATH ${CMAKE_MODULE_PATH} - ${CMAKE_SOURCE_DIR}/../SuiteSparse_config/cmake_modules ) + ${PROJECT_SOURCE_DIR}/../SuiteSparse_config/cmake_modules ) include ( SuiteSparsePolicy ) @@ -51,22 +59,16 @@ else ( ) set ( CXSPARSE_USE_COMPLEX 1 ) endif ( ) -#------------------------------------------------------------------------------- -# define the project -#------------------------------------------------------------------------------- - -project ( cxsparse - VERSION "${CXSPARSE_VERSION_MAJOR}.${CXSPARSE_VERSION_MINOR}.${CXSPARSE_VERSION_SUB}" - LANGUAGES C ) - #------------------------------------------------------------------------------- # find library dependencies #------------------------------------------------------------------------------- -find_package ( SuiteSparse_config 7.2.0 - PATHS ${CMAKE_SOURCE_DIR}/../SuiteSparse_config/build NO_DEFAULT_PATH ) -if ( NOT TARGET SuiteSparse::SuiteSparseConfig ) - find_package ( SuiteSparse_config 7.2.0 REQUIRED ) +if ( NOT SUITESPARSE_ROOT_CMAKELISTS ) + find_package ( SuiteSparse_config 7.2.0 + PATHS ${CMAKE_SOURCE_DIR}/../SuiteSparse_config/build NO_DEFAULT_PATH ) + if ( NOT TARGET SuiteSparse::SuiteSparseConfig ) + find_package ( SuiteSparse_config 7.2.0 REQUIRED ) + endif ( ) endif ( ) #------------------------------------------------------------------------------- @@ -333,5 +335,6 @@ endif ( ) # report status #------------------------------------------------------------------------------- -include ( SuiteSparseReport ) - +if ( NOT SUITESPARSE_ROOT_CMAKELISTS ) + include ( SuiteSparseReport ) +endif ( ) From 22b5e429a6df74258704ec488068a8196715fb93 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Markus=20M=C3=BCtzel?= Date: Mon, 18 Sep 2023 13:42:19 +0200 Subject: [PATCH 09/24] Add LDL to the root CMakeLists.txt --- CMakeLists.txt | 19 +++++++++++++--- LDL/CMakeLists.txt | 54 +++++++++++++++++++++++++--------------------- 2 files changed, 45 insertions(+), 28 deletions(-) diff --git a/CMakeLists.txt b/CMakeLists.txt index f286ed5f2..44ac414f9 100644 --- a/CMakeLists.txt +++ b/CMakeLists.txt @@ -17,7 +17,7 @@ project ( "SuiteSparse" ) # lower-case list of all projects that can be built by this root CMake file set ( SUITESPARSE_KNOWN_PROJECTS - "suitesparse_config;mongoose;amd;btf;camd;ccolamd;colamd;cholmod;cxsparse" ) + "suitesparse_config;mongoose;amd;btf;camd;ccolamd;colamd;cholmod;cxsparse;ldl" ) set ( SUITESPARSE_ENABLE_PROJECTS "all" CACHE STRING "Semicolon-separated list of SuiteSparse projects to be built (${SUITESPARSE_KNOWN_PROJECTS}, or \"all\")" ) @@ -66,18 +66,23 @@ if ( "mongoose" IN_LIST SUITESPARSE_ENABLE_PROJECTS OR "ccolamd" IN_LIST SUITESPARSE_ENABLE_PROJECTS OR "colamd" IN_LIST SUITESPARSE_ENABLE_PROJECTS OR "cholmod" IN_LIST SUITESPARSE_ENABLE_PROJECTS - OR "cxsparse" IN_LIST SUITESPARSE_ENABLE_PROJECTS ) + OR "cxsparse" IN_LIST SUITESPARSE_ENABLE_PROJECTS + OR "ldl" IN_LIST SUITESPARSE_ENABLE_PROJECTS ) if ( NOT "suitesparse_config" IN_LIST SUITESPARSE_ENABLE_PROJECTS ) message ( STATUS "Adding \"suitesparse_config\" to the list of built targets." ) list ( APPEND SUITESPARSE_ENABLE_PROJECTS "suitesparse_config" ) endif ( ) endif ( ) -if ( "cholmod" IN_LIST SUITESPARSE_ENABLE_PROJECTS ) +if ( "cholmod" IN_LIST SUITESPARSE_ENABLE_PROJECTS + OR "ldl" IN_LIST SUITESPARSE_ENABLE_PROJECTS ) if ( NOT "amd" IN_LIST SUITESPARSE_ENABLE_PROJECTS ) message ( STATUS "Adding \"amd\" to the list of built targets." ) list ( APPEND SUITESPARSE_ENABLE_PROJECTS "amd" ) endif ( ) +endif ( ) + +if ( "cholmod" IN_LIST SUITESPARSE_ENABLE_PROJECTS ) if ( NOT "colamd" IN_LIST SUITESPARSE_ENABLE_PROJECTS ) message ( STATUS "Adding \"colamd\" to the list of built targets." ) list ( APPEND SUITESPARSE_ENABLE_PROJECTS "colamd" ) @@ -176,6 +181,14 @@ if ( "cxsparse" IN_LIST SUITESPARSE_ENABLE_PROJECTS ) endif ( ) endif ( ) +if ( "ldl" IN_LIST SUITESPARSE_ENABLE_PROJECTS ) + add_subdirectory ( "LDL" ) + add_library ( SuiteSparse::LDL ALIAS LDL ) + if ( NOT NSTATIC ) + add_library ( SuiteSparse::LDL_static ALIAS LDL_static ) + endif ( ) +endif ( ) + #------------------------------------------------------------------------------- # report status #------------------------------------------------------------------------------- diff --git a/LDL/CMakeLists.txt b/LDL/CMakeLists.txt index f5904471f..24b2ed5a6 100644 --- a/LDL/CMakeLists.txt +++ b/LDL/CMakeLists.txt @@ -2,7 +2,7 @@ # SuiteSparse/LDL/CMakeLists.txt: cmake for LDL #------------------------------------------------------------------------------- -# LDL, Copyright (c) 2005-2022 by Timothy A. Davis. All Rights Reserved. +# LDL, Copyright (c) 2005-2023 by Timothy A. Davis. All Rights Reserved. # SPDX-License-Identifier: LGPL-2.1+ #------------------------------------------------------------------------------- @@ -12,24 +12,15 @@ cmake_minimum_required ( VERSION 3.20 ) set ( LDL_DATE "Sept 18, 2023" ) -set ( LDL_VERSION_MAJOR 3 ) -set ( LDL_VERSION_MINOR 2 ) -set ( LDL_VERSION_SUB 1 ) +set ( LDL_VERSION_MAJOR 3 CACHE STRING "" FORCE ) +set ( LDL_VERSION_MINOR 2 CACHE STRING "" FORCE ) +set ( LDL_VERSION_SUB 1 CACHE STRING "" FORCE ) message ( STATUS "Building LDL version: v" ${LDL_VERSION_MAJOR}. ${LDL_VERSION_MINOR}. ${LDL_VERSION_SUB} " (" ${LDL_DATE} ")" ) -#------------------------------------------------------------------------------- -# SuiteSparse policies -#------------------------------------------------------------------------------- - -set ( CMAKE_MODULE_PATH ${CMAKE_MODULE_PATH} - ${CMAKE_SOURCE_DIR}/../SuiteSparse_config/cmake_modules ) - -include ( SuiteSparsePolicy ) - #------------------------------------------------------------------------------- # define the project #------------------------------------------------------------------------------- @@ -38,22 +29,34 @@ project ( ldl VERSION "${LDL_VERSION_MAJOR}.${LDL_VERSION_MINOR}.${LDL_VERSION_SUB}" LANGUAGES C ) +#------------------------------------------------------------------------------- +# SuiteSparse policies +#------------------------------------------------------------------------------- + +set ( CMAKE_MODULE_PATH ${CMAKE_MODULE_PATH} + ${PROJECT_SOURCE_DIR}/../SuiteSparse_config/cmake_modules ) + +include ( SuiteSparsePolicy ) + #------------------------------------------------------------------------------- # find library dependencies #------------------------------------------------------------------------------- + option ( DEMO "ON: Build the demo programs. OFF (default): do not build the demo programs." OFF ) -find_package ( SuiteSparse_config 7.2.0 - PATHS ${CMAKE_SOURCE_DIR}/../SuiteSparse_config/build NO_DEFAULT_PATH ) -if ( NOT TARGET SuiteSparse::SuiteSparseConfig ) - find_package ( SuiteSparse_config 7.2.0 REQUIRED ) -endif ( ) +if ( NOT SUITESPARSE_ROOT_CMAKELISTS ) + find_package ( SuiteSparse_config 7.2.0 + PATHS ${CMAKE_SOURCE_DIR}/../SuiteSparse_config/build NO_DEFAULT_PATH ) + if ( NOT TARGET SuiteSparse::SuiteSparseConfig ) + find_package ( SuiteSparse_config 7.2.0 REQUIRED ) + endif ( ) -if ( DEMO ) - find_package ( AMD 3.2.0 - PATHS ${CMAKE_SOURCE_DIR}/../AMD/build NO_DEFAULT_PATH ) - if ( NOT TARGET SuiteSparse::AMD ) - find_package ( AMD 3.2.0 ) + if ( DEMO ) + find_package ( AMD 3.2.0 + PATHS ${CMAKE_SOURCE_DIR}/../AMD/build NO_DEFAULT_PATH ) + if ( NOT TARGET SuiteSparse::AMD ) + find_package ( AMD 3.2.0 REQUIRED ) + endif ( ) endif ( ) endif ( ) @@ -265,5 +268,6 @@ endif ( ) # report status #------------------------------------------------------------------------------- -include ( SuiteSparseReport ) - +if ( NOT SUITESPARSE_ROOT_CMAKELISTS ) + include ( SuiteSparseReport ) +endif ( ) From 715be4bf95d6da55a8823bed6549678597c1773d Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Markus=20M=C3=BCtzel?= Date: Mon, 18 Sep 2023 14:04:55 +0200 Subject: [PATCH 10/24] Add KLU to the root CMakeLists.txt --- CMakeLists.txt | 49 ++++++++++++++++++++-------- KLU/CMakeLists.txt | 80 +++++++++++++++++++++++----------------------- 2 files changed, 76 insertions(+), 53 deletions(-) diff --git a/CMakeLists.txt b/CMakeLists.txt index 44ac414f9..1b4c6022e 100644 --- a/CMakeLists.txt +++ b/CMakeLists.txt @@ -17,7 +17,7 @@ project ( "SuiteSparse" ) # lower-case list of all projects that can be built by this root CMake file set ( SUITESPARSE_KNOWN_PROJECTS - "suitesparse_config;mongoose;amd;btf;camd;ccolamd;colamd;cholmod;cxsparse;ldl" ) + "suitesparse_config;mongoose;amd;btf;camd;ccolamd;colamd;cholmod;cxsparse;ldl;klu" ) set ( SUITESPARSE_ENABLE_PROJECTS "all" CACHE STRING "Semicolon-separated list of SuiteSparse projects to be built (${SUITESPARSE_KNOWN_PROJECTS}, or \"all\")" ) @@ -37,6 +37,9 @@ endforeach ( ) # CHOLMOD options affecting dependencies option ( NCAMD "ON: do not use CAMD/CCOLAMD. OFF (default): use CAMD/CCOLAMD" OFF ) +# KLU options affecting dependencies +option ( NCHOLMOD "ON: do not use CHOLMOD. OFF (default): use CHOLMOD" OFF ) + #------------------------------------------------------------------------------- # global variables #------------------------------------------------------------------------------- @@ -59,18 +62,14 @@ include ( SuiteSparsePolicy ) # check/add project dependencies #------------------------------------------------------------------------------- -if ( "mongoose" IN_LIST SUITESPARSE_ENABLE_PROJECTS - OR "amd" IN_LIST SUITESPARSE_ENABLE_PROJECTS - OR "btf" IN_LIST SUITESPARSE_ENABLE_PROJECTS - OR "camd" IN_LIST SUITESPARSE_ENABLE_PROJECTS - OR "ccolamd" IN_LIST SUITESPARSE_ENABLE_PROJECTS - OR "colamd" IN_LIST SUITESPARSE_ENABLE_PROJECTS - OR "cholmod" IN_LIST SUITESPARSE_ENABLE_PROJECTS - OR "cxsparse" IN_LIST SUITESPARSE_ENABLE_PROJECTS - OR "ldl" IN_LIST SUITESPARSE_ENABLE_PROJECTS ) - if ( NOT "suitesparse_config" IN_LIST SUITESPARSE_ENABLE_PROJECTS ) - message ( STATUS "Adding \"suitesparse_config\" to the list of built targets." ) - list ( APPEND SUITESPARSE_ENABLE_PROJECTS "suitesparse_config" ) +if ( "klu" IN_LIST SUITESPARSE_ENABLE_PROJECTS ) + if ( NOT "btf" IN_LIST SUITESPARSE_ENABLE_PROJECTS ) + message ( STATUS "Adding \"btf\" to the list of built targets." ) + list ( APPEND SUITESPARSE_ENABLE_PROJECTS "btf" ) + endif ( ) + if ( NOT NCHOLMOD AND NOT "cholmod" IN_LIST SUITESPARSE_ENABLE_PROJECTS ) + message ( STATUS "Adding \"cholmod\" to the list of built targets." ) + list ( APPEND SUITESPARSE_ENABLE_PROJECTS "cholmod" ) endif ( ) endif ( ) @@ -99,6 +98,22 @@ if ( "cholmod" IN_LIST SUITESPARSE_ENABLE_PROJECTS ) endif ( ) endif ( ) +if ( "mongoose" IN_LIST SUITESPARSE_ENABLE_PROJECTS + OR "amd" IN_LIST SUITESPARSE_ENABLE_PROJECTS + OR "btf" IN_LIST SUITESPARSE_ENABLE_PROJECTS + OR "camd" IN_LIST SUITESPARSE_ENABLE_PROJECTS + OR "ccolamd" IN_LIST SUITESPARSE_ENABLE_PROJECTS + OR "colamd" IN_LIST SUITESPARSE_ENABLE_PROJECTS + OR "cholmod" IN_LIST SUITESPARSE_ENABLE_PROJECTS + OR "cxsparse" IN_LIST SUITESPARSE_ENABLE_PROJECTS + OR "ldl" IN_LIST SUITESPARSE_ENABLE_PROJECTS + OR "klu" IN_LIST SUITESPARSE_ENABLE_PROJECTS ) + if ( NOT "suitesparse_config" IN_LIST SUITESPARSE_ENABLE_PROJECTS ) + message ( STATUS "Adding \"suitesparse_config\" to the list of built targets." ) + list ( APPEND SUITESPARSE_ENABLE_PROJECTS "suitesparse_config" ) + endif ( ) +endif ( ) + #------------------------------------------------------------------------------- # include selected projects #------------------------------------------------------------------------------- @@ -189,6 +204,14 @@ if ( "ldl" IN_LIST SUITESPARSE_ENABLE_PROJECTS ) endif ( ) endif ( ) +if ( "klu" IN_LIST SUITESPARSE_ENABLE_PROJECTS ) + add_subdirectory ( "KLU" ) + add_library ( SuiteSparse::KLU ALIAS KLU ) + if ( NOT NSTATIC ) + add_library ( SuiteSparse::KLU_static ALIAS KLU_static ) + endif ( ) +endif ( ) + #------------------------------------------------------------------------------- # report status #------------------------------------------------------------------------------- diff --git a/KLU/CMakeLists.txt b/KLU/CMakeLists.txt index 003f1157b..4f6849159 100644 --- a/KLU/CMakeLists.txt +++ b/KLU/CMakeLists.txt @@ -2,7 +2,7 @@ # SuiteSparse/KLU/CMakeLists.txt: cmake for KLU #------------------------------------------------------------------------------- -# KLU, Copyright (c) 2004-2022, University of Florida. All Rights Reserved. +# KLU, Copyright (c) 2004-2023, University of Florida. All Rights Reserved. # Authors: Timothy A. Davis and Ekanathan Palamadai. # SPDX-License-Identifier: LGPL-2.1+ @@ -13,9 +13,9 @@ cmake_minimum_required ( VERSION 3.20 ) set ( KLU_DATE "Oct 23, 2023" ) -set ( KLU_VERSION_MAJOR 2 ) -set ( KLU_VERSION_MINOR 2 ) -set ( KLU_VERSION_SUB 2 ) +set ( KLU_VERSION_MAJOR 2 CACHE STRING "" FORCE ) +set ( KLU_VERSION_MINOR 2 CACHE STRING "" FORCE ) +set ( KLU_VERSION_SUB 2 CACHE STRING "" FORCE ) message ( STATUS "Building KLU version: v" ${KLU_VERSION_MAJOR}. @@ -23,62 +23,61 @@ message ( STATUS "Building KLU version: v" ${KLU_VERSION_SUB} " (" ${KLU_DATE} ")" ) #------------------------------------------------------------------------------- +# define the project +#------------------------------------------------------------------------------- + +project ( klu + VERSION "${KLU_VERSION_MAJOR}.${KLU_VERSION_MINOR}.${KLU_VERSION_SUB}" + LANGUAGES C ) +#------------------------------------------------------------------------------- # SuiteSparse policies #------------------------------------------------------------------------------- set ( CMAKE_MODULE_PATH ${CMAKE_MODULE_PATH} - ${CMAKE_SOURCE_DIR}/../SuiteSparse_config/cmake_modules ) + ${PROJECT_SOURCE_DIR}/../SuiteSparse_config/cmake_modules ) option ( ENABLE_CUDA "Enable CUDA acceleration" on ) include ( SuiteSparsePolicy ) -#------------------------------------------------------------------------------- -# define the project -#------------------------------------------------------------------------------- - if ( SUITESPARSE_CUDA ) # KLU with CHOLMOD (which can use CUDA) - project ( klu - VERSION "${KLU_VERSION_MAJOR}.${KLU_VERSION_MINOR}.${KLU_VERSION_SUB}" - LANGUAGES C CXX CUDA ) -else ( ) - # KLU without CHOLMOD (thus no CUDA) - project ( klu - VERSION "${KLU_VERSION_MAJOR}.${KLU_VERSION_MINOR}.${KLU_VERSION_SUB}" - LANGUAGES C ) + enable_language ( CXX CUDA ) endif ( ) #------------------------------------------------------------------------------- # find library dependencies #------------------------------------------------------------------------------- -find_package ( SuiteSparse_config 7.3.0 - PATHS ${CMAKE_SOURCE_DIR}/../SuiteSparse_config/build NO_DEFAULT_PATH ) -if ( NOT TARGET SuiteSparse::SuiteSparseConfig ) - find_package ( SuiteSparse_config 7.3.0 REQUIRED ) -endif ( ) -find_package ( BTF 2.2.1 - PATHS ${CMAKE_SOURCE_DIR}/../BTF/build NO_DEFAULT_PATH ) -if ( NOT TARGET SuiteSparse::BTF ) - find_package ( BTF 2.2.1 REQUIRED ) -endif ( ) +if ( NOT SUITESPARSE_ROOT_CMAKELISTS ) + find_package ( SuiteSparse_config 7.3.0 + PATHS ${CMAKE_SOURCE_DIR}/../SuiteSparse_config/build NO_DEFAULT_PATH ) + if ( NOT TARGET SuiteSparse::SuiteSparseConfig ) + find_package ( SuiteSparse_config 7.3.0 REQUIRED ) + endif ( ) -find_package ( COLAMD 3.2.1 - PATHS ${CMAKE_SOURCE_DIR}/../COLAMD/build NO_DEFAULT_PATH ) -if ( NOT TARGET SuiteSparse::COLAMD ) - find_package ( COLAMD 3.2.1 REQUIRED ) -endif ( ) + find_package ( AMD 3.2.1 + PATHS ${CMAKE_SOURCE_DIR}/../AMD/build NO_DEFAULT_PATH ) + if ( NOT TARGET SuiteSparse::AMD ) + find_package ( AMD 3.2.1 REQUIRED ) + endif ( ) + + find_package ( COLAMD 3.2.1 + PATHS ${CMAKE_SOURCE_DIR}/../COLAMD/build NO_DEFAULT_PATH ) + if ( NOT TARGET SuiteSparse::COLAMD ) + find_package ( COLAMD 3.2.1 REQUIRED ) + endif ( ) -find_package ( AMD 3.2.1 - PATHS ${CMAKE_SOURCE_DIR}/../AMD/build NO_DEFAULT_PATH ) -if ( NOT TARGET SuiteSparse::AMD ) - find_package ( AMD 3.2.1 REQUIRED ) + find_package ( BTF 2.2.1 + PATHS ${CMAKE_SOURCE_DIR}/../BTF/build NO_DEFAULT_PATH ) + if ( NOT TARGET SuiteSparse::BTF ) + find_package ( BTF 2.2.1 REQUIRED ) + endif ( ) endif ( ) -option ( NCHOLMOD "ON: do not use CHOLMOD. OFF (default): use CHOLMOD" off ) +option ( NCHOLMOD "ON: do not use CHOLMOD. OFF (default): use CHOLMOD" OFF ) -if ( NOT NCHOLMOD ) +if ( NOT SUITESPARSE_ROOT_CMAKELISTS AND NOT NCHOLMOD ) # look for CHOLMOD (optional fill-reducing orderings) find_package ( CHOLMOD 5.0.0 PATHS ${CMAKE_SOURCE_DIR}/../CHOLMOD/build NO_DEFAULT_PATH ) @@ -503,5 +502,6 @@ endif ( ) # report status #------------------------------------------------------------------------------- -include ( SuiteSparseReport ) - +if ( NOT SUITESPARSE_ROOT_CMAKELISTS ) + include ( SuiteSparseReport ) +endif ( ) From 114327c4f0fb010293d9afa1b22d5929f732005f Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Markus=20M=C3=BCtzel?= Date: Mon, 18 Sep 2023 14:18:57 +0200 Subject: [PATCH 11/24] Add UMFPACK to the root CMakeLists.txt --- CMakeLists.txt | 22 ++++++++-- UMFPACK/CMakeLists.txt | 92 ++++++++++++++++++++++++++---------------- 2 files changed, 76 insertions(+), 38 deletions(-) diff --git a/CMakeLists.txt b/CMakeLists.txt index 1b4c6022e..c491f60ff 100644 --- a/CMakeLists.txt +++ b/CMakeLists.txt @@ -17,7 +17,7 @@ project ( "SuiteSparse" ) # lower-case list of all projects that can be built by this root CMake file set ( SUITESPARSE_KNOWN_PROJECTS - "suitesparse_config;mongoose;amd;btf;camd;ccolamd;colamd;cholmod;cxsparse;ldl;klu" ) + "suitesparse_config;mongoose;amd;btf;camd;ccolamd;colamd;cholmod;cxsparse;ldl;klu;umfpack" ) set ( SUITESPARSE_ENABLE_PROJECTS "all" CACHE STRING "Semicolon-separated list of SuiteSparse projects to be built (${SUITESPARSE_KNOWN_PROJECTS}, or \"all\")" ) @@ -37,7 +37,7 @@ endforeach ( ) # CHOLMOD options affecting dependencies option ( NCAMD "ON: do not use CAMD/CCOLAMD. OFF (default): use CAMD/CCOLAMD" OFF ) -# KLU options affecting dependencies +# KLU and UMFPACK options affecting dependencies option ( NCHOLMOD "ON: do not use CHOLMOD. OFF (default): use CHOLMOD" OFF ) #------------------------------------------------------------------------------- @@ -67,6 +67,10 @@ if ( "klu" IN_LIST SUITESPARSE_ENABLE_PROJECTS ) message ( STATUS "Adding \"btf\" to the list of built targets." ) list ( APPEND SUITESPARSE_ENABLE_PROJECTS "btf" ) endif ( ) +endif ( ) + +if ( "klu" IN_LIST SUITESPARSE_ENABLE_PROJECTS + OR "umfpack" IN_LIST SUITESPARSE_ENABLE_PROJECTS ) if ( NOT NCHOLMOD AND NOT "cholmod" IN_LIST SUITESPARSE_ENABLE_PROJECTS ) message ( STATUS "Adding \"cholmod\" to the list of built targets." ) list ( APPEND SUITESPARSE_ENABLE_PROJECTS "cholmod" ) @@ -74,7 +78,8 @@ if ( "klu" IN_LIST SUITESPARSE_ENABLE_PROJECTS ) endif ( ) if ( "cholmod" IN_LIST SUITESPARSE_ENABLE_PROJECTS - OR "ldl" IN_LIST SUITESPARSE_ENABLE_PROJECTS ) + OR "ldl" IN_LIST SUITESPARSE_ENABLE_PROJECTS + OR "umfpack" IN_LIST SUITESPARSE_ENABLE_PROJECTS ) if ( NOT "amd" IN_LIST SUITESPARSE_ENABLE_PROJECTS ) message ( STATUS "Adding \"amd\" to the list of built targets." ) list ( APPEND SUITESPARSE_ENABLE_PROJECTS "amd" ) @@ -107,7 +112,8 @@ if ( "mongoose" IN_LIST SUITESPARSE_ENABLE_PROJECTS OR "cholmod" IN_LIST SUITESPARSE_ENABLE_PROJECTS OR "cxsparse" IN_LIST SUITESPARSE_ENABLE_PROJECTS OR "ldl" IN_LIST SUITESPARSE_ENABLE_PROJECTS - OR "klu" IN_LIST SUITESPARSE_ENABLE_PROJECTS ) + OR "klu" IN_LIST SUITESPARSE_ENABLE_PROJECTS + OR "umfpack" IN_LIST SUITESPARSE_ENABLE_PROJECTS ) if ( NOT "suitesparse_config" IN_LIST SUITESPARSE_ENABLE_PROJECTS ) message ( STATUS "Adding \"suitesparse_config\" to the list of built targets." ) list ( APPEND SUITESPARSE_ENABLE_PROJECTS "suitesparse_config" ) @@ -212,6 +218,14 @@ if ( "klu" IN_LIST SUITESPARSE_ENABLE_PROJECTS ) endif ( ) endif ( ) +if ( "umfpack" IN_LIST SUITESPARSE_ENABLE_PROJECTS ) + add_subdirectory ( "UMFPACK" ) + add_library ( SuiteSparse::UMFPACK ALIAS UMFPACK ) + if ( NOT NSTATIC ) + add_library ( SuiteSparse::UMFPACK_static ALIAS UMFPACK_static ) + endif ( ) +endif ( ) + #------------------------------------------------------------------------------- # report status #------------------------------------------------------------------------------- diff --git a/UMFPACK/CMakeLists.txt b/UMFPACK/CMakeLists.txt index 921be8878..d6ac3606c 100644 --- a/UMFPACK/CMakeLists.txt +++ b/UMFPACK/CMakeLists.txt @@ -2,7 +2,7 @@ # SuiteSparse/UMFPACK/CMakeLists.txt: cmake for UMFPACK #------------------------------------------------------------------------------- -# Copyright (c) 1995-2022, Timothy A. Davis. All Rights Reserved. +# Copyright (c) 1995-2023, Timothy A. Davis. All Rights Reserved. # SPDX-License-Identifier: GPL-2.0+ #------------------------------------------------------------------------------- @@ -13,47 +13,46 @@ cmake_minimum_required ( VERSION 3.22 ) set ( UMFPACK_DATE "Oct 23, 2023" ) -set ( UMFPACK_VERSION_MAJOR 6 ) -set ( UMFPACK_VERSION_MINOR 2 ) -set ( UMFPACK_VERSION_SUB 2 ) +set ( UMFPACK_VERSION_MAJOR 6 CACHE STRING "" FORCE ) +set ( UMFPACK_VERSION_MINOR 2 CACHE STRING "" FORCE ) +set ( UMFPACK_VERSION_SUB 2 CACHE STRING "" FORCE ) message ( STATUS "Building UMFPACK version: v" ${UMFPACK_VERSION_MAJOR}. ${UMFPACK_VERSION_MINOR}. ${UMFPACK_VERSION_SUB} " (" ${UMFPACK_DATE} ")" ) +#------------------------------------------------------------------------------- +# define the project +#------------------------------------------------------------------------------- + +project ( umfpack + VERSION "${UMFPACK_VERSION_MAJOR}.${UMFPACK_VERSION_MINOR}.${UMFPACK_VERSION_SUB}" + LANGUAGES C ) + #------------------------------------------------------------------------------- # SuiteSparse policies #------------------------------------------------------------------------------- set ( CMAKE_MODULE_PATH ${CMAKE_MODULE_PATH} - ${CMAKE_SOURCE_DIR}/../CHOLMOD/cmake_modules - ${CMAKE_SOURCE_DIR}/../SuiteSparse_config/cmake_modules ) + ${PROJECT_SOURCE_DIR}/../CHOLMOD/cmake_modules + ${PROJECT_SOURCE_DIR}/../SuiteSparse_config/cmake_modules ) -option ( ENABLE_CUDA "Enable CUDA acceleration" on ) +option ( ENABLE_CUDA "Enable CUDA acceleration" ON ) +option ( DEMO "ON: Build the demo programs. OFF (default): do not build the demo programs." OFF ) include ( SuiteSparsePolicy ) -#------------------------------------------------------------------------------- -# define the project -#------------------------------------------------------------------------------- - if ( SUITESPARSE_CUDA ) # UMFPACK with CHOLMOD (which can use CUDA) - project ( umfpack - VERSION "${UMFPACK_VERSION_MAJOR}.${UMFPACK_VERSION_MINOR}.${UMFPACK_VERSION_SUB}" - LANGUAGES C CXX CUDA ) -else ( ) - project ( umfpack - VERSION "${UMFPACK_VERSION_MAJOR}.${UMFPACK_VERSION_MINOR}.${UMFPACK_VERSION_SUB}" - LANGUAGES C ) + enable_language ( CXX CUDA ) endif ( ) #------------------------------------------------------------------------------- # find library dependencies #------------------------------------------------------------------------------- -option ( NOPENMP "ON: do not use OpenMP. OFF (default): use OpenMP" off ) +option ( NOPENMP "ON: do not use OpenMP. OFF (default): use OpenMP" OFF ) if ( NOPENMP ) # OpenMP has been disabled set ( OPENMP_FOUND false ) @@ -61,21 +60,45 @@ else ( ) find_package ( OpenMP ) endif ( ) -find_package ( SuiteSparse_config 7.3.0 - PATHS ${CMAKE_SOURCE_DIR}/../SuiteSparse_config/build NO_DEFAULT_PATH ) -if ( NOT TARGET SuiteSparse::SuiteSparseConfig ) - find_package ( SuiteSparse_config 7.3.0 REQUIRED ) -endif ( ) -find_package ( AMD 3.2.1 - PATHS ${CMAKE_SOURCE_DIR}/../AMD/build NO_DEFAULT_PATH ) -if ( NOT TARGET SuiteSparse::AMD ) - find_package ( AMD 3.2.1 REQUIRED ) +if ( NOT SUITESPARSE_ROOT_CMAKELISTS ) + find_package ( SuiteSparse_config 7.3.0 + PATHS ${CMAKE_SOURCE_DIR}/../SuiteSparse_config/build NO_DEFAULT_PATH ) + if ( NOT TARGET SuiteSparse::SuiteSparseConfig ) + find_package ( SuiteSparse_config 7.3.0 REQUIRED ) + endif ( ) + + find_package ( AMD 3.2.1 + PATHS ${CMAKE_SOURCE_DIR}/../AMD/build NO_DEFAULT_PATH ) + if ( NOT TARGET SuiteSparse::AMD ) + find_package ( AMD 3.2.1 REQUIRED ) + endif ( ) + + if ( DEMO AND NOT WIN32 ) + find_package ( COLAMD 3.2.1 + PATHS ${CMAKE_SOURCE_DIR}/../COLAMD/build NO_DEFAULT_PATH ) + if ( NOT TARGET SuiteSparse::COLAMD ) + find_package ( COLAMD 3.2.1 REQUIRED ) + endif ( ) + + find_package ( CAMD 3.2.1 + PATHS ${CMAKE_SOURCE_DIR}/../CAMD/build NO_DEFAULT_PATH ) + if ( NOT TARGET SuiteSparse::CAMD ) + find_package ( CAMD 3.2.1 REQUIRED ) + endif ( ) + + find_package ( CCOLAMD 3.2.1 + PATHS ${CMAKE_SOURCE_DIR}/../CCOLAMD/build NO_DEFAULT_PATH ) + if ( NOT TARGET SuiteSparse::CCOLAMD ) + find_package ( CCOLAMD 3.2.1 REQUIRED ) + endif ( ) + endif ( ) endif ( ) + include ( SuiteSparseBLAS ) # requires cmake 3.22 -option ( NCHOLMOD "ON: do not use CHOLMOD. OFF (default): use CHOLMOD" off ) +option ( NCHOLMOD "ON: do not use CHOLMOD. OFF (default): use CHOLMOD" OFF ) -if ( NOT NCHOLMOD ) +if ( NOT SUITESPARSE_ROOT_CMAKELISTS AND NOT NCHOLMOD ) # look for CHOLMOD (optional fill-reducing orderings) find_package ( CHOLMOD 5.0.0 PATHS ${CMAKE_SOURCE_DIR}/../CHOLMOD/build NO_DEFAULT_PATH ) @@ -169,7 +192,8 @@ endif ( ) # SuiteSparseConfig: target_link_libraries ( UMFPACK PRIVATE SuiteSparse::SuiteSparseConfig ) -target_include_directories ( UMFPACK PUBLIC "$" ) +target_include_directories ( UMFPACK PUBLIC + "$" ) if ( NOT NSTATIC ) if ( TARGET SuiteSparse::SuiteSparseConfig_static ) target_link_libraries ( UMFPACK_static PUBLIC SuiteSparse::SuiteSparseConfig_static ) @@ -350,7 +374,6 @@ endif ( ) # Demo library and programs #------------------------------------------------------------------------------- -option ( DEMO "ON: Build the demo programs. OFF (default): do not build the demo programs." off ) if ( DEMO ) #--------------------------------------------------------------------------- @@ -435,5 +458,6 @@ endif ( ) # report status #------------------------------------------------------------------------------- -include ( SuiteSparseReport ) - +if ( NOT SUITESPARSE_ROOT_CMAKELISTS ) + include ( SuiteSparseReport ) +endif ( ) From a27f09c8d16e2236988c1db545f480ef5e01f2f3 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Markus=20M=C3=BCtzel?= Date: Mon, 18 Sep 2023 14:23:45 +0200 Subject: [PATCH 12/24] Add RBio to the root CMakeLists.txt --- CMakeLists.txt | 13 +++++++++++-- RBio/CMakeLists.txt | 43 +++++++++++++++++++++++-------------------- 2 files changed, 34 insertions(+), 22 deletions(-) diff --git a/CMakeLists.txt b/CMakeLists.txt index c491f60ff..a970ecc64 100644 --- a/CMakeLists.txt +++ b/CMakeLists.txt @@ -17,7 +17,7 @@ project ( "SuiteSparse" ) # lower-case list of all projects that can be built by this root CMake file set ( SUITESPARSE_KNOWN_PROJECTS - "suitesparse_config;mongoose;amd;btf;camd;ccolamd;colamd;cholmod;cxsparse;ldl;klu;umfpack" ) + "suitesparse_config;mongoose;amd;btf;camd;ccolamd;colamd;cholmod;cxsparse;ldl;klu;umfpack;rbio" ) set ( SUITESPARSE_ENABLE_PROJECTS "all" CACHE STRING "Semicolon-separated list of SuiteSparse projects to be built (${SUITESPARSE_KNOWN_PROJECTS}, or \"all\")" ) @@ -113,7 +113,8 @@ if ( "mongoose" IN_LIST SUITESPARSE_ENABLE_PROJECTS OR "cxsparse" IN_LIST SUITESPARSE_ENABLE_PROJECTS OR "ldl" IN_LIST SUITESPARSE_ENABLE_PROJECTS OR "klu" IN_LIST SUITESPARSE_ENABLE_PROJECTS - OR "umfpack" IN_LIST SUITESPARSE_ENABLE_PROJECTS ) + OR "umfpack" IN_LIST SUITESPARSE_ENABLE_PROJECTS + OR "rbio" IN_LIST SUITESPARSE_ENABLE_PROJECTS ) if ( NOT "suitesparse_config" IN_LIST SUITESPARSE_ENABLE_PROJECTS ) message ( STATUS "Adding \"suitesparse_config\" to the list of built targets." ) list ( APPEND SUITESPARSE_ENABLE_PROJECTS "suitesparse_config" ) @@ -226,6 +227,14 @@ if ( "umfpack" IN_LIST SUITESPARSE_ENABLE_PROJECTS ) endif ( ) endif ( ) +if ( "rbio" IN_LIST SUITESPARSE_ENABLE_PROJECTS ) + add_subdirectory ( "RBio" ) + add_library ( SuiteSparse::RBio ALIAS RBio ) + if ( NOT NSTATIC ) + add_library ( SuiteSparse::RBio_static ALIAS RBio_static ) + endif ( ) +endif ( ) + #------------------------------------------------------------------------------- # report status #------------------------------------------------------------------------------- diff --git a/RBio/CMakeLists.txt b/RBio/CMakeLists.txt index 6bda0108d..b927b23d6 100644 --- a/RBio/CMakeLists.txt +++ b/RBio/CMakeLists.txt @@ -2,7 +2,7 @@ # SuiteSparse/RBio/CMakeLists.txt: cmake for RBio #------------------------------------------------------------------------------- -# RBio, Copyright (c) 2009-2022, Timothy A. Davis. All Rights Reserved. +# RBio, Copyright (c) 2009-2023, Timothy A. Davis. All Rights Reserved. # SPDX-License-Identifier: GPL-2.0+ #------------------------------------------------------------------------------- @@ -12,24 +12,15 @@ cmake_minimum_required ( VERSION 3.20 ) set ( RBIO_DATE "Sept 18, 2023" ) -set ( RBIO_VERSION_MAJOR 4 ) -set ( RBIO_VERSION_MINOR 2 ) -set ( RBIO_VERSION_SUB 1 ) +set ( RBIO_VERSION_MAJOR 4 CACHE STRING "" FORCE ) +set ( RBIO_VERSION_MINOR 2 CACHE STRING "" FORCE ) +set ( RBIO_VERSION_SUB 1 CACHE STRING "" FORCE ) message ( STATUS "Building RBIO version: v" ${RBIO_VERSION_MAJOR}. ${RBIO_VERSION_MINOR}. ${RBIO_VERSION_SUB} " (" ${RBIO_DATE} ")" ) -#------------------------------------------------------------------------------- -# SuiteSparse policies -#------------------------------------------------------------------------------- - -set ( CMAKE_MODULE_PATH ${CMAKE_MODULE_PATH} - ${CMAKE_SOURCE_DIR}/../SuiteSparse_config/cmake_modules ) - -include ( SuiteSparsePolicy ) - #------------------------------------------------------------------------------- # define the project #------------------------------------------------------------------------------- @@ -38,14 +29,25 @@ project ( rbio VERSION "${RBIO_VERSION_MAJOR}.${RBIO_VERSION_MINOR}.${RBIO_VERSION_SUB}" LANGUAGES C ) +#------------------------------------------------------------------------------- +# SuiteSparse policies +#------------------------------------------------------------------------------- + +set ( CMAKE_MODULE_PATH ${CMAKE_MODULE_PATH} + ${PROJECT_SOURCE_DIR}/../SuiteSparse_config/cmake_modules ) + +include ( SuiteSparsePolicy ) + #------------------------------------------------------------------------------- # find library dependencies #------------------------------------------------------------------------------- -find_package ( SuiteSparse_config 7.2.0 - PATHS ${CMAKE_SOURCE_DIR}/../SuiteSparse_config/build NO_DEFAULT_PATH ) -if ( NOT TARGET SuiteSparse::SuiteSparseConfig ) - find_package ( SuiteSparse_config 7.2.0 REQUIRED ) +if ( NOT SUITESPARSE_ROOT_CMAKELISTS ) + find_package ( SuiteSparse_config 7.2.0 + PATHS ${CMAKE_SOURCE_DIR}/../SuiteSparse_config/build NO_DEFAULT_PATH ) + if ( NOT TARGET SuiteSparse::SuiteSparseConfig ) + find_package ( SuiteSparse_config 7.2.0 REQUIRED ) + endif ( ) endif ( ) #------------------------------------------------------------------------------- @@ -217,7 +219,7 @@ endif ( ) # Demo library and programs #------------------------------------------------------------------------------- -option ( DEMO "ON: Build the demo programs. OFF (default): do not build the demo programs." off ) +option ( DEMO "ON: Build the demo programs. OFF (default): do not build the demo programs." OFF ) if ( DEMO ) #--------------------------------------------------------------------------- @@ -245,5 +247,6 @@ endif ( ) # report status #------------------------------------------------------------------------------- -include ( SuiteSparseReport ) - +if ( NOT SUITESPARSE_ROOT_CMAKELISTS ) + include ( SuiteSparseReport ) +endif ( ) From 772d78de13962b3eb92f74b5f673b4bd7bb7f597 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Markus=20M=C3=BCtzel?= Date: Mon, 18 Sep 2023 14:41:21 +0200 Subject: [PATCH 13/24] Add SPQR to the root CMakeLists.txt --- CMakeLists.txt | 46 +++++++++++++++++++++++----- SPQR/CMakeLists.txt | 54 +++++++++++++++++---------------- SPQR/GPUQREngine/CMakeLists.txt | 24 ++++----------- SPQR/GPURuntime/CMakeLists.txt | 22 +++----------- 4 files changed, 76 insertions(+), 70 deletions(-) diff --git a/CMakeLists.txt b/CMakeLists.txt index a970ecc64..c263392a6 100644 --- a/CMakeLists.txt +++ b/CMakeLists.txt @@ -11,20 +11,39 @@ cmake_minimum_required ( VERSION 3.20 ) project ( "SuiteSparse" ) +#------------------------------------------------------------------------------- +# SuiteSparse policies +#------------------------------------------------------------------------------- + +set ( CMAKE_MODULE_PATH ${CMAKE_MODULE_PATH} + ${PROJECT_SOURCE_DIR}/SuiteSparse_config/cmake_modules ) + +option ( ENABLE_CUDA "Enable CUDA acceleration" ON ) + +# SuiteSparsePolicy enables SUITESPARSE_CUDA if a CUDA compiler can be found. +include ( SuiteSparsePolicy ) + #------------------------------------------------------------------------------- # build options #------------------------------------------------------------------------------- # lower-case list of all projects that can be built by this root CMake file -set ( SUITESPARSE_KNOWN_PROJECTS - "suitesparse_config;mongoose;amd;btf;camd;ccolamd;colamd;cholmod;cxsparse;ldl;klu;umfpack;rbio" ) +set ( SUITESPARSE_ALL_PROJECTS + "suitesparse_config;mongoose;amd;btf;camd;ccolamd;colamd;cholmod;cxsparse;ldl;klu;umfpack;rbio;spqr" ) + +# lower-case list of extra projects that can be built by this root CMake file +set ( SUITESPARSE_EXTRA_PROJECTS + "" ) + +# lower-case list of known projects that can be built by this root CMake file +set ( SUITESPARSE_KNOWN_PROJECTS "${SUITESPARSE_ALL_PROJECTS};${SUITESPARSE_EXTRA_PROJECTS}" ) set ( SUITESPARSE_ENABLE_PROJECTS "all" CACHE STRING "Semicolon-separated list of SuiteSparse projects to be built (${SUITESPARSE_KNOWN_PROJECTS}, or \"all\")" ) # expand "all" early on if ( SUITESPARSE_ENABLE_PROJECTS STREQUAL "all" ) - set ( SUITESPARSE_ENABLE_PROJECTS ${SUITESPARSE_KNOWN_PROJECTS} ) + set ( SUITESPARSE_ENABLE_PROJECTS ${SUITESPARSE_ALL_PROJECTS} ) endif ( ) # check for unknown projects in list @@ -38,7 +57,7 @@ endforeach ( ) option ( NCAMD "ON: do not use CAMD/CCOLAMD. OFF (default): use CAMD/CCOLAMD" OFF ) # KLU and UMFPACK options affecting dependencies -option ( NCHOLMOD "ON: do not use CHOLMOD. OFF (default): use CHOLMOD" OFF ) +option ( NCHOLMOD "ON: do not use CHOLMOD in KLU and UMFPACK. OFF (default): use CHOLMOD" OFF ) #------------------------------------------------------------------------------- # global variables @@ -69,9 +88,11 @@ if ( "klu" IN_LIST SUITESPARSE_ENABLE_PROJECTS ) endif ( ) endif ( ) -if ( "klu" IN_LIST SUITESPARSE_ENABLE_PROJECTS - OR "umfpack" IN_LIST SUITESPARSE_ENABLE_PROJECTS ) - if ( NOT NCHOLMOD AND NOT "cholmod" IN_LIST SUITESPARSE_ENABLE_PROJECTS ) +if ( ( NOT NCHOLMOD AND + ( "klu" IN_LIST SUITESPARSE_ENABLE_PROJECTS + OR "umfpack" IN_LIST SUITESPARSE_ENABLE_PROJECTS ) ) + OR "spqr" IN_LIST SUITESPARSE_ENABLE_PROJECTS ) + if ( NOT "cholmod" IN_LIST SUITESPARSE_ENABLE_PROJECTS ) message ( STATUS "Adding \"cholmod\" to the list of built targets." ) list ( APPEND SUITESPARSE_ENABLE_PROJECTS "cholmod" ) endif ( ) @@ -114,7 +135,8 @@ if ( "mongoose" IN_LIST SUITESPARSE_ENABLE_PROJECTS OR "ldl" IN_LIST SUITESPARSE_ENABLE_PROJECTS OR "klu" IN_LIST SUITESPARSE_ENABLE_PROJECTS OR "umfpack" IN_LIST SUITESPARSE_ENABLE_PROJECTS - OR "rbio" IN_LIST SUITESPARSE_ENABLE_PROJECTS ) + OR "rbio" IN_LIST SUITESPARSE_ENABLE_PROJECTS + OR "spqr" IN_LIST SUITESPARSE_ENABLE_PROJECTS ) if ( NOT "suitesparse_config" IN_LIST SUITESPARSE_ENABLE_PROJECTS ) message ( STATUS "Adding \"suitesparse_config\" to the list of built targets." ) list ( APPEND SUITESPARSE_ENABLE_PROJECTS "suitesparse_config" ) @@ -235,6 +257,14 @@ if ( "rbio" IN_LIST SUITESPARSE_ENABLE_PROJECTS ) endif ( ) endif ( ) +if ( "spqr" IN_LIST SUITESPARSE_ENABLE_PROJECTS ) + add_subdirectory ( "SPQR" ) + add_library ( SuiteSparse::SPQR ALIAS SPQR ) + if ( NOT NSTATIC ) + add_library ( SuiteSparse::SPQR_static ALIAS SPQR_static ) + endif ( ) +endif ( ) + #------------------------------------------------------------------------------- # report status #------------------------------------------------------------------------------- diff --git a/SPQR/CMakeLists.txt b/SPQR/CMakeLists.txt index d0beeec09..32c395bd8 100644 --- a/SPQR/CMakeLists.txt +++ b/SPQR/CMakeLists.txt @@ -14,34 +14,34 @@ cmake_minimum_required ( VERSION 3.22 ) set ( SPQR_DATE "Oct 23, 2023" ) -set ( SPQR_VERSION_MAJOR 4 ) -set ( SPQR_VERSION_MINOR 2 ) -set ( SPQR_VERSION_SUB 2 ) +set ( SPQR_VERSION_MAJOR 4 CACHE STRING "" FORCE ) +set ( SPQR_VERSION_MINOR 2 CACHE STRING "" FORCE ) +set ( SPQR_VERSION_SUB 2 CACHE STRING "" FORCE ) message ( STATUS "Building SPQR version: v" ${SPQR_VERSION_MAJOR}. ${SPQR_VERSION_MINOR}. ${SPQR_VERSION_SUB} " (" ${SPQR_DATE} ")" ) +#------------------------------------------------------------------------------- +# define the project +#------------------------------------------------------------------------------- + +project ( spqr + VERSION "${SPQR_VERSION_MAJOR}.${SPQR_VERSION_MINOR}.${SPQR_VERSION_SUB}" + LANGUAGES C CXX ) + #------------------------------------------------------------------------------- # SuiteSparse policies #------------------------------------------------------------------------------- set ( CMAKE_MODULE_PATH ${CMAKE_MODULE_PATH} - ${CMAKE_SOURCE_DIR}/../SuiteSparse_config/cmake_modules ) + ${PROJECT_SOURCE_DIR}/../SuiteSparse_config/cmake_modules ) option ( ENABLE_CUDA "Enable CUDA acceleration" ON ) include ( SuiteSparsePolicy ) -#------------------------------------------------------------------------------- -# define the project -#------------------------------------------------------------------------------- - -project ( spqr - VERSION "${SPQR_VERSION_MAJOR}.${SPQR_VERSION_MINOR}.${SPQR_VERSION_SUB}" - LANGUAGES C CXX ) - #------------------------------------------------------------------------------- # find library dependencies #------------------------------------------------------------------------------- @@ -54,19 +54,21 @@ else ( ) find_package ( OpenMP ) endif ( ) -find_package ( SuiteSparse_config 7.3.0 - PATHS ${CMAKE_SOURCE_DIR}/../SuiteSparse_config/build NO_DEFAULT_PATH ) -if ( NOT TARGET SuiteSparse::SuiteSparseConfig ) - find_package ( SuiteSparse_config 7.3.0 REQUIRED ) -endif ( ) +if ( NOT SUITESPARSE_ROOT_CMAKELISTS ) + find_package ( SuiteSparse_config 7.3.0 + PATHS ${CMAKE_SOURCE_DIR}/../SuiteSparse_config/build NO_DEFAULT_PATH ) + if ( NOT TARGET SuiteSparse::SuiteSparseConfig ) + find_package ( SuiteSparse_config 7.3.0 REQUIRED ) + endif ( ) -find_package ( CHOLMOD 5.0.0 - PATHS ${CMAKE_SOURCE_DIR}/../CHOLMOD/build NO_DEFAULT_PATH ) -if ( NOT TARGET SuiteSparse::CHOLMOD ) - find_package ( CHOLMOD 5.0.0 REQUIRED ) + find_package ( CHOLMOD 5.0.0 + PATHS ${CMAKE_SOURCE_DIR}/../CHOLMOD/build NO_DEFAULT_PATH ) + if ( NOT TARGET SuiteSparse::CHOLMOD ) + find_package ( CHOLMOD 5.0.0 REQUIRED ) + endif ( ) endif ( ) -if ( SUITESPARSE_CUDA ) +if ( NOT SUITESPARSE_ROOT_CMAKELISTS AND SUITESPARSE_CUDA ) find_package ( CHOLMOD_CUDA 5.0.0 PATHS ${CMAKE_SOURCE_DIR}/../CHOLMOD/build NO_DEFAULT_PATH ) if ( NOT TARGET SuiteSparse::CHOLMOD_CUDA ) @@ -204,8 +206,7 @@ endif ( ) # CHOLMOD: # link with CHOLMOD and its dependencies -target_link_libraries ( SPQR PRIVATE - SuiteSparse::CHOLMOD ) +target_link_libraries ( SPQR PRIVATE SuiteSparse::CHOLMOD ) if ( NOT NSTATIC ) if ( TARGET SuiteSparse::CHOLMOD_static ) target_link_libraries ( SPQR_static PUBLIC SuiteSparse::CHOLMOD_static ) @@ -404,5 +405,6 @@ endif ( ) # report status #------------------------------------------------------------------------------- -include ( SuiteSparseReport ) - +if ( NOT SUITESPARSE_ROOT_CMAKELISTS ) + include ( SuiteSparseReport ) +endif ( ) diff --git a/SPQR/GPUQREngine/CMakeLists.txt b/SPQR/GPUQREngine/CMakeLists.txt index 7670609c9..ab44efe08 100644 --- a/SPQR/GPUQREngine/CMakeLists.txt +++ b/SPQR/GPUQREngine/CMakeLists.txt @@ -13,19 +13,15 @@ cmake_minimum_required ( VERSION 3.20 ) set ( GPUQRENGINE_DATE "Oct 23, 2023" ) -set ( GPUQRENGINE_VERSION_MAJOR 3 ) -set ( GPUQRENGINE_VERSION_MINOR 2 ) -set ( GPUQRENGINE_VERSION_SUB 2 ) +set ( GPUQRENGINE_VERSION_MAJOR 3 CACHE STRING "" FORCE ) +set ( GPUQRENGINE_VERSION_MINOR 2 CACHE STRING "" FORCE ) +set ( GPUQRENGINE_VERSION_SUB 2 CACHE STRING "" FORCE ) message ( STATUS "Building GPUQRENGINE version: v" ${GPUQRENGINE_VERSION_MAJOR}. ${GPUQRENGINE_VERSION_MINOR}. ${GPUQRENGINE_VERSION_SUB} " (" ${GPUQRENGINE_DATE} ")" ) -set ( GPUQRENGINE_VERSION_MAJOR ${GPUQRENGINE_VERSION_MAJOR} PARENT_SCOPE ) -set ( GPUQRENGINE_VERSION_MINOR ${GPUQRENGINE_VERSION_MINOR} PARENT_SCOPE ) -set ( GPUQRENGINE_VERSION_SUB ${GPUQRENGINE_VERSION_SUB} PARENT_SCOPE ) - #------------------------------------------------------------------------------- # define the project #------------------------------------------------------------------------------- @@ -47,17 +43,10 @@ include ( SuiteSparsePolicy ) # find library dependencies #------------------------------------------------------------------------------- -# for the library itself -find_package ( SuiteSparse_config 7.3.0 - PATHS ${CMAKE_SOURCE_DIR}/../../SuiteSparse_config/build NO_DEFAULT_PATH ) -if ( NOT TARGET SuiteSparse::SuiteSparseConfig ) - find_package ( SuiteSparse_config 7.3.0 REQUIRED ) -endif ( ) - # Demo disabled for GPUQREngine v2.x set ( DEMO_OK false ) -if ( DEMO AND DEMO_OK ) +if ( NOT SUITESPARSE_ROOT_CMAKELISTS AND DEMO AND DEMO_OK ) # for the demo only: find_package ( CHOLMOD 5.0.0 PATHS ${CMAKE_SOURCE_DIR}/../../CHOLMOD/build NO_DEFAULT_PATH ) @@ -245,9 +234,8 @@ if ( DEMO AND DEMO_OK ) add_executable ( gpuqrengine_demo "Demo/gpuqrengine_demo.cpp" ) # Libraries required for Demo programs - target_link_libraries ( gpuqrengine_demo PUBLIC GPUQREngine - SuiteSparse::CHOLMOD SuiteSparse::CHOLMOD_CUDA - GPURuntime SuiteSparse::SuiteSparseConfig ) + target_link_libraries ( gpuqrengine_demo PUBLIC GPUQREngine GPURuntime + SuiteSparse::CHOLMOD SuiteSparse::CHOLMOD_CUDA SuiteSparse::SuiteSparseConfig ) else ( ) diff --git a/SPQR/GPURuntime/CMakeLists.txt b/SPQR/GPURuntime/CMakeLists.txt index 6db84844b..3b9b7a979 100644 --- a/SPQR/GPURuntime/CMakeLists.txt +++ b/SPQR/GPURuntime/CMakeLists.txt @@ -13,19 +13,15 @@ cmake_minimum_required ( VERSION 3.20 ) set ( SUITESPARSE_GPURUNTIME_DATE "Sept 18, 2023" ) -set ( SUITESPARSE_GPURUNTIME_VERSION_MAJOR 3 ) -set ( SUITESPARSE_GPURUNTIME_VERSION_MINOR 2 ) -set ( SUITESPARSE_GPURUNTIME_VERSION_SUB 1 ) +set ( SUITESPARSE_GPURUNTIME_VERSION_MAJOR 3 CACHE STRING "" FORCE ) +set ( SUITESPARSE_GPURUNTIME_VERSION_MINOR 2 CACHE STRING "" FORCE ) +set ( SUITESPARSE_GPURUNTIME_VERSION_SUB 1 CACHE STRING "" FORCE ) message ( STATUS "Building SUITESPARSE_GPURUNTIME version: v" ${SUITESPARSE_GPURUNTIME_VERSION_MAJOR}. ${SUITESPARSE_GPURUNTIME_VERSION_MINOR}. ${SUITESPARSE_GPURUNTIME_VERSION_SUB} " (" ${SUITESPARSE_GPURUNTIME_DATE} ")" ) -set ( SUITESPARSE_GPURUNTIME_VERSION_MAJOR ${SUITESPARSE_GPURUNTIME_VERSION_MAJOR} PARENT_SCOPE ) -set ( SUITESPARSE_GPURUNTIME_VERSION_MINOR ${SUITESPARSE_GPURUNTIME_VERSION_MINOR} PARENT_SCOPE ) -set ( SUITESPARSE_GPURUNTIME_VERSION_SUB ${SUITESPARSE_GPURUNTIME_VERSION_SUB} PARENT_SCOPE ) - #------------------------------------------------------------------------------- # define the project #------------------------------------------------------------------------------- @@ -41,20 +37,10 @@ project ( suitesparse_gpuruntime set ( CMAKE_MODULE_PATH ${CMAKE_MODULE_PATH} ${PROJECT_SOURCE_DIR}/../../SuiteSparse_config/cmake_modules ) -option ( ENABLE_CUDA "Enable CUDA acceleration" on ) +option ( ENABLE_CUDA "Enable CUDA acceleration" ON ) include ( SuiteSparsePolicy ) -#------------------------------------------------------------------------------- -# find library dependencies -#------------------------------------------------------------------------------- - -find_package ( SuiteSparse_config 7.2.0 - PATHS ${CMAKE_SOURCE_DIR}/../SuiteSparse_config/build NO_DEFAULT_PATH ) -if ( NOT TARGET SuiteSparse::SuiteSparseConfig ) - find_package ( SuiteSparse_config 7.2.0 REQUIRED ) -endif ( ) - #------------------------------------------------------------------------------- # configure files #------------------------------------------------------------------------------- From f4932508b125816397da8e7500d3eefd18be7919 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Markus=20M=C3=BCtzel?= Date: Mon, 18 Sep 2023 15:28:08 +0200 Subject: [PATCH 14/24] Add GraphBLAS to the root CMakeLists.txt --- CMakeLists.txt | 14 +++++- GraphBLAS/CMakeLists.txt | 45 ++++++++++++------- .../cmake_modules/GraphBLAS_version.cmake | 6 +-- 3 files changed, 44 insertions(+), 21 deletions(-) diff --git a/CMakeLists.txt b/CMakeLists.txt index c263392a6..cfeaf55fd 100644 --- a/CMakeLists.txt +++ b/CMakeLists.txt @@ -29,7 +29,7 @@ include ( SuiteSparsePolicy ) # lower-case list of all projects that can be built by this root CMake file set ( SUITESPARSE_ALL_PROJECTS - "suitesparse_config;mongoose;amd;btf;camd;ccolamd;colamd;cholmod;cxsparse;ldl;klu;umfpack;rbio;spqr" ) + "suitesparse_config;mongoose;amd;btf;camd;ccolamd;colamd;cholmod;cxsparse;ldl;klu;umfpack;rbio;spqr;graphblas" ) # lower-case list of extra projects that can be built by this root CMake file set ( SUITESPARSE_EXTRA_PROJECTS @@ -59,6 +59,10 @@ option ( NCAMD "ON: do not use CAMD/CCOLAMD. OFF (default): use CAMD/CCOLAMD" O # KLU and UMFPACK options affecting dependencies option ( NCHOLMOD "ON: do not use CHOLMOD in KLU and UMFPACK. OFF (default): use CHOLMOD" OFF ) +# overwrite NSTATIC specifically for GraphBLAS because building the library +# takes a long time +option ( GRAPHBLAS_NSTATIC "ON (default): set NSTATIC for GraphBLAS project. OFF: Use same value of NSTATIC for GraphBLAS like in the other projects" ON ) + #------------------------------------------------------------------------------- # global variables #------------------------------------------------------------------------------- @@ -265,6 +269,14 @@ if ( "spqr" IN_LIST SUITESPARSE_ENABLE_PROJECTS ) endif ( ) endif ( ) +if ( "graphblas" IN_LIST SUITESPARSE_ENABLE_PROJECTS ) + add_subdirectory ( "GraphBLAS" ) + add_library ( SuiteSparse::GraphBLAS ALIAS GraphBLAS ) + if ( TARGET GraphBLAS_static ) + add_library ( SuiteSparse::GraphBLAS_static ALIAS GraphBLAS_static ) + endif ( ) +endif ( ) + #------------------------------------------------------------------------------- # report status #------------------------------------------------------------------------------- diff --git a/GraphBLAS/CMakeLists.txt b/GraphBLAS/CMakeLists.txt index 6c8e85289..66e42edbd 100644 --- a/GraphBLAS/CMakeLists.txt +++ b/GraphBLAS/CMakeLists.txt @@ -7,24 +7,29 @@ # See the User Guide for details on how to compile SuiteSparse:GraphBLAS. +cmake_minimum_required ( VERSION 3.20 ) + #------------------------------------------------------------------------------- -# get the version +# define the project #------------------------------------------------------------------------------- -cmake_minimum_required ( VERSION 3.20 ) +project ( graphblas + LANGUAGES C ) -set ( CMAKE_MODULE_PATH ${CMAKE_MODULE_PATH} - ${CMAKE_SOURCE_DIR}/cmake_modules ) +#------------------------------------------------------------------------------- +# SuiteSparse policies +#------------------------------------------------------------------------------- -include ( GraphBLAS_version ) +set ( CMAKE_MODULE_PATH ${CMAKE_MODULE_PATH} + ${PROJECT_SOURCE_DIR}/cmake_modules ) #------------------------------------------------------------------------------- -# SuiteSparse policies +# get the version #------------------------------------------------------------------------------- -# CUDA is under development for now, and not deployed in production: - set ( ENABLE_CUDA false ) -# set ( ENABLE_CUDA true ) +include ( GraphBLAS_version ) + +set ( PROJECT_VERSION "${GraphBLAS_VERSION_MAJOR}.${GraphBLAS_VERSION_MINOR}.${GraphBLAS_VERSION_SUB}" ) #------------------------------------------------------------------------------- # SuiteSparse policies @@ -34,25 +39,29 @@ include ( GraphBLAS_version ) # by default set ( NSTATIC_DEFAULT_ON true ) +# CUDA is under development for now, and not deployed in production: + set ( ENABLE_CUDA false ) +# set ( ENABLE_CUDA true ) + include ( SuiteSparsePolicy ) include ( GraphBLAS_JIT_paths ) +if ( GRAPHBLAS_NSTATIC ) + # ignore current value of NSTATIC and set it to ON + set ( NSTATIC ON ) +endif ( ) + #------------------------------------------------------------------------------- # define the project #------------------------------------------------------------------------------- if ( SUITESPARSE_CUDA ) # FOR NOW: do not compile FactoryKernels when developing the CUDA kernels - set ( COMPACT on ) + set ( COMPACT ON ) message ( STATUS "GraphBLAS CUDA JIT: enabled") - project ( graphblas - VERSION "${GraphBLAS_VERSION_MAJOR}.${GraphBLAS_VERSION_MINOR}.${GraphBLAS_VERSION_SUB}" - LANGUAGES CUDA C ) + enable_language ( CUDA ) else ( ) message ( STATUS "GraphBLAS CUDA JIT: disabled") - project ( graphblas - VERSION "${GraphBLAS_VERSION_MAJOR}.${GraphBLAS_VERSION_MINOR}.${GraphBLAS_VERSION_SUB}" - LANGUAGES C ) endif ( ) #------------------------------------------------------------------------------- @@ -623,4 +632,6 @@ endif ( ) # report status #------------------------------------------------------------------------------- -include ( SuiteSparseReport ) +if ( NOT SUITESPARSE_ROOT_CMAKELISTS ) + include ( SuiteSparseReport ) +endif ( ) diff --git a/GraphBLAS/cmake_modules/GraphBLAS_version.cmake b/GraphBLAS/cmake_modules/GraphBLAS_version.cmake index eb83ff12e..4c7ed717a 100644 --- a/GraphBLAS/cmake_modules/GraphBLAS_version.cmake +++ b/GraphBLAS/cmake_modules/GraphBLAS_version.cmake @@ -9,9 +9,9 @@ # version of SuiteSparse:GraphBLAS set ( GraphBLAS_DATE "Oct 7, 2023" ) -set ( GraphBLAS_VERSION_MAJOR 8 ) -set ( GraphBLAS_VERSION_MINOR 2 ) -set ( GraphBLAS_VERSION_SUB 1 ) +set ( GraphBLAS_VERSION_MAJOR 8 CACHE STRING "" FORCE ) +set ( GraphBLAS_VERSION_MINOR 2 CACHE STRING "" FORCE ) +set ( GraphBLAS_VERSION_SUB 1 CACHE STRING "" FORCE ) # GraphBLAS C API Specification version, at graphblas.org set ( GraphBLAS_API_DATE "Nov 15, 2021" ) From 463dccc6359b3f3bc556e6b31c29e4132e6e8480 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Markus=20M=C3=BCtzel?= Date: Mon, 18 Sep 2023 15:34:35 +0200 Subject: [PATCH 15/24] Add SPEX to the root CMakeLists.txt --- CMakeLists.txt | 38 +++++++++++++++++---------- SPEX/CMakeLists.txt | 63 ++++++++++++++++++++++++--------------------- 2 files changed, 58 insertions(+), 43 deletions(-) diff --git a/CMakeLists.txt b/CMakeLists.txt index cfeaf55fd..e3905ae2d 100644 --- a/CMakeLists.txt +++ b/CMakeLists.txt @@ -29,7 +29,7 @@ include ( SuiteSparsePolicy ) # lower-case list of all projects that can be built by this root CMake file set ( SUITESPARSE_ALL_PROJECTS - "suitesparse_config;mongoose;amd;btf;camd;ccolamd;colamd;cholmod;cxsparse;ldl;klu;umfpack;rbio;spqr;graphblas" ) + "suitesparse_config;mongoose;amd;btf;camd;ccolamd;colamd;cholmod;cxsparse;ldl;klu;umfpack;rbio;spqr;spex;graphblas" ) # lower-case list of extra projects that can be built by this root CMake file set ( SUITESPARSE_EXTRA_PROJECTS @@ -104,27 +104,30 @@ endif ( ) if ( "cholmod" IN_LIST SUITESPARSE_ENABLE_PROJECTS OR "ldl" IN_LIST SUITESPARSE_ENABLE_PROJECTS - OR "umfpack" IN_LIST SUITESPARSE_ENABLE_PROJECTS ) + OR "umfpack" IN_LIST SUITESPARSE_ENABLE_PROJECTS + OR "spex" IN_LIST SUITESPARSE_ENABLE_PROJECTS ) if ( NOT "amd" IN_LIST SUITESPARSE_ENABLE_PROJECTS ) message ( STATUS "Adding \"amd\" to the list of built targets." ) list ( APPEND SUITESPARSE_ENABLE_PROJECTS "amd" ) endif ( ) endif ( ) -if ( "cholmod" IN_LIST SUITESPARSE_ENABLE_PROJECTS ) +if ( "cholmod" IN_LIST SUITESPARSE_ENABLE_PROJECTS + OR "spex" IN_LIST SUITESPARSE_ENABLE_PROJECTS ) if ( NOT "colamd" IN_LIST SUITESPARSE_ENABLE_PROJECTS ) message ( STATUS "Adding \"colamd\" to the list of built targets." ) list ( APPEND SUITESPARSE_ENABLE_PROJECTS "colamd" ) endif ( ) - if ( NOT NCAMD ) - if ( NOT "camd" IN_LIST SUITESPARSE_ENABLE_PROJECTS ) - message ( STATUS "Adding \"camd\" to the list of built targets." ) - list ( APPEND SUITESPARSE_ENABLE_PROJECTS "camd" ) - endif ( ) - if ( NOT "ccolamd" IN_LIST SUITESPARSE_ENABLE_PROJECTS ) - message ( STATUS "Adding \"ccolamd\" to the list of built targets." ) - list ( APPEND SUITESPARSE_ENABLE_PROJECTS "ccolamd" ) - endif ( ) +endif ( ) + +if ( NOT NCAMD AND "cholmod" IN_LIST SUITESPARSE_ENABLE_PROJECTS ) + if ( NOT "camd" IN_LIST SUITESPARSE_ENABLE_PROJECTS ) + message ( STATUS "Adding \"camd\" to the list of built targets." ) + list ( APPEND SUITESPARSE_ENABLE_PROJECTS "camd" ) + endif ( ) + if ( NOT "ccolamd" IN_LIST SUITESPARSE_ENABLE_PROJECTS ) + message ( STATUS "Adding \"ccolamd\" to the list of built targets." ) + list ( APPEND SUITESPARSE_ENABLE_PROJECTS "ccolamd" ) endif ( ) endif ( ) @@ -140,7 +143,8 @@ if ( "mongoose" IN_LIST SUITESPARSE_ENABLE_PROJECTS OR "klu" IN_LIST SUITESPARSE_ENABLE_PROJECTS OR "umfpack" IN_LIST SUITESPARSE_ENABLE_PROJECTS OR "rbio" IN_LIST SUITESPARSE_ENABLE_PROJECTS - OR "spqr" IN_LIST SUITESPARSE_ENABLE_PROJECTS ) + OR "spqr" IN_LIST SUITESPARSE_ENABLE_PROJECTS + OR "spex" IN_LIST SUITESPARSE_ENABLE_PROJECTS ) if ( NOT "suitesparse_config" IN_LIST SUITESPARSE_ENABLE_PROJECTS ) message ( STATUS "Adding \"suitesparse_config\" to the list of built targets." ) list ( APPEND SUITESPARSE_ENABLE_PROJECTS "suitesparse_config" ) @@ -269,6 +273,14 @@ if ( "spqr" IN_LIST SUITESPARSE_ENABLE_PROJECTS ) endif ( ) endif ( ) +if ( "spex" IN_LIST SUITESPARSE_ENABLE_PROJECTS ) + add_subdirectory ( "SPEX" ) + add_library ( SuiteSparse::SPEX ALIAS SPEX ) + if ( NOT NSTATIC ) + add_library ( SuiteSparse::SPEX_static ALIAS SPEX_static ) + endif ( ) +endif ( ) + if ( "graphblas" IN_LIST SUITESPARSE_ENABLE_PROJECTS ) add_subdirectory ( "GraphBLAS" ) add_library ( SuiteSparse::GraphBLAS ALIAS GraphBLAS ) diff --git a/SPEX/CMakeLists.txt b/SPEX/CMakeLists.txt index a3fbb270c..116c63556 100644 --- a/SPEX/CMakeLists.txt +++ b/SPEX/CMakeLists.txt @@ -2,7 +2,7 @@ # SuiteSparse/SPEX/CMakeLists.txt: cmake for SPEX #------------------------------------------------------------------------------- -# Copyright (c) 1996-2022, Timothy A. Davis, Patrick Amestoy, Iain Duff. +# Copyright (c) 1996-2023, Timothy A. Davis, Patrick Amestoy, Iain Duff. # All Rights Reserved. # SPDX-License-Identifier: BSD-3-clause @@ -13,25 +13,15 @@ cmake_minimum_required ( VERSION 3.20 ) set ( SPEX_DATE "Sept 18, 2023" ) -set ( SPEX_VERSION_MAJOR 2 ) -set ( SPEX_VERSION_MINOR 2 ) -set ( SPEX_VERSION_SUB 1 ) +set ( SPEX_VERSION_MAJOR 2 CACHE STRING "" FORCE ) +set ( SPEX_VERSION_MINOR 2 CACHE STRING "" FORCE ) +set ( SPEX_VERSION_SUB 1 CACHE STRING "" FORCE ) message ( STATUS "Building SPEX version: v" ${SPEX_VERSION_MAJOR}. ${SPEX_VERSION_MINOR}. ${SPEX_VERSION_SUB} " (" ${SPEX_DATE} ")" ) -#------------------------------------------------------------------------------- -# SuiteSparse policies -#------------------------------------------------------------------------------- - -set ( CMAKE_MODULE_PATH ${CMAKE_MODULE_PATH} - ${CMAKE_SOURCE_DIR}/cmake_modules - ${CMAKE_SOURCE_DIR}/../SuiteSparse_config/cmake_modules ) - -include ( SuiteSparsePolicy ) - #------------------------------------------------------------------------------- # define the project #------------------------------------------------------------------------------- @@ -40,26 +30,38 @@ project ( spex VERSION "${SPEX_VERSION_MAJOR}.${SPEX_VERSION_MINOR}.${SPEX_VERSION_SUB}" LANGUAGES C ) +#------------------------------------------------------------------------------- +# SuiteSparse policies +#------------------------------------------------------------------------------- + +set ( CMAKE_MODULE_PATH ${CMAKE_MODULE_PATH} + ${PROJECT_SOURCE_DIR}/cmake_modules + ${PROJECT_SOURCE_DIR}/../SuiteSparse_config/cmake_modules ) + +include ( SuiteSparsePolicy ) + #------------------------------------------------------------------------------- # find library dependencies #------------------------------------------------------------------------------- -find_package ( SuiteSparse_config 7.2.0 - PATHS ${CMAKE_SOURCE_DIR}/../SuiteSparse_config/build NO_DEFAULT_PATH ) -if ( NOT TARGET SuiteSparse::SuiteSparseConfig ) - find_package ( SuiteSparse_config 7.2.0 REQUIRED ) -endif ( ) +if ( NOT SUITESPARSE_ROOT_CMAKELISTS ) + find_package ( SuiteSparse_config 7.2.0 + PATHS ${CMAKE_SOURCE_DIR}/../SuiteSparse_config/build NO_DEFAULT_PATH ) + if ( NOT TARGET SuiteSparse::SuiteSparseConfig ) + find_package ( SuiteSparse_config 7.2.0 REQUIRED ) + endif ( ) -find_package ( COLAMD 3.2.0 - PATHS ${CMAKE_SOURCE_DIR}/../COLAMD/build NO_DEFAULT_PATH ) -if ( NOT TARGET SuiteSparse::COLAMD ) - find_package ( COLAMD 3.2.0 REQUIRED ) -endif ( ) + find_package ( AMD 3.2.0 + PATHS ${CMAKE_SOURCE_DIR}/../AMD/build NO_DEFAULT_PATH ) + if ( NOT TARGET SuiteSparse::AMD ) + find_package ( AMD 3.2.0 REQUIRED ) + endif ( ) -find_package ( AMD 3.2.0 - PATHS ${CMAKE_SOURCE_DIR}/../AMD/build NO_DEFAULT_PATH ) -if ( NOT TARGET SuiteSparse::AMD ) - find_package ( AMD 3.2.0 REQUIRED ) + find_package ( COLAMD 3.2.0 + PATHS ${CMAKE_SOURCE_DIR}/../COLAMD/build NO_DEFAULT_PATH ) + if ( NOT TARGET SuiteSparse::COLAMD ) + find_package ( COLAMD 3.2.0 REQUIRED ) + endif ( ) endif ( ) find_package ( GMP 6.1.2 REQUIRED ) # from SPEX/cmake_modules @@ -337,5 +339,6 @@ endif ( ) # report status #------------------------------------------------------------------------------- -include ( SuiteSparseReport ) - +if ( NOT SUITESPARSE_ROOT_CMAKELISTS ) + include ( SuiteSparseReport ) +endif ( ) From 87cb18a55416d0706c8be0fbb464bc4a7c1d3c46 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Markus=20M=C3=BCtzel?= Date: Mon, 30 Oct 2023 18:46:30 +0100 Subject: [PATCH 16/24] Add ParU to the root CMakeLists.txt --- CMakeLists.txt | 21 ++++++++++++++-- ParU/CMakeLists.txt | 59 ++++++++++++++++++++++++--------------------- 2 files changed, 50 insertions(+), 30 deletions(-) diff --git a/CMakeLists.txt b/CMakeLists.txt index e3905ae2d..c02a1eaad 100644 --- a/CMakeLists.txt +++ b/CMakeLists.txt @@ -29,7 +29,7 @@ include ( SuiteSparsePolicy ) # lower-case list of all projects that can be built by this root CMake file set ( SUITESPARSE_ALL_PROJECTS - "suitesparse_config;mongoose;amd;btf;camd;ccolamd;colamd;cholmod;cxsparse;ldl;klu;umfpack;rbio;spqr;spex;graphblas" ) + "suitesparse_config;mongoose;amd;btf;camd;ccolamd;colamd;cholmod;cxsparse;ldl;klu;umfpack;paru;rbio;spqr;spex;graphblas" ) # lower-case list of extra projects that can be built by this root CMake file set ( SUITESPARSE_EXTRA_PROJECTS @@ -92,10 +92,18 @@ if ( "klu" IN_LIST SUITESPARSE_ENABLE_PROJECTS ) endif ( ) endif ( ) +if ( "paru" IN_LIST SUITESPARSE_ENABLE_PROJECTS ) + if ( NOT "cholmod" IN_LIST SUITESPARSE_ENABLE_PROJECTS ) + message ( STATUS "Adding \"cholmod\" to the list of built targets." ) + list ( APPEND SUITESPARSE_ENABLE_PROJECTS "cholmod" ) + endif ( ) +endif ( ) + if ( ( NOT NCHOLMOD AND ( "klu" IN_LIST SUITESPARSE_ENABLE_PROJECTS OR "umfpack" IN_LIST SUITESPARSE_ENABLE_PROJECTS ) ) - OR "spqr" IN_LIST SUITESPARSE_ENABLE_PROJECTS ) + OR "spqr" IN_LIST SUITESPARSE_ENABLE_PROJECTS + OR "paru" IN_LIST SUITESPARSE_ENABLE_PROJECTS ) if ( NOT "cholmod" IN_LIST SUITESPARSE_ENABLE_PROJECTS ) message ( STATUS "Adding \"cholmod\" to the list of built targets." ) list ( APPEND SUITESPARSE_ENABLE_PROJECTS "cholmod" ) @@ -142,6 +150,7 @@ if ( "mongoose" IN_LIST SUITESPARSE_ENABLE_PROJECTS OR "ldl" IN_LIST SUITESPARSE_ENABLE_PROJECTS OR "klu" IN_LIST SUITESPARSE_ENABLE_PROJECTS OR "umfpack" IN_LIST SUITESPARSE_ENABLE_PROJECTS + OR "paru" IN_LIST SUITESPARSE_ENABLE_PROJECTS OR "rbio" IN_LIST SUITESPARSE_ENABLE_PROJECTS OR "spqr" IN_LIST SUITESPARSE_ENABLE_PROJECTS OR "spex" IN_LIST SUITESPARSE_ENABLE_PROJECTS ) @@ -257,6 +266,14 @@ if ( "umfpack" IN_LIST SUITESPARSE_ENABLE_PROJECTS ) endif ( ) endif ( ) +if ( "paru" IN_LIST SUITESPARSE_ENABLE_PROJECTS ) + add_subdirectory ( "ParU" ) + add_library ( SuiteSparse::ParU ALIAS ParU ) + if ( NOT NSTATIC ) + add_library ( SuiteSparse::ParU_static ALIAS ParU_static ) + endif ( ) +endif ( ) + if ( "rbio" IN_LIST SUITESPARSE_ENABLE_PROJECTS ) add_subdirectory ( "RBio" ) add_library ( SuiteSparse::RBio ALIAS RBio ) diff --git a/ParU/CMakeLists.txt b/ParU/CMakeLists.txt index 2d634672b..440e7e1b7 100644 --- a/ParU/CMakeLists.txt +++ b/ParU/CMakeLists.txt @@ -14,32 +14,32 @@ cmake_minimum_required ( VERSION 3.22 ) set ( PARU_DATE "Dec 20, 2022" ) # FIXME: pick a date -set ( PARU_VERSION_MAJOR 1 ) -set ( PARU_VERSION_MINOR 0 ) -set ( PARU_VERSION_UPDATE 0 ) +set ( PARU_VERSION_MAJOR 1 CACHE STRING "" FORCE ) +set ( PARU_VERSION_MINOR 0 CACHE STRING "" FORCE ) +set ( PARU_VERSION_UPDATE 0 CACHE STRING "" FORCE ) message ( STATUS "Building PARU version: v" ${PARU_VERSION_MAJOR}. ${PARU_VERSION_MINOR}. ${PARU_VERSION_UPDATE} " (" ${PARU_DATE} ")" ) +#------------------------------------------------------------------------------- +# define the project +#------------------------------------------------------------------------------- + +project ( paru + VERSION "${PARU_VERSION_MAJOR}.${PARU_VERSION_MINOR}.${PARU_VERSION_UPDATE}" ) + #------------------------------------------------------------------------------- # SuiteSparse policies #------------------------------------------------------------------------------- set ( CMAKE_MODULE_PATH ${CMAKE_MODULE_PATH} - ${CMAKE_SOURCE_DIR}/../SuiteSparse_config/cmake_modules + ${PROJECT_SOURCE_DIR}/../SuiteSparse_config/cmake_modules ) include ( SuiteSparsePolicy ) -#------------------------------------------------------------------------------- -# define the project -#------------------------------------------------------------------------------- - -project ( paru - VERSION "${PARU_VERSION_MAJOR}.${PARU_VERSION_MINOR}.${PARU_VERSION_UPDATE}" ) - #------------------------------------------------------------------------------- # find library dependencies #------------------------------------------------------------------------------- @@ -70,22 +70,24 @@ else ( ) endif ( ) endif ( ) -find_package ( SuiteSparse_config 7.3.0 - PATHS ${CMAKE_SOURCE_DIR}/../SuiteSparse_config/build NO_DEFAULT_PATH ) -if ( NOT TARGET SuiteSparse::SuiteSparseConfig ) - find_package ( SuiteSparse_config 7.3.0 REQUIRED ) -endif ( ) +if ( NOT SUITESPARSE_ROOT_CMAKELISTS ) + find_package ( SuiteSparse_config 7.3.0 + PATHS ${CMAKE_SOURCE_DIR}/../SuiteSparse_config/build NO_DEFAULT_PATH ) + if ( NOT TARGET SuiteSparse::SuiteSparseConfig ) + find_package ( SuiteSparse_config 7.3.0 REQUIRED ) + endif ( ) -find_package ( CHOLMOD 5.0.0 - PATHS ${CMAKE_SOURCE_DIR}/../CHOLMOD/build NO_DEFAULT_PATH ) -if ( NOT CHOLMOD_FOUND ) - find_package ( CHOLMOD 5.0.0 REQUIRED ) -endif ( ) + find_package ( CHOLMOD 5.0.0 + PATHS ${CMAKE_SOURCE_DIR}/../CHOLMOD/build NO_DEFAULT_PATH ) + if ( NOT CHOLMOD_FOUND ) + find_package ( CHOLMOD 5.0.0 REQUIRED ) + endif ( ) -find_package ( UMFPACK 6.2.2 - PATHS ${CMAKE_SOURCE_DIR}/../UMFPACK/build NO_DEFAULT_PATH ) -if ( NOT CAMD_FOUND ) - find_package ( UMFPACK 6.2.2 REQUIRED ) + find_package ( UMFPACK 6.2.2 + PATHS ${CMAKE_SOURCE_DIR}/../UMFPACK/build NO_DEFAULT_PATH ) + if ( NOT CAMD_FOUND ) + find_package ( UMFPACK 6.2.2 REQUIRED ) + endif ( ) endif ( ) include ( SuiteSparseBLAS ) # requires cmake 3.22 @@ -109,7 +111,7 @@ configure_file ( "Config/paru_version.tex.in" # That means the two libraries are interdependent and ParU cannot be # built as a stand-alone project outside a common build tree. include_directories ( Source Include - ${CMAKE_SOURCE_DIR}/../UMFPACK/Source + ${PROJECT_SOURCE_DIR}/../UMFPACK/Source ) #------------------------------------------------------------------------------- @@ -381,5 +383,6 @@ endif ( ) # report status #------------------------------------------------------------------------------- -include ( SuiteSparseReport ) - +if ( NOT SUITESPARSE_ROOT_CMAKELISTS ) + include ( SuiteSparseReport ) +endif ( ) From 689e4015f1fee134e7a0eb5b0bc65b8ae2f77a99 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Markus=20M=C3=BCtzel?= Date: Fri, 3 Nov 2023 15:28:55 +0100 Subject: [PATCH 17/24] Add LAGraph to the root CMakeLists.txt --- CMakeLists.txt | 17 ++- LAGraph/CMakeLists.txt | 114 ++++++++++-------- LAGraph/cmake_modules/CodeCoverage.cmake | 2 +- LAGraph/cmake_modules/FindGraphBLAS.cmake | 20 +-- LAGraph/experimental/CMakeLists.txt | 8 +- LAGraph/experimental/benchmark/CMakeLists.txt | 6 +- LAGraph/experimental/test/CMakeLists.txt | 6 +- LAGraph/src/CMakeLists.txt | 4 +- LAGraph/src/benchmark/CMakeLists.txt | 4 +- LAGraph/src/test/CMakeLists.txt | 4 +- 10 files changed, 110 insertions(+), 75 deletions(-) diff --git a/CMakeLists.txt b/CMakeLists.txt index c02a1eaad..15cadd44b 100644 --- a/CMakeLists.txt +++ b/CMakeLists.txt @@ -29,7 +29,7 @@ include ( SuiteSparsePolicy ) # lower-case list of all projects that can be built by this root CMake file set ( SUITESPARSE_ALL_PROJECTS - "suitesparse_config;mongoose;amd;btf;camd;ccolamd;colamd;cholmod;cxsparse;ldl;klu;umfpack;paru;rbio;spqr;spex;graphblas" ) + "suitesparse_config;mongoose;amd;btf;camd;ccolamd;colamd;cholmod;cxsparse;ldl;klu;umfpack;paru;rbio;spqr;spex;graphblas;lagraph" ) # lower-case list of extra projects that can be built by this root CMake file set ( SUITESPARSE_EXTRA_PROJECTS @@ -85,6 +85,13 @@ include ( SuiteSparsePolicy ) # check/add project dependencies #------------------------------------------------------------------------------- +if ( "lagraph" IN_LIST SUITESPARSE_ENABLE_PROJECTS ) + if ( NOT "graphblas" IN_LIST SUITESPARSE_ENABLE_PROJECTS ) + message ( STATUS "Adding \"graphblas\" to the list of built targets." ) + list ( APPEND SUITESPARSE_ENABLE_PROJECTS "graphblas" ) + endif ( ) +endif ( ) + if ( "klu" IN_LIST SUITESPARSE_ENABLE_PROJECTS ) if ( NOT "btf" IN_LIST SUITESPARSE_ENABLE_PROJECTS ) message ( STATUS "Adding \"btf\" to the list of built targets." ) @@ -306,6 +313,14 @@ if ( "graphblas" IN_LIST SUITESPARSE_ENABLE_PROJECTS ) endif ( ) endif ( ) +if ( "lagraph" IN_LIST SUITESPARSE_ENABLE_PROJECTS ) + add_subdirectory ( "LAGraph" ) + add_library ( SuiteSparse::LAGraph ALIAS LAGraph ) + if ( NOT NSTATIC ) + add_library ( SuiteSparse::LAGraph_static ALIAS LAGraph_static ) + endif ( ) +endif ( ) + #------------------------------------------------------------------------------- # report status #------------------------------------------------------------------------------- diff --git a/LAGraph/CMakeLists.txt b/LAGraph/CMakeLists.txt index f78150721..57623580b 100644 --- a/LAGraph/CMakeLists.txt +++ b/LAGraph/CMakeLists.txt @@ -38,27 +38,35 @@ cmake_minimum_required ( VERSION 3.13 ) -set ( CMAKE_MODULE_PATH ${CMAKE_MODULE_PATH} - ${CMAKE_SOURCE_DIR}/cmake_modules - ${CMAKE_SOURCE_DIR}/../cmake_modules - ${CMAKE_SOURCE_DIR}/../SuiteSparse_config/cmake_modules - ) - cmake_policy ( SET CMP0042 NEW ) cmake_policy ( SET CMP0048 NEW ) set ( CMAKE_MACOSX_RPATH TRUE ) # version of LAGraph set ( LAGraph_DATE "Aug 2, 2023" ) -set ( LAGraph_VERSION_MAJOR 1 ) -set ( LAGraph_VERSION_MINOR 0 ) -set ( LAGraph_VERSION_SUB 2 ) +set ( LAGraph_VERSION_MAJOR 1 CACHE STRING "" FORCE ) +set ( LAGraph_VERSION_MINOR 0 CACHE STRING "" FORCE ) +set ( LAGraph_VERSION_SUB 2 CACHE STRING "" FORCE ) -include ( SuiteSparsePolicy ) +#------------------------------------------------------------------------------- +# define the project +#------------------------------------------------------------------------------- project ( lagraph VERSION "${LAGraph_VERSION_MAJOR}.${LAGraph_VERSION_MINOR}.${LAGraph_VERSION_SUB}" ) +#------------------------------------------------------------------------------- +# SuiteSparse policies +#------------------------------------------------------------------------------- + +set ( CMAKE_MODULE_PATH ${CMAKE_MODULE_PATH} + ${PROJECT_SOURCE_DIR}/cmake_modules + ${PROJECT_SOURCE_DIR}/../cmake_modules + ${PROJECT_SOURCE_DIR}/../SuiteSparse_config/cmake_modules + ) + +include ( SuiteSparsePolicy ) + enable_language ( C ) option ( NOPENMP "ON: do not use OpenMP. OFF (default): use OpenMP" OFF ) @@ -80,29 +88,28 @@ configure_file ( # make test_coverage if ( "${CMAKE_C_COMPILER_ID}" STREQUAL "GNU") - if ( COVERAGE ) - message ( STATUS "============== Code coverage enabled ===============" ) - set ( CMAKE_BUILD_TYPE Debug ) - # On the Mac, you need gcov-11 from homebrew (part of gcc-11): - # and uncomment this line: - # set ( GCOV_PATH /usr/local/bin/gcov-11) - include ( CodeCoverage ) - - append_coverage_compiler_flags ( ) - - # turn off optimization for non-skewed coverage reports - set ( CMAKE_C_FLAGS "${CMAKE_C_FLAGS} -O0 -DCOVERAGE" ) - - setup_target_for_coverage_lcov ( - NAME test_coverage - EXECUTABLE ctest - DEPENDENCIES ${PROJECT_NAME} - BASE_DIRECTORY "." - NO_DEMANGLE TRUE - EXCLUDE "*/benchmark/*" "deps/json*/*" - "src/test/include/acutest.h" - ) - endif ( ) + if ( COVERAGE ) + message ( STATUS "============== Code coverage enabled ===============" ) + set ( CMAKE_BUILD_TYPE Debug ) + # On the Mac, you need gcov-11 from homebrew (part of gcc-11): + # and uncomment this line: + # set ( GCOV_PATH /usr/local/bin/gcov-11) + include ( CodeCoverage ) + + append_coverage_compiler_flags ( ) + + # turn off optimization for non-skewed coverage reports + set ( CMAKE_C_FLAGS "${CMAKE_C_FLAGS} -O0 -DCOVERAGE" ) + + setup_target_for_coverage_lcov ( + NAME test_coverage + EXECUTABLE ctest + DEPENDENCIES ${PROJECT_NAME} + BASE_DIRECTORY "." + NO_DEMANGLE TRUE + EXCLUDE "*/benchmark/*" "deps/json*/*" "src/test/include/acutest.h" + ) + endif ( ) endif ( ) # For development only, not for end-users: @@ -116,15 +123,28 @@ endif ( ) # Find the GraphBLAS installation #------------------------------------------------------------------------------- -# If GraphBLAS is not in a standard installation location, either -# export GRAPHBLAS_ROOT -# or -# GRAPHBLAS_ROOT= cmake .. -# or uncomment the next line: -# set ( ENV{GRAPHBLAS_ROOT} ${CMAKE_SOURCE_DIR}/../GraphBLAS ) -message ( STATUS "GraphBLAS_ROOT: ${GraphBLAS_ROOT} $ENV{GraphBLAS_ROOT}" ) -message ( STATUS "GRAPHBLAS_ROOT: ${GRAPHBLAS_ROOT} $ENV{GRAPHBLAS_ROOT}" ) -find_package ( GraphBLAS 8.2.1 MODULE REQUIRED ) +if ( SUITESPARSE_ROOT_CMAKELISTS ) + + add_library ( GraphBLAS::GraphBLAS ALIAS GraphBLAS ) + if ( TARGET GraphBLAS_static ) + add_library ( GraphBLAS::GraphBLAS_static ALIAS GraphBLAS_static ) + endif ( ) + +else ( ) + + # If GraphBLAS is not in a standard installation location, either + # export GRAPHBLAS_ROOT + # or + # GRAPHBLAS_ROOT= cmake .. + # or uncomment the next line: + # set ( ENV{GRAPHBLAS_ROOT} ${PROJECT_SOURCE_DIR}/../GraphBLAS ) + + message ( STATUS "GraphBLAS_ROOT: ${GraphBLAS_ROOT} $ENV{GraphBLAS_ROOT}" ) + message ( STATUS "GRAPHBLAS_ROOT: ${GRAPHBLAS_ROOT} $ENV{GRAPHBLAS_ROOT}" ) + + find_package ( GraphBLAS 8.2.1 MODULE REQUIRED ) + +endif ( ) #------------------------------------------------------------------------------- # determine what user threading model to use @@ -149,7 +169,7 @@ endif ( ) #------------------------------------------------------------------------------- message ( STATUS "CMAKE build type: " ${CMAKE_BUILD_TYPE} ) -message ( STATUS "CMAKE source directory: " ${CMAKE_SOURCE_DIR} ) +message ( STATUS "CMAKE source directory: " ${PROJECT_SOURCE_DIR} ) message ( STATUS "CMAKE build directory: " ${CMAKE_BINARY_DIR} ) if ( ${CMAKE_BUILD_TYPE} STREQUAL "Debug") @@ -168,13 +188,13 @@ message ( STATUS "CMAKE have OpenMP: " ${OPENMP_C_FOUND} ) # include directories for LAGraph library #------------------------------------------------------------------------------- -include_directories ( ${CMAKE_SOURCE_DIR}/include - ${CMAKE_SOURCE_DIR}/src/utility - ${CMAKE_SOURCE_DIR}/test/include ) +include_directories ( ${PROJECT_SOURCE_DIR}/include + ${PROJECT_SOURCE_DIR}/src/utility + ${PROJECT_SOURCE_DIR}/test/include ) include_directories ( "/usr/local/include" ) # tell LAGraph where to find its own source (for LAGraph/data files) -set ( CMAKE_C_FLAGS "${CMAKE_C_FLAGS} -DLGDIR=${CMAKE_SOURCE_DIR}" ) +set ( CMAKE_C_FLAGS "${CMAKE_C_FLAGS} -DLGDIR=${PROJECT_SOURCE_DIR}" ) # set ( CMAKE_C_FLAGS "${CMAKE_C_FLAGS} -g -O" ) #------------------------------------------------------------------------------- diff --git a/LAGraph/cmake_modules/CodeCoverage.cmake b/LAGraph/cmake_modules/CodeCoverage.cmake index a0ebde117..2d5fcfb44 100644 --- a/LAGraph/cmake_modules/CodeCoverage.cmake +++ b/LAGraph/cmake_modules/CodeCoverage.cmake @@ -134,7 +134,7 @@ find_program( GCOV_PATH gcov ) find_program( LCOV_PATH NAMES lcov lcov.bat lcov.exe lcov.perl) find_program( FASTCOV_PATH NAMES fastcov fastcov.py ) find_program( GENHTML_PATH NAMES genhtml genhtml.perl genhtml.bat ) -find_program( GCOVR_PATH gcovr PATHS ${CMAKE_SOURCE_DIR}/scripts/test) +find_program( GCOVR_PATH gcovr PATHS ${PROJECT_SOURCE_DIR}/scripts/test) find_program( CPPFILT_PATH NAMES c++filt ) execute_process( diff --git a/LAGraph/cmake_modules/FindGraphBLAS.cmake b/LAGraph/cmake_modules/FindGraphBLAS.cmake index fea0381ff..1f78f2fe8 100644 --- a/LAGraph/cmake_modules/FindGraphBLAS.cmake +++ b/LAGraph/cmake_modules/FindGraphBLAS.cmake @@ -65,7 +65,7 @@ in your CMakeLists.txt file. See also SuiteSparse/Example/CMakeLists.txt: ## New versions of SuiteSparse GraphBLAS (8.0.3 and newer) ## find_package ( GraphBLAS ${GraphBLAS_FIND_VERSION} CONFIG - PATHS ${CMAKE_SOURCE_DIR}/../GraphBLAS/build NO_DEFAULT_PATH ) + PATHS ${PROJECT_SOURCE_DIR}/../GraphBLAS/build NO_DEFAULT_PATH ) if ( NOT TARGET SuiteSparse::GraphBLAS ) find_package ( GraphBLAS ${GraphBLAS_FIND_VERSION} CONFIG ) endif ( ) @@ -88,9 +88,9 @@ find_path ( GRAPHBLAS_INCLUDE_DIR NAMES GraphBLAS.h HINTS ${GRAPHBLAS_ROOT} HINTS ENV GRAPHBLAS_ROOT - HINTS ${CMAKE_SOURCE_DIR}/.. - HINTS ${CMAKE_SOURCE_DIR}/../GraphBLAS - HINTS ${CMAKE_SOURCE_DIR}/../SuiteSparse/GraphBLAS + HINTS ${PROJECT_SOURCE_DIR}/.. + HINTS ${PROJECT_SOURCE_DIR}/../GraphBLAS + HINTS ${PROJECT_SOURCE_DIR}/../SuiteSparse/GraphBLAS PATH_SUFFIXES include Include ) @@ -99,9 +99,9 @@ find_library ( GRAPHBLAS_LIBRARY NAMES graphblas HINTS ${GRAPHBLAS_ROOT} HINTS ENV GRAPHBLAS_ROOT - HINTS ${CMAKE_SOURCE_DIR}/.. - HINTS ${CMAKE_SOURCE_DIR}/../GraphBLAS - HINTS ${CMAKE_SOURCE_DIR}/../SuiteSparse/GraphBLAS + HINTS ${PROJECT_SOURCE_DIR}/.. + HINTS ${PROJECT_SOURCE_DIR}/../GraphBLAS + HINTS ${PROJECT_SOURCE_DIR}/../SuiteSparse/GraphBLAS PATH_SUFFIXES lib build alternative ) @@ -120,9 +120,9 @@ find_library ( GRAPHBLAS_STATIC NAMES ${STATIC_NAME} HINTS ${GRAPHBLAS_ROOT} HINTS ENV GRAPHBLAS_ROOT - HINTS ${CMAKE_SOURCE_DIR}/.. - HINTS ${CMAKE_SOURCE_DIR}/../GraphBLAS - HINTS ${CMAKE_SOURCE_DIR}/../SuiteSparse/GraphBLAS + HINTS ${PROJECT_SOURCE_DIR}/.. + HINTS ${PROJECT_SOURCE_DIR}/../GraphBLAS + HINTS ${PROJECT_SOURCE_DIR}/../SuiteSparse/GraphBLAS PATH_SUFFIXES lib build alternative ) set ( CMAKE_FIND_LIBRARY_SUFFIXES ${save} ) diff --git a/LAGraph/experimental/CMakeLists.txt b/LAGraph/experimental/CMakeLists.txt index d62cbc946..5b9cd042e 100644 --- a/LAGraph/experimental/CMakeLists.txt +++ b/LAGraph/experimental/CMakeLists.txt @@ -14,8 +14,8 @@ #------------------------------------------------------------------------------- include_directories ( - ${CMAKE_SOURCE_DIR}/src/utility - ${CMAKE_SOURCE_DIR}/deps/json_h ) + ${PROJECT_SOURCE_DIR}/src/utility + ${PROJECT_SOURCE_DIR}/deps/json_h ) file ( GLOB LAGRAPHX_LIB_SOURCES "utility/*.c" "algorithm/*.c" ) @@ -35,7 +35,7 @@ SET_TARGET_PROPERTIES ( LAGraphX PROPERTIES target_link_libraries ( LAGraphX PRIVATE LAGraph GraphBLAS::GraphBLAS ) target_include_directories ( LAGraphX PUBLIC - $ + $ $ ) target_compile_definitions ( LAGraphX PRIVATE LGX_LIBRARY ) @@ -67,7 +67,7 @@ if ( NOT NSTATIC ) endif ( ) target_include_directories ( LAGraphX_static PUBLIC - $ + $ $ ) endif ( ) diff --git a/LAGraph/experimental/benchmark/CMakeLists.txt b/LAGraph/experimental/benchmark/CMakeLists.txt index 049ca5fb2..cf4385ab5 100644 --- a/LAGraph/experimental/benchmark/CMakeLists.txt +++ b/LAGraph/experimental/benchmark/CMakeLists.txt @@ -13,9 +13,9 @@ #------------------------------------------------------------------------------- -include_directories ( ${CMAKE_SOURCE_DIR}/src/test/include - ${CMAKE_SOURCE_DIR}/src/benchmark - ${CMAKE_SOURCE_DIR}/experimental/test/include ) +include_directories ( ${PROJECT_SOURCE_DIR}/src/test/include + ${PROJECT_SOURCE_DIR}/src/benchmark + ${PROJECT_SOURCE_DIR}/experimental/test/include ) file( GLOB DEMO_SOURCES LIST_DIRECTORIES false *_demo.c ) foreach( demosourcefile ${DEMO_SOURCES} ) diff --git a/LAGraph/experimental/test/CMakeLists.txt b/LAGraph/experimental/test/CMakeLists.txt index 79f3e8e4d..13e059b41 100644 --- a/LAGraph/experimental/test/CMakeLists.txt +++ b/LAGraph/experimental/test/CMakeLists.txt @@ -17,9 +17,9 @@ # build the lagraphxtest library #------------------------------------------------------------------------------- -include_directories ( ${CMAKE_SOURCE_DIR}/src/test/include - ${CMAKE_SOURCE_DIR}/src/test/include - ${CMAKE_SOURCE_DIR}/experimental/test/include ) +include_directories ( ${PROJECT_SOURCE_DIR}/src/test/include + ${PROJECT_SOURCE_DIR}/src/test/include + ${PROJECT_SOURCE_DIR}/experimental/test/include ) file ( GLOB LAGRAPHXTEST_LIB_SOURCES "LG_*.c" ) diff --git a/LAGraph/src/CMakeLists.txt b/LAGraph/src/CMakeLists.txt index a1ed5f13b..ee1fa8c54 100644 --- a/LAGraph/src/CMakeLists.txt +++ b/LAGraph/src/CMakeLists.txt @@ -39,7 +39,7 @@ SET_TARGET_PROPERTIES ( LAGraph PROPERTIES target_link_libraries ( LAGraph PRIVATE GraphBLAS::GraphBLAS ${M_LIB} ) target_include_directories ( LAGraph PUBLIC - $ + $ $ ) target_compile_definitions ( LAGraph PRIVATE LG_LIBRARY ) @@ -73,7 +73,7 @@ if ( NOT NSTATIC ) target_link_libraries ( LAGraph_static PUBLIC ${M_LIB} ) target_include_directories ( LAGraph_static PUBLIC - $ + $ $ ) endif ( ) diff --git a/LAGraph/src/benchmark/CMakeLists.txt b/LAGraph/src/benchmark/CMakeLists.txt index d1f989df2..df97dd046 100644 --- a/LAGraph/src/benchmark/CMakeLists.txt +++ b/LAGraph/src/benchmark/CMakeLists.txt @@ -13,8 +13,8 @@ #------------------------------------------------------------------------------- -include_directories ( ${CMAKE_SOURCE_DIR}/src/test/include - ${CMAKE_SOURCE_DIR}/src/algorithm ) +include_directories ( ${PROJECT_SOURCE_DIR}/src/test/include + ${PROJECT_SOURCE_DIR}/src/algorithm ) file( GLOB DEMO_SOURCES LIST_DIRECTORIES false *_demo.c ) foreach( demosourcefile ${DEMO_SOURCES} ) diff --git a/LAGraph/src/test/CMakeLists.txt b/LAGraph/src/test/CMakeLists.txt index d30ead913..17707599a 100644 --- a/LAGraph/src/test/CMakeLists.txt +++ b/LAGraph/src/test/CMakeLists.txt @@ -20,8 +20,8 @@ # build the lagraphtest library #------------------------------------------------------------------------------- -include_directories ( ${CMAKE_SOURCE_DIR}/src/test/include - ${CMAKE_SOURCE_DIR}/src/algorithm ) +include_directories ( ${PROJECT_SOURCE_DIR}/src/test/include + ${PROJECT_SOURCE_DIR}/src/algorithm ) file ( GLOB LAGRAPHTEST_LIB_SOURCES "LG_*.c" ) From afa0e61e3261da55cfbae03752fed5cae630fcf7 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Markus=20M=C3=BCtzel?= Date: Mon, 18 Sep 2023 17:36:02 +0200 Subject: [PATCH 18/24] Adapt SuiteSparsePolicy.cmake and SuiteSparseReport.cmake for root CMakeLists --- .../cmake_modules/SuiteSparsePolicy.cmake | 50 ++++++++++--------- .../cmake_modules/SuiteSparseReport.cmake | 6 ++- 2 files changed, 31 insertions(+), 25 deletions(-) diff --git a/SuiteSparse_config/cmake_modules/SuiteSparsePolicy.cmake b/SuiteSparse_config/cmake_modules/SuiteSparsePolicy.cmake index 4bb59779c..a3323a9f9 100644 --- a/SuiteSparse_config/cmake_modules/SuiteSparsePolicy.cmake +++ b/SuiteSparse_config/cmake_modules/SuiteSparsePolicy.cmake @@ -24,6 +24,8 @@ # if false, "cmake --install" will install into the # default prefix (or the one configured with # CMAKE_INSTALL_PREFIX). Requires cmake 3.19. +# This is ignored when using the root CMakeLists.txt. +# Set CMAKE_INSTALL_PREFIX instead. # Default: false # # NSTATIC: if true, static libraries are not built. @@ -100,11 +102,11 @@ else ( ) endif ( ) # installation options -if ( ${CMAKE_VERSION} VERSION_GREATER_EQUAL "3.19.0" ) +if ( NOT SUITESPARSE_ROOT_CMAKELISTS AND ${CMAKE_VERSION} VERSION_GREATER_EQUAL "3.19.0" ) # the LOCAL_INSTALL option requires cmake 3.19.0 or later - option ( LOCAL_INSTALL "Install in SuiteSparse/lib" off ) + option ( LOCAL_INSTALL "Install in SuiteSparse/lib" OFF ) else ( ) - set ( LOCAL_INSTALL off ) + set ( LOCAL_INSTALL OFF ) endif ( ) if ( SUITESPARSE_SECOND_LEVEL ) @@ -121,30 +123,32 @@ endif ( ) # find this one without "make install" set ( CMAKE_BUILD_RPATH ${CMAKE_BUILD_RPATH} ${CMAKE_BINARY_DIR} ) -# determine if this Package is inside the SuiteSparse folder -set ( INSIDE_SUITESPARSE false ) -if ( LOCAL_INSTALL ) - # if you do not want to install local copies of SuiteSparse - # packages in SuiteSparse/lib and SuiteSparse/, set - # LOCAL_INSTALL to false in your CMake options. - if ( SUITESPARSE_SECOND_LEVEL ) - # the package is normally located at the 2nd level inside SuiteSparse - # (SuiteSparse/GraphBLAS/GraphBLAS/ for example) - if ( EXISTS ${CMAKE_SOURCE_DIR}/../../SuiteSparse_config ) - set ( INSIDE_SUITESPARSE true ) +if ( NOT SUITESPARSE_ROOT_CMAKELISTS ) + # determine if this Package is inside the SuiteSparse folder + set ( INSIDE_SUITESPARSE false ) + if ( LOCAL_INSTALL ) + # if you do not want to install local copies of SuiteSparse + # packages in SuiteSparse/lib and SuiteSparse/, set + # LOCAL_INSTALL to false in your CMake options. + if ( SUITESPARSE_SECOND_LEVEL ) + # the package is normally located at the 2nd level inside SuiteSparse + # (SuiteSparse/GraphBLAS/GraphBLAS/ for example) + if ( EXISTS ${CMAKE_SOURCE_DIR}/../../SuiteSparse_config ) + set ( INSIDE_SUITESPARSE true ) + endif ( ) + else ( ) + # typical case, the package is at the 1st level inside SuiteSparse + # (SuiteSparse/AMD for example) + if ( EXISTS ${CMAKE_SOURCE_DIR}/../SuiteSparse_config ) + set ( INSIDE_SUITESPARSE true ) + endif ( ) endif ( ) - else ( ) - # typical case, the package is at the 1st level inside SuiteSparse - # (SuiteSparse/AMD for example) - if ( EXISTS ${CMAKE_SOURCE_DIR}/../SuiteSparse_config ) - set ( INSIDE_SUITESPARSE true ) + + if ( NOT INSIDE_SUITESPARSE ) + message ( FATAL_ERROR "Unsupported layout for local installation. Correct the directory layout or unset LOCAL_INSTALL." ) endif ( ) - endif ( ) - if ( NOT INSIDE_SUITESPARSE ) - message ( FATAL_ERROR "Unsupported layout for local installation. Correct the directory layout or unset LOCAL_INSTALL." ) endif ( ) - endif ( ) if ( LOCAL_INSTALL ) diff --git a/SuiteSparse_config/cmake_modules/SuiteSparseReport.cmake b/SuiteSparse_config/cmake_modules/SuiteSparseReport.cmake index 9271c4a92..c147b6e2b 100644 --- a/SuiteSparse_config/cmake_modules/SuiteSparseReport.cmake +++ b/SuiteSparse_config/cmake_modules/SuiteSparseReport.cmake @@ -12,8 +12,10 @@ message ( STATUS "------------------------------------------------------------------------" ) message ( STATUS "SuiteSparse CMAKE report for: ${CMAKE_PROJECT_NAME}" ) message ( STATUS "------------------------------------------------------------------------" ) -message ( STATUS "inside common SuiteSparse root: ${INSIDE_SUITESPARSE}" ) -message ( STATUS "install in SuiteSparse/lib and SuiteSparse/include: ${LOCAL_INSTALL}" ) +if ( NOT SUITESPARSE_ROOT_CMAKELISTS ) + message ( STATUS "inside common SuiteSparse root: ${INSIDE_SUITESPARSE}" ) + message ( STATUS "install in SuiteSparse/lib and SuiteSparse/include: ${LOCAL_INSTALL}" ) +endif ( ) message ( STATUS "build type: ${CMAKE_BUILD_TYPE}" ) if ( NSTATIC ) message ( STATUS "NSTATIC: true (do not build static library)" ) From a557aafd31a8fb69752fb655ebfd72d55df067b3 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Markus=20M=C3=BCtzel?= Date: Mon, 18 Sep 2023 18:11:16 +0200 Subject: [PATCH 19/24] README.md: Adapt build instructions for root CMakeLists.txt --- README.md | 253 +++++++++++++++++++++++++++++++++--------------------- 1 file changed, 154 insertions(+), 99 deletions(-) diff --git a/README.md b/README.md index 680d8321f..100d18338 100644 --- a/README.md +++ b/README.md @@ -262,9 +262,9 @@ To select your BLAS/LAPACK, see the instructions in SuiteSparseBLAS.cmake in `SuiteSparse_config.h` with the `SUITESPARSE_BLAS_INT` defined as `int64_t`. Otherwise, if a 32-bit BLAS is found, this type is defined as `int32_t`. If later on, UMFPACK, CHOLMOD, or SPQR are compiled and linked with a BLAS that -has a different integer size, you must override the definition with -DBLAS64 -(to assert the use of 64-bit integers in the BLAS) or -DBLAS32, (to assert the -use of 32-bit integers in the BLAS). +has a different integer size, you must override the definition with `-DBLAS64` +(to assert the use of 64-bit integers in the BLAS) or `-DBLAS32`, (to assert +the use of 32-bit integers in the BLAS). When distributed in a binary form (such as a Debian, Ubuntu, Spack, or Brew package), SuiteSparse should probably be compiled to expect a 32-bit BLAS, @@ -331,6 +331,8 @@ Packages in SuiteSparse, and files in this directory: author for all modules: Tim Davis CHOLMOD/Modify module authors: Tim Davis and William W. Hager + CMakeLists.txt optional, to compile all of SuiteSparse. See below. + COLAMD column approximate minimum degree ordering. This is the built-in COLAMD function in MATLAB. authors (of the code): Tim Davis and Stefan Larimore @@ -509,26 +511,26 @@ the top-level LICENSE.txt file. QUICK START FOR MATLAB USERS (Linux or Mac): ----------------------------------------------------------------------------- -Suppose you place SuiteSparse in the /home/me/SuiteSparse folder. +Suppose you place SuiteSparse in the `/home/me/SuiteSparse` folder. -Add the SuiteSparse/lib folder to your run-time library path. On Linux, add -this to your ~/.bashrc script, assuming /home/me/SuiteSparse is the location of -your copy of SuiteSparse: +Add the `SuiteSparse/lib` folder to your run-time library path. On Linux, add +this to your `~/.bashrc` script, assuming `/home/me/SuiteSparse` is the +location of your copy of SuiteSparse: LD_LIBRARY_PATH=$LD_LIBRARY_PATH:/home/me/SuiteSparse/lib export LD_LIBRARY_PATH -For the Mac, use this instead, in your ~/.zshrc script, assuming you place -SuiteSparse in /Users/me/SuiteSparse: +For the Mac, use this instead, in your `~/.zshrc` script, assuming you place +SuiteSparse in `/Users/me/SuiteSparse`: DYLD_LIBRARY_PATH=$DYLD_LIBRARY_PATH:/Users/me/SuiteSparse/lib export DYLD_LIBRARY_PATH -Compile all of SuiteSparse with "make local". +Compile all of SuiteSparse with `make local`. Next, compile the GraphBLAS MATLAB library. In the system shell while in the -SuiteSparse folder, type "make gbmatlab" if you want to install it system-wide -with "make install", or "make gblocal" if you want to use the library in +SuiteSparse folder, type `make gbmatlab` if you want to install it system-wide +with `make install`, or `make gblocal` if you want to use the library in your own SuiteSparse/lib. Then in the MATLAB Command Window, cd to the SuiteSparse directory and type @@ -545,24 +547,35 @@ set all your paths at the start of each MATLAB session. QUICK START FOR THE C/C++ LIBRARIES: ----------------------------------------------------------------------------- -For Linux and Mac: type the following in this directory (requires system -priviledge to do the `sudo make install`): +Type the following in this directory (requires system priviledge to do the +`sudo make install`): + + mkdir -p build && cd build + cmake .. + cmake --build . + sudo cmake --install . + +All libraries will be created and installed into the default system-wide folder +(/usr/local/lib on Linux). All include files needed by the applications that +use SuiteSparse are installed into /usr/local/include (on Linux). - make - sudo make install +To build only a subset of libraries, set `SUITESPARSE_ENABLE_PROJECTS` when +configuring with CMake. E.g., to build and install CHOLMOD and CXSparse +(including their dependencies), use the following commands: -All libraries will be created and copied into the default system-wide folder -(/usr/local/lib on Linux). All include files need by the applications that use -SuiteSparse are copied into /usr/local/include (on Linux). + mkdir -p build && cd build + cmake -DSUITESPARSE_ENABLE_PROJECTS="cholmod;cxsparse" .. + cmake --build . + sudo cmake --install . -For Windows, import each `*/CMakeLists.txt` file into MS Visual Studio. -A single top-level CMake script is being considered as a feature in the -future. Be sure to specify the build type as Release; for example, to -build `SuiteSparse_config` on Windows in the command window: +For Windows (MSVC), import the `CMakeLists.txt` file into MS Visual Studio. +Be sure to specify the build type as Release; for example, to build SuiteSparse +on Windows in the command window, run: - cd SuiteSparse_config/build + mkdir -p build && cd build cmake .. - cmke --build . --config Release + cmake --build . --config Release + cmake --install . Be sure to first install all required libraries: BLAS and LAPACK for UMFPACK, CHOLMOD, and SPQR, and GMP and MPFR for SPEX. Be sure to use the latest @@ -573,7 +586,10 @@ see the SPEX user guide for details). To compile the libraries and install them only in SuiteSparse/lib (not /usr/local/lib), do this instead in the top-level of SuiteSparse: - make local + mkdir -p build && cd build + cmake -DCMAKE_INSTALL_PREFIX=.. .. + cmake --build . + cmake --install . If you add /home/me/SuiteSparse/lib to your library search path (`LD_LIBRARY_PATH` in Linux), you can do the following (for example): @@ -583,10 +599,9 @@ If you add /home/me/SuiteSparse/lib to your library search path To change the C and C++ compilers, and to compile in parallel use: - CC=gcc CX=g++ JOBS=32 make + cmake -DCMAKE_C_COMPILER=gcc -DCMAKE_CXX_COMPILER==g++ .. -for example, which changes the compiler to gcc and g++, and runs make with -'make -j32', in parallel with 32 jobs. +for example, which changes the compiler to gcc and g++. This will work on Linux/Unix and the Mac. It should automatically detect if you have the Intel compilers or not, and whether or not you have CUDA. @@ -629,83 +644,123 @@ Compilation options You can set specific options for CMake with the command (for example): - CMAKE_OPTIONS="-DNPARTITION=1 -DNSTATIC=1 -DCMAKE_BUILD_TYPE=Debug" make + cmake -DNPARTITION=ON -DNSTATIC=ON -DCMAKE_BUILD_TYPE=Debug .. That command will compile all of SuiteSparse except for CHOLMOD/Partition -Module (because of -DNPARTITION=1). Debug mode will be used (the build type). -The static libraries will not be built (since -DNSTATIC=1 is set). - - CMAKE_BUILD_TYPE: Default: "Release", use "Debug" for debugging. - - ENABLE_CUDA: if set to true, CUDA is enabled for the project. - Default: true for CHOLMOD and SPQR; false otherwise - - LOCAL_INSTALL: if true, "cmake --install" will install - into SuiteSparse/lib and SuiteSparse/include. - if false, "cmake --install" will install into the - default prefix (or the one configured with - CMAKE_INSTALL_PREFIX). - Default: false - - CMAKE_INSTALL_PREFIX: defines the install location (default on Linux is - /usr/local). For example, this command in the top - level SuiteSparse folder will set the install directory - to "/stuff", used by the subsequent "sudo make install": - - CMAKE_OPTIONS="-DCMAKE_INSTALL_PREFIX=/stuff" make - sudo make install - - NSTATIC: if true, static libraries are not built. - Default: false, except for GraphBLAS, which - takes a long time to compile so the default for - GraphBLAS is true. For Mongoose, the NSTATIC setting - is treated as if it always false, since the mongoose - program is built with the static library. - - SUITESPARSE_CUDA_ARCHITECTURES: a string, such as "all" or - "35;50;75;80" that lists the CUDA architectures to use - when compiling CUDA kernels with nvcc. The "all" - option requires cmake 3.23 or later. - Default: "52;75;80". - - BLA_VENDOR a string. Leave unset, or use "ANY" to select any BLAS - library (the default). Or set to the name of a - BLA_VENDOR defined by FindBLAS.cmake. See: - https://cmake.org/cmake/help/latest/module/FindBLAS.html#blas-lapack-vendors - - ALLOW_64BIT_BLAS if true: look for a 64-bit BLAS. If false: 32-bit only. - Default: false. - - NOPENMP if true: OpenMP is not used. Default: false. - UMFPACK, CHOLMOD, SPQR, and GraphBLAS will be slow. - Note that BLAS and LAPACK may still use OpenMP - internally; if you wish to disable OpenMP in an entire - application, select a single-threaded BLAS/LAPACK. - WARNING: GraphBLAS may not be thread-safe if built - without OpenMP (see the User Guide for details). - - DEMO if true: build the demo programs for each package. - Default: false. +Module (because of `-DNPARTITION=ON`). Debug mode will be used (the build +type). The static libraries will not be built (since `-DNSTATIC=ON` is set). + +* `SUITESPARSE_ENABLE_PROJECTS`: + + Semicolon separated list of projects to be built or `all`. + Default: `all` in which case the following projects are built: + + `suitesparse_config;mongoose;amd;btf;camd;ccolamd;colamd;cholmod;cxsparse;ldl;klu;umfpack;paru;rbio;spqr;spex;graphblas;lagraph` + + Additionally, `csparse` can be included in that list to build CSparse. + +* `CMAKE_BUILD_TYPE`: + + Default: `Release`, use `Debug` for debugging. + +* `ENABLE_CUDA`: + + If set to `ON`, CUDA is enabled for the project. Default: `ON` for CHOLMOD + and SPQR; `OFF` otherwise. + +* `CMAKE_INSTALL_PREFIX`: + + Defines the install location (default on Linux is `/usr/local`). For example, + this command while in a folder `build` in the top level SuiteSparse folder + will set the install directory to `/stuff`, used by the subsequent + `sudo cmake --install .`: +``` + cmake -DCMAKE_INSTALL_PREFIX=/stuff .. + sudo cmake --install . +``` + +* `NSTATIC`: + + If `ON`, static libraries are not built. + Default: `OFF`, except for GraphBLAS, which takes a long time to compile so + the default for GraphBLAS is `ON`. + +* `SUITESPARSE_CUDA_ARCHITECTURES`: + + A string, such as `"all"` or `"35;50;75;80"` that lists the CUDA + architectures to use when compiling CUDA kernels with `nvcc`. The `"all"` + option requires CMake 3.23 or later. Default: `"52;75;80"`. + +* `BLA_VENDOR`: + + A string. Leave unset, or use `"ANY"` to select any BLAS library (the + default). Or set to the name of a `BLA_VENDOR` defined by FindBLAS.cmake. + See: + https://cmake.org/cmake/help/latest/module/FindBLAS.html#blas-lapack-vendors + +* `ALLOW_64BIT_BLAS`: + + If `ON`, look for a 64-bit BLAS. If `OFF`: 32-bit only. Default: `OFF`. + +* `NOPENMP`: + + If `ON`, OpenMP is not used. Default: `OFF`. + + UMFPACK, CHOLMOD, SPQR, and GraphBLAS will be slow. + + Note that BLAS and LAPACK may still use OpenMP internally; if you wish to + disable OpenMP in an entire application, select a single-threaded + BLAS/LAPACK. + + WARNING: GraphBLAS may not be thread-safe if built without OpenMP (see the + User Guide for details). + +* `DEMO`: + If `ON`, build the demo programs for each package. Default: `OFF`. Additional options are available within specific packages: - NCHOLMOD if true, UMFPACK and KLU do not use CHOLMOD for - additional (optional) ordering options +* `NCHOLMOD`: + + If `ON`, UMFPACK and KLU do not use CHOLMOD for additional (optional) + ordering options. CHOLMOD is composed of a set of Modules that can be independently selected; -all options default to false: - - NGL if true: do not build any GPL-licensed module - (MatrixOps, Modify, Supernodal, and GPU modules) - NCHECK if true: do not build the Check module. - NMATRIXOPS if true: do not build the MatrixOps module. - NCHOLESKY if true: do not build the Cholesky module. - This also disables the Supernodal and Modify modules. - NMODIFY if true: do not build the Modify module. - NCAMD if true: do not link against CAMD and CCOLAMD. - This also disables the Partition module. - NPARTITION if true: do not build the Partition module. - NSUPERNODAL if true: do not build the Supernodal module. +all options default to `OFF`: + +* `NGPL` + + If `ON`, do not build any GPL-licensed module (MatrixOps, Modify, Supernodal, + and GPU modules) + +* `NCHECK` + + If `ON`, do not build the Check module. + +* `NMATRIXOPS` + + If `ON`, do not build the MatrixOps module. + +* `NCHOLESKY` + If `ON`, do not build the Cholesky module. This also disables the Supernodal + and Modify modules. + +* `NMODIFY` + + If `ON`, do not build the Modify module. + +* `NCAMD` + + If `ON`, do not link against CAMD and CCOLAMD. This also disables the + Partition module. + +* `NPARTITION` + + If `ON`, do not build the Partition module. + +* `NSUPERNODAL` + + If `ON`, do not build the Supernodal module. ----------------------------------------------------------------------------- Acknowledgements From e35f8c56b93d1f1975256836d58558574317ec43 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Markus=20M=C3=BCtzel?= Date: Mon, 18 Sep 2023 19:03:57 +0200 Subject: [PATCH 20/24] Add CSparse to the root CMakeLists.txt --- CMakeLists.txt | 10 +++++++++- CSparse/CMakeLists.txt | 27 +++++++++++++-------------- 2 files changed, 22 insertions(+), 15 deletions(-) diff --git a/CMakeLists.txt b/CMakeLists.txt index 15cadd44b..5e63fa413 100644 --- a/CMakeLists.txt +++ b/CMakeLists.txt @@ -33,7 +33,7 @@ set ( SUITESPARSE_ALL_PROJECTS # lower-case list of extra projects that can be built by this root CMake file set ( SUITESPARSE_EXTRA_PROJECTS - "" ) + "csparse" ) # lower-case list of known projects that can be built by this root CMake file set ( SUITESPARSE_KNOWN_PROJECTS "${SUITESPARSE_ALL_PROJECTS};${SUITESPARSE_EXTRA_PROJECTS}" ) @@ -321,6 +321,14 @@ if ( "lagraph" IN_LIST SUITESPARSE_ENABLE_PROJECTS ) endif ( ) endif ( ) +if ( "csparse" IN_LIST SUITESPARSE_ENABLE_PROJECTS ) + add_subdirectory ( "CSparse" ) + add_library ( SuiteSparse::CSparse ALIAS CSparse ) + if ( NOT NSTATIC ) + add_library ( SuiteSparse::CSparse_static ALIAS CSparse_static ) + endif ( ) +endif ( ) + #------------------------------------------------------------------------------- # report status #------------------------------------------------------------------------------- diff --git a/CSparse/CMakeLists.txt b/CSparse/CMakeLists.txt index 5d78d2d87..8c0e61e50 100644 --- a/CSparse/CMakeLists.txt +++ b/CSparse/CMakeLists.txt @@ -2,7 +2,7 @@ # CSparse/CMakeLists.txt: cmake for CSparse #------------------------------------------------------------------------------- -# Copyright (c) 2006-2022, Timothy A. Davis. All Rights Reserved. +# Copyright (c) 2006-2023, Timothy A. Davis. All Rights Reserved. # SPDX-License-Identifier: LGPL-2.1+ # CSparse/CMakeLists.txt is a standalone script, which can be used outside of @@ -18,20 +18,28 @@ cmake_minimum_required ( VERSION 3.13 ) set ( CSPARSE_DATE "Sept 8, 2023" ) -set ( CSPARSE_VERSION_MAJOR 4 ) -set ( CSPARSE_VERSION_MINOR 2 ) -set ( CSPARSE_VERSION_SUB 0 ) +set ( CSPARSE_VERSION_MAJOR 4 CACHE STRING "" FORCE ) +set ( CSPARSE_VERSION_MINOR 2 CACHE STRING "" FORCE ) +set ( CSPARSE_VERSION_SUB 0 CACHE STRING "" FORCE ) message ( STATUS "Building CSparse version: v" ${CSPARSE_VERSION_MAJOR}. ${CSPARSE_VERSION_MINOR}. ${CSPARSE_VERSION_SUB} " (" ${CSPARSE_DATE} ")" ) +#------------------------------------------------------------------------------- +# define the project +#------------------------------------------------------------------------------- + +project ( csparse + VERSION "${CSPARSE_VERSION_MAJOR}.${CSPARSE_VERSION_MINOR}.${CSPARSE_VERSION_SUB}" + LANGUAGES C ) + #------------------------------------------------------------------------------- # SuiteSparse policies (a subset) #------------------------------------------------------------------------------- -message ( STATUS "Source: " ${CMAKE_SOURCE_DIR} ) +message ( STATUS "Source: " ${PROJECT_SOURCE_DIR} ) message ( STATUS "Build: " ${CMAKE_BINARY_DIR} ) cmake_policy ( SET CMP0042 NEW ) # enable MACOSX_RPATH by default @@ -44,7 +52,6 @@ if ( WIN32 ) endif ( ) set ( CMAKE_MACOSX_RPATH TRUE ) -enable_language ( C ) include ( GNUInstallDirs ) if ( NOT CMAKE_BUILD_TYPE ) @@ -53,14 +60,6 @@ endif ( ) message ( STATUS "Build type: " ${CMAKE_BUILD_TYPE} ) -#------------------------------------------------------------------------------- -# define the project -#------------------------------------------------------------------------------- - -project ( csparse - VERSION "${CSPARSE_VERSION_MAJOR}.${CSPARSE_VERSION_MINOR}.${CSPARSE_VERSION_SUB}" - LANGUAGES C ) - #------------------------------------------------------------------------------- # Configure cs.h with version number #------------------------------------------------------------------------------- From 1a12c21c8e90b379197512143eeba558f382de08 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Markus=20M=C3=BCtzel?= Date: Mon, 18 Sep 2023 19:14:10 +0200 Subject: [PATCH 21/24] Support union with "all" in SUITESPARSE_ENABLE_PROJECTS --- CMakeLists.txt | 6 ++++-- 1 file changed, 4 insertions(+), 2 deletions(-) diff --git a/CMakeLists.txt b/CMakeLists.txt index 5e63fa413..e2cc77630 100644 --- a/CMakeLists.txt +++ b/CMakeLists.txt @@ -42,8 +42,10 @@ set ( SUITESPARSE_ENABLE_PROJECTS "all" CACHE STRING "Semicolon-separated list of SuiteSparse projects to be built (${SUITESPARSE_KNOWN_PROJECTS}, or \"all\")" ) # expand "all" early on -if ( SUITESPARSE_ENABLE_PROJECTS STREQUAL "all" ) - set ( SUITESPARSE_ENABLE_PROJECTS ${SUITESPARSE_ALL_PROJECTS} ) +if ( "all" IN_LIST SUITESPARSE_ENABLE_PROJECTS ) + set ( SUITESPARSE_ENABLE_PROJECTS "${SUITESPARSE_ENABLE_PROJECTS};${SUITESPARSE_ALL_PROJECTS}" ) + list ( REMOVE_ITEM SUITESPARSE_ENABLE_PROJECTS "all" ) + list ( REMOVE_DUPLICATES SUITESPARSE_ENABLE_PROJECTS ) endif ( ) # check for unknown projects in list From 9906b3192f9eb395984fd6913cd51cb610e25cff Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Markus=20M=C3=BCtzel?= Date: Mon, 18 Sep 2023 19:36:01 +0200 Subject: [PATCH 22/24] UMFPACK: Avoid target name conflict --- UMFPACK/CMakeLists.txt | 9 ++++++--- 1 file changed, 6 insertions(+), 3 deletions(-) diff --git a/UMFPACK/CMakeLists.txt b/UMFPACK/CMakeLists.txt index d6ac3606c..46966c524 100644 --- a/UMFPACK/CMakeLists.txt +++ b/UMFPACK/CMakeLists.txt @@ -395,9 +395,12 @@ if ( DEMO ) if ( NOT NFORTRAN ) # Fortran demos add_executable ( umf4 "Demo/umf4.c" ) - add_executable ( readhb "Demo/readhb.f" ) - add_executable ( readhb_nozeros "Demo/readhb_nozeros.f" ) - add_executable ( readhb_size "Demo/readhb_size.f" ) + add_executable ( umfreadhb "Demo/readhb.f" ) + set_target_properties ( umfreadhb PROPERTIES OUTPUT_NAME readhb ) + add_executable ( umfreadhb_nozeros "Demo/readhb_nozeros.f" ) + set_target_properties ( umfreadhb_nozeros PROPERTIES OUTPUT_NAME readhb_nozeros ) + add_executable ( umfreadhb_size "Demo/readhb_size.f" ) + set_target_properties ( umfreadhb_size PROPERTIES OUTPUT_NAME readhb_size ) add_executable ( umf4hb "Demo/umf4hb.f" "Demo/umf4_f77wrapper.c" ) add_executable ( umf4zhb "Demo/umf4zhb.f" From 391392d1596231a8d25d5dd63543b7d46e7f2d55 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Markus=20M=C3=BCtzel?= Date: Mon, 18 Sep 2023 19:48:52 +0200 Subject: [PATCH 23/24] CI: Add runners that build with the root CMakeLists.txt --- .github/workflows/root-cmakelists.yaml | 174 +++++++++++++++++++++++++ 1 file changed, 174 insertions(+) create mode 100644 .github/workflows/root-cmakelists.yaml diff --git a/.github/workflows/root-cmakelists.yaml b/.github/workflows/root-cmakelists.yaml new file mode 100644 index 000000000..b97d4625b --- /dev/null +++ b/.github/workflows/root-cmakelists.yaml @@ -0,0 +1,174 @@ +# Build SuiteSparse using the root CMakeLists.txt + +name: root-cmakelists + +on: + workflow_dispatch: + push: + branches-ignore: + - '**/dev2' + pull_request: + +concurrency: ci-root-cmakelists-${{ github.ref }} + +jobs: + + ubuntu: + # For available GitHub-hosted runners, see: + # https://docs.github.com/en/actions/using-github-hosted-runners/about-github-hosted-runners + runs-on: ubuntu-latest + + name: ubuntu (${{ matrix.compiler }} ${{ matrix.cuda }} CUDA) + + strategy: + # Allow other runners in the matrix to continue if some fail + fail-fast: false + + matrix: + compiler: [gcc, clang] + cuda: [with, without] + include: + - compiler: gcc + compiler-pkgs: "g++ gcc" + cc: "gcc" + cxx: "g++" + - compiler: clang + compiler-pkgs: "clang libomp-dev" + cc: "clang" + cxx: "clang++" + # Clang seems to generally require less cache size (smaller object files?). + - compiler: gcc + ccache-max: 600M + - compiler: clang + ccache-max: 500M + - cuda: with + cuda-pkgs: "nvidia-cuda-dev nvidia-cuda-toolkit" + cuda-cmake-flags: + -DENABLE_CUDA=ON + -DCUDAToolkit_INCLUDE_DIR="/usr/include" + -DCMAKE_CUDA_COMPILER_LAUNCHER="ccache" + + env: + CC: ${{ matrix.cc }} + CXX: ${{ matrix.cxx }} + + steps: + - name: checkout repository + uses: actions/checkout@v3 + + - name: install dependencies + env: + COMPILER_PKGS: ${{ matrix.compiler-pkgs }} + CUDA_PKGS: ${{ matrix.cuda-pkgs }} + run: | + sudo apt -qq update + sudo apt install -y ${COMPILER_PKGS} autoconf automake ccache cmake \ + dvipng gfortran libgmp-dev liblapack-dev libmpfr-dev \ + libopenblas-dev ${CUDA_PKGS} + + - name: prepare ccache + # create key with human readable timestamp + # used in action/cache/restore and action/cache/save steps + id: ccache-prepare + run: | + echo "key=ccache:ubuntu:root:${{ matrix.compiler }}:${{ matrix.cuda }}:${{ github.ref }}:$(date +"%Y-%m-%d_%H-%M-%S"):${{ github.sha }}" >> $GITHUB_OUTPUT + + - name: restore ccache + # setup the GitHub cache used to maintain the ccache from one job to the next + uses: actions/cache/restore@v3 + with: + path: ~/.ccache + key: ${{ steps.ccache-prepare.outputs.key }} + # Prefer caches from the same branch. Fall back to caches from the dev branch. + restore-keys: | + ccache:ubuntu:root:${{ matrix.compiler }}:${{ matrix.cuda }}:${{ github.ref }} + ccache:ubuntu:root:${{ matrix.compiler }}:${{ matrix.cuda }} + + - name: create empty libraries + # This is to work around a bug in nvlink. + # See: https://forums.developer.nvidia.com/t/nvlink-fatal-could-not-open-input-file-when-linking-with-empty-static-library/208517 + if: matrix.cuda == 'with' + run: | + touch empty.c + gcc -fPIC -c empty.c -oempty.o + ar rcsv libdl.a empty.o + ar rcsv librt.a empty.o + ar rcsv libpthread.a empty.o + # overwrite system libraries with "valid" empty libraries + sudo mv ./libdl.a /usr/lib/x86_64-linux-gnu/libdl.a + sudo mv ./librt.a /usr/lib/x86_64-linux-gnu/librt.a + sudo mv ./libpthread.a /usr/lib/x86_64-linux-gnu/libpthread.a + + - name: configure ccache + env: + CCACHE_MAX: ${{ matrix.ccache-max }} + run: | + test -d ~/.ccache || mkdir ~/.ccache + echo "max_size = $CCACHE_MAX" >> ~/.ccache/ccache.conf + echo "compression = true" >> ~/.ccache/ccache.conf + ccache -s + echo "/usr/lib/ccache" >> $GITHUB_PATH + + - name: build libraries + run: | + printf "::group:: \033[0;32m==>\033[0m Configuring\n" + mkdir -p ${GITHUB_WORKSPACE}/build && cd ${GITHUB_WORKSPACE}/build + cmake -DCMAKE_BUILD_TYPE="Release" \ + -DCMAKE_INSTALL_PREFIX=".." \ + -DCMAKE_C_COMPILER_LAUNCHER="ccache" \ + -DCMAKE_CXX_COMPILER_LAUNCHER="ccache" \ + -DCMAKE_Fortran_COMPILER_LAUNCHER="ccache" \ + -DBLA_VENDOR="OpenBLAS" \ + ${{ matrix.cuda-cmake-flags }} \ + .. + echo "::endgroup::" + printf "::group:: \033[0;32m==>\033[0m Building\n" + cmake --build . + echo "::endgroup::" + + - name: build demos + run: | + printf "::group:: \033[0;32m==>\033[0m Configuring for demos\n" + cd ${GITHUB_WORKSPACE}/build + cmake -DDEMO=ON .. + echo "::endgroup::" + printf "::group:: \033[0;32m==>\033[0m Building demos\n" + cd ${GITHUB_WORKSPACE}/build + cmake --build . + echo "::endgroup::" + # FIXME: How to run the demos without Makefile? + + - name: ccache status + continue-on-error: true + run: ccache -s + + - name: save ccache + # Save the cache after we are done (successfully) building. + # This helps to retain the ccache even if the subsequent steps are failing. + uses: actions/cache/save@v3 + with: + path: ~/.ccache + key: ${{ steps.ccache-prepare.outputs.key }} + + - name: install + run: | + printf "\033[0;32m==>\033[0m Installing libraries\n" + cd ${GITHUB_WORKSPACE}/build + cmake --install . + + - name: build example + run: | + cd ${GITHUB_WORKSPACE}/Example/build + printf "::group::\033[0;32m==>\033[0m Configuring example\n" + cmake \ + -DCMAKE_PREFIX_PATH="${GITHUB_WORKSPACE}/lib/cmake" \ + -DBLA_VENDOR="OpenBLAS" \ + ${{ matrix.cuda-cmake-flags }} \ + .. + echo "::endgroup::" + printf "::group::\033[0;32m==>\033[0m Building example\n" + cmake --build . + echo "::endgroup::" + printf "::group::\033[0;32m==>\033[0m Executing example\n" + LD_LIBRARY_PATH=${GITHUB_WORKSPACE}/lib ./my_demo + echo "::endgroup::" From 13ada8e83b764e002fb5892ee55511954a5d5ccd Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Markus=20M=C3=BCtzel?= Date: Thu, 2 Nov 2023 19:42:30 +0100 Subject: [PATCH 24/24] CI: Add MSVC runner that builds with root CMakeLists.txt --- .github/workflows/root-cmakelists.yaml | 179 +++++++++++++++++++++++++ 1 file changed, 179 insertions(+) diff --git a/.github/workflows/root-cmakelists.yaml b/.github/workflows/root-cmakelists.yaml index b97d4625b..e47552bf5 100644 --- a/.github/workflows/root-cmakelists.yaml +++ b/.github/workflows/root-cmakelists.yaml @@ -172,3 +172,182 @@ jobs: printf "::group::\033[0;32m==>\033[0m Executing example\n" LD_LIBRARY_PATH=${GITHUB_WORKSPACE}/lib ./my_demo echo "::endgroup::" + + + msvc: + # For available GitHub-hosted runners, see: + # https://docs.github.com/en/actions/using-github-hosted-runners/about-github-hosted-runners + runs-on: windows-latest + + name: msvc (${{ matrix.openmp }} OpenMP) + + defaults: + run: + # Use bash as default shell + shell: bash -el {0} + + strategy: + # Allow other runners in the matrix to continue if some fail + fail-fast: false + + env: + CHERE_INVOKING: 1 + + steps: + - name: get CPU name + shell: pwsh + run : | + Get-CIMInstance -Class Win32_Processor | Select-Object -Property Name + + - name: checkout repository + uses: actions/checkout@v3 + + - uses: conda-incubator/setup-miniconda@v2 + with: + auto-update-conda: true + + - name: cache conda packages + id: conda-cache + uses: actions/cache/restore@v3 + with: + path: C:/Miniconda/envs/test + key: conda:msvc + + - name: install packages with conda + if: ${{ steps.conda-cache.outputs.cache-hit != 'true' }} + run: | + echo ${{ steps.conda-cache.outputs.cache-hit }} + conda info + conda list + conda install -y -c intel mkl-devel + conda install -y -c conda-forge --override-channels ccache + + - name: save conda cache + if: ${{ steps.conda-cache.outputs.cache-hit != 'true' }} + uses: actions/cache/save@v3 + with: + path: C:/Miniconda/envs/test + key: ${{ steps.conda-cache.outputs.cache-primary-key }} + + - name: install libraries from MSYS2 + uses: msys2/setup-msys2@v2 + with: + update: true + + # Use pre-installed version to save disc space on partition with source. + release: false + + install: >- + mingw-w64-ucrt-x86_64-gmp + mingw-w64-ucrt-x86_64-mpfr + + msystem: UCRT64 + + - name: setup build environment + # get packages from MSYS2 + # Copy only relevant parts to avoid picking up headers and libraries + # that are thought for MinGW only. + run: | + mkdir -p ./dependencies/{bin,lib,include} + # GMP + cp C:/msys64/ucrt64/bin/libgmp*.dll ./dependencies/bin/ + cp C:/msys64/ucrt64/include/gmp.h ./dependencies/include/ + cp C:/msys64/ucrt64/lib/libgmp.dll.a ./dependencies/lib/gmp.lib + # MPFR + cp C:/msys64/ucrt64/bin/libmpfr*.dll ./dependencies/bin/ + cp C:/msys64/ucrt64/include/mpf2mpfr.h ./dependencies/include/ + cp C:/msys64/ucrt64/include/mpfr.h ./dependencies/include/ + cp C:/msys64/ucrt64/lib/libmpfr.dll.a ./dependencies/lib/mpfr.lib + # run-time dependencies + cp C:/msys64/ucrt64/bin/libgcc_s_seh*.dll ./dependencies/bin/ + cp C:/msys64/ucrt64/bin/libwinpthread*.dll ./dependencies/bin/ + # create environment variable for easier access + echo "CCACHE=C:/Miniconda/envs/test/Library/bin/ccache.exe" >> ${GITHUB_ENV} + + - name: prepare ccache + # create key with human readable timestamp + # used in action/cache/restore and action/cache/save steps + id: ccache-prepare + shell: msys2 {0} + run: | + echo "ccachedir=$(cygpath -m $(${CCACHE} -k cache_dir))" >> $GITHUB_OUTPUT + echo "key=ccache:msvc:root:${{ github.ref }}:$(date +"%Y-%m-%d_%H-%M-%S"):${{ github.sha }}" >> $GITHUB_OUTPUT + + - name: restore ccache + # Setup the GitHub cache used to maintain the ccache from one job to the next + uses: actions/cache/restore@v3 + with: + path: ${{ steps.ccache-prepare.outputs.ccachedir }} + key: ${{ steps.ccache-prepare.outputs.key }} + # Prefer caches from the same branch. Fall back to caches from the dev branch. + restore-keys: | + ccache:msvc:root:${{ github.ref }} + ccache:msvc:root: + + - name: configure ccache + # Limit the maximum size and switch on compression to avoid exceeding the total disk or cache quota. + run: | + test -d ${{ steps.ccache-prepare.outputs.ccachedir }} || mkdir -p ${{ steps.ccache-prepare.outputs.ccachedir }} + echo "max_size = 250M" > ${{ steps.ccache-prepare.outputs.ccachedir }}/ccache.conf + echo "compression = true" >> ${{ steps.ccache-prepare.outputs.ccachedir }}/ccache.conf + ${CCACHE} -p + ${CCACHE} -s + + - name: setup MSVC toolchain + uses: ilammy/msvc-dev-cmd@v1 + + - name: build libraries + run: | + printf "::group:: \033[0;32m==>\033[0m Configuring\n" + mkdir -p ${GITHUB_WORKSPACE}/build && cd ${GITHUB_WORKSPACE}/build + cmake -G"Ninja Multi-Config" \ + -DCMAKE_BUILD_TYPE="Release" \ + -DCMAKE_INSTALL_PREFIX=".." \ + -DCMAKE_PREFIX_PATH="C:/Miniconda/envs/test/Library;${GITHUB_WORKSPACE}/dependencies" \ + -DCMAKE_C_COMPILER_LAUNCHER="ccache" \ + -DCMAKE_CXX_COMPILER_LAUNCHER="ccache" \ + -DCMAKE_Fortran_COMPILER_LAUNCHER="ccache" \ + -DNFORTRAN=ON \ + -DBLA_VENDOR="All" \ + .. + echo "::endgroup::" + printf "::group:: \033[0;32m==>\033[0m Building\n" + cmake --build . --config Release + echo "::endgroup::" + + # FIXME: Build and run tests and demos + + - name: ccache status + continue-on-error: true + run: ${CCACHE} -s + + - name: save ccache + # Save the cache after we are done (successfully) building + # This helps to retain the ccache even if the subsequent steps are failing. + uses: actions/cache/save@v3 + with: + path: ${{ steps.ccache-prepare.outputs.ccachedir }} + key: ${{ steps.ccache-prepare.outputs.key }} + + - name: install + run: | + printf "\033[0;32m==>\033[0m Installing libraries\n" + cd ${GITHUB_WORKSPACE}/build + cmake --install . + + - name: build example + run: | + cd ${GITHUB_WORKSPACE}/Example/build + printf "::group::\033[0;32m==>\033[0m Configuring example\n" + cmake \ + -DCMAKE_PREFIX_PATH="${GITHUB_WORKSPACE}/lib/cmake;C:/Miniconda/envs/test/Library;${GITHUB_WORKSPACE}/dependencies" \ + -DBLA_VENDOR="All" \ + ${{ matrix.openmp-cmake-flags }} \ + .. + echo "::endgroup::" + printf "::group::\033[0;32m==>\033[0m Building example\n" + cmake --build . --config Release + echo "::endgroup::" + printf "::group::\033[0;32m==>\033[0m Executing example\n" + PATH="${GITHUB_WORKSPACE}/bin;${GITHUB_WORKSPACE}/dependencies/bin;${PATH}" ./Release/my_demo + echo "::endgroup::"