diff --git a/CMakeLists.txt b/CMakeLists.txt index 7bc4fc0c67..bd5c754002 100644 --- a/CMakeLists.txt +++ b/CMakeLists.txt @@ -163,10 +163,10 @@ if ( COVERAGE ) message ( STATUS "OpenMP disabled for test coverage" ) else ( ) if ( NOPENMP ) - set ( OPENMP_C_FOUND OFF ) + set ( OpenMP_C_FOUND OFF ) else ( ) find_package ( OpenMP ) - if ( OPENMP_C_FOUND AND BUILD_STATIC_LIBS ) + if ( OpenMP_C_FOUND AND BUILD_STATIC_LIBS ) list ( APPEND LAGRAPH_STATIC_LIBS ${OpenMP_C_LIBRARIES} ) endif ( ) find_package ( Threads ) @@ -201,10 +201,6 @@ include_directories ( ${PROJECT_SOURCE_DIR}/include ${PROJECT_SOURCE_DIR}/src/utility ${PROJECT_SOURCE_DIR}/test/include ) -if ( NOT SUITESPARSE_ROOT_CMAKELISTS ) - include_directories ( ${GRAPHBLAS_INCLUDE_DIR} ) -endif ( ) - # tell LAGraph where to find its own source (for LAGraph/data files) set ( CMAKE_C_FLAGS "${CMAKE_C_FLAGS} -DLGDIR=${PROJECT_SOURCE_DIR}" ) # set ( CMAKE_C_FLAGS "${CMAKE_C_FLAGS} -g -O" ) diff --git a/Makefile b/Makefile index 06cb5aa681..241b83d312 100644 --- a/Makefile +++ b/Makefile @@ -55,10 +55,10 @@ library: # install only in SuiteSparse/lib and SuiteSparse/include local: - ( cd build && cmake $(CMAKE_OPTIONS) -DLOCAL_INSTALL=1 .. && cmake --build . --config Release -j${JOBS} ) + ( cd build && cmake $(CMAKE_OPTIONS) -USUITESPARSE_PKGFILEDIR -DLOCAL_INSTALL=1 .. && cmake --build . --config Release -j${JOBS} ) vanilla: - ( cd build && cmake $(CMAKE_OPTIONS) -DLAGRAPH_VANILLA=1 .. && cmake --build . --config Release -j${JOBS} ) + ( cd build && cmake $(CMAKE_OPTIONS) -USUITESPARSE_PKGFILEDIR -DLAGRAPH_VANILLA=1 .. && cmake --build . --config Release -j${JOBS} ) # compile with -g for debugging debug: diff --git a/cmake_modules/SuiteSparsePolicy.cmake b/cmake_modules/SuiteSparsePolicy.cmake index a9d2c4c8dd..e35bd5f54e 100644 --- a/cmake_modules/SuiteSparsePolicy.cmake +++ b/cmake_modules/SuiteSparsePolicy.cmake @@ -74,9 +74,25 @@ # explicitly, if the defaults are not appropriate for your # system. # Default: false +# +# SUITESPARSE_PKGFILEDIR: where to install the CMake Config and pkg-config +# files. This defaults to the same directory as where +# the compiled libraries are installed, in a subfolder +# called cmake. If not already set in the cache, +# LOCAL_INSTALL=0 defines this as "lib", and the +# CMAKE_INSTALL_PREFIX is added. LOCAL_INSTALL=1 defines +# this as SuiteSparse/lib. This variable is cached so +# that if it is not set, or unset first, it remains +# unchanged (see "make local" and "make global" in the +# SuiteSparse_config/Makefile for an example). +# +# SUITESPARSE_INCLUDEDIR_POSTFIX : # Postfix for installation target of +# header from SuiteSparse. Default: suitesparse, so the +# default include directory is: +# CMAKE_INSTALL_PREFIX/include/suitesparse -message ( STATUS "Source: ${CMAKE_SOURCE_DIR} ") -message ( STATUS "Build: ${CMAKE_BINARY_DIR} ") +message ( STATUS "Source: ${CMAKE_SOURCE_DIR} ") +message ( STATUS "Build: ${CMAKE_BINARY_DIR} ") cmake_policy ( SET CMP0042 NEW ) # enable MACOSX_RPATH by default cmake_policy ( SET CMP0048 NEW ) # VERSION variable policy @@ -166,6 +182,9 @@ if ( NOT SUITESPARSE_ROOT_CMAKELISTS ) endif ( ) endif ( ) +set ( SUITESPARSE_INCLUDEDIR_POSTFIX "suitesparse" CACHE STRING + "Postfix for installation target of header from SuiteSparse (default: \"suitesparse\")" ) + if ( LOCAL_INSTALL ) if ( INSIDE_SUITESPARSE ) # ../lib and ../include exist: the package is inside SuiteSparse. @@ -179,11 +198,11 @@ if ( LOCAL_INSTALL ) endif ( ) endif ( ) set ( SUITESPARSE_LIBDIR ${SUITESPARSE_LOCAL_PREFIX}/lib ) - set ( SUITESPARSE_INCLUDEDIR ${SUITESPARSE_LOCAL_PREFIX}/include ) + set ( SUITESPARSE_INCLUDEDIR ${SUITESPARSE_LOCAL_PREFIX}/include/${SUITESPARSE_INCLUDEDIR_POSTFIX} ) set ( SUITESPARSE_BINDIR ${SUITESPARSE_LOCAL_PREFIX}/bin ) else ( ) set ( SUITESPARSE_LIBDIR ${CMAKE_INSTALL_LIBDIR} ) - set ( SUITESPARSE_INCLUDEDIR ${CMAKE_INSTALL_INCLUDEDIR} ) + set ( SUITESPARSE_INCLUDEDIR ${CMAKE_INSTALL_INCLUDEDIR}/${SUITESPARSE_INCLUDEDIR_POSTFIX} ) set ( SUITESPARSE_BINDIR ${CMAKE_INSTALL_BINDIR} ) endif ( ) @@ -207,7 +226,7 @@ if ( NOT CMAKE_BUILD_TYPE ) set ( CMAKE_BUILD_TYPE Release ) endif ( ) -message ( STATUS "Build type: ${CMAKE_BUILD_TYPE} ") +message ( STATUS "Build type: ${CMAKE_BUILD_TYPE} ") set ( CMAKE_INCLUDE_CURRENT_DIR ON ) @@ -218,16 +237,16 @@ set ( CMAKE_INCLUDE_CURRENT_DIR ON ) include ( CheckLanguage ) option ( NFORTRAN "ON: do not try to use Fortran. OFF (default): try Fortran" off ) if ( NFORTRAN ) - message ( STATUS "Fortran: not enabled" ) + message ( STATUS "Fortran: not enabled" ) else ( ) check_language ( Fortran ) if ( CMAKE_Fortran_COMPILER ) enable_language ( Fortran ) - message ( STATUS "Fortran: ${CMAKE_Fortran_COMPILER}" ) + message ( STATUS "Fortran: ${CMAKE_Fortran_COMPILER}" ) else ( ) # Fortran not available: set ( NFORTRAN true ) - message ( STATUS "Fortran: not available" ) + message ( STATUS "Fortran: not available" ) endif ( ) endif ( ) @@ -250,43 +269,43 @@ if ( ENABLE_CUDA ) # try finding CUDA check_language ( CUDA ) - message ( STATUS "Looking for CUDA" ) + # message ( STATUS "Looking for CUDA" ) if ( CMAKE_CUDA_COMPILER ) # with CUDA: - message ( STATUS "Find CUDA tool kit:" ) + # message ( STATUS "Find CUDA tool kit:" ) # FindCUDAToolKit needs to have C or CXX enabled first (see above) - include ( FindCUDAToolkit ) - message ( STATUS "CUDA toolkit found: " ${CUDAToolkit_FOUND} ) - message ( STATUS "CUDA toolkit version: " ${CUDAToolkit_VERSION} ) - message ( STATUS "CUDA toolkit include: " ${CUDAToolkit_INCLUDE_DIRS} ) - message ( STATUS "CUDA toolkit lib dir: " ${CUDAToolkit_LIBRARY_DIR} ) + find_package ( CUDAToolkit ) + message ( STATUS "CUDA toolkit : " ${CUDAToolkit_FOUND} ) + message ( STATUS "CUDA toolkit ver: " ${CUDAToolkit_VERSION} ) + message ( STATUS "CUDA toolkit inc: " ${CUDAToolkit_INCLUDE_DIRS} ) + message ( STATUS "CUDA toolkit lib: " ${CUDAToolkit_LIBRARY_DIR} ) if ( CUDAToolkit_VERSION VERSION_LESS "11.2" ) # CUDA is present but too old - message ( STATUS "CUDA: not enabled (CUDA 11.2 or later required)" ) - set ( SUITESPARSE_CUDA off ) + message ( STATUS "CUDA: not enabled (CUDA 11.2 or later required)" ) + set ( SUITESPARSE_CUDA OFF ) else ( ) # CUDA 11.2 or later present enable_language ( CUDA ) - set ( SUITESPARSE_CUDA on ) + set ( SUITESPARSE_CUDA ON ) endif ( ) else ( ) # without CUDA: - message ( STATUS "CUDA: not found" ) - set ( SUITESPARSE_CUDA off ) + message ( STATUS "CUDA: not found" ) + set ( SUITESPARSE_CUDA OFF ) endif ( ) else ( ) # CUDA is disabled - set ( SUITESPARSE_CUDA off ) + set ( SUITESPARSE_CUDA OFF ) endif ( ) if ( SUITESPARSE_CUDA ) - message ( STATUS "CUDA: enabled" ) + message ( STATUS "CUDA: enabled" ) set ( SUITESPARSE_CUDA_ARCHITECTURES "52;75;80" CACHE STRING "CUDA architectures" ) set ( CMAKE_CUDA_ARCHITECTURES ${SUITESPARSE_CUDA_ARCHITECTURES} ) else ( ) - message ( STATUS "CUDA: not enabled" ) + message ( STATUS "CUDA: not enabled" ) endif ( ) diff --git a/config/LAGraph.h.in b/config/LAGraph.h.in index 7ef78c2c53..2fb2eef1df 100644 --- a/config/LAGraph.h.in +++ b/config/LAGraph.h.in @@ -2,7 +2,7 @@ // LAGraph.h: user-visible include file for LAGraph //------------------------------------------------------------------------------ -// LAGraph, (c) 2019-2022 by The LAGraph Contributors, All Rights Reserved. +// LAGraph, (c) 2019-2023 by The LAGraph Contributors, All Rights Reserved. // SPDX-License-Identifier: BSD-2-Clause // // For additional details (including references to third party source code and @@ -99,7 +99,7 @@ #if ( !LAGRAPH_VANILLA ) && defined ( GxB_SUITESPARSE_GRAPHBLAS ) // use SuiteSparse, and its GxB* extensions #if GxB_IMPLEMENTATION < GxB_VERSION (7,1,0) - #error "If using SuiteSparse::GraphBLAS, version 7.1.0 or later s required" + #error "If using SuiteSparse::GraphBLAS, version 7.1.0 or later is required" #endif #define LAGRAPH_SUITESPARSE 1 #else diff --git a/experimental/CMakeLists.txt b/experimental/CMakeLists.txt index 16828e5bc7..9d4560f97e 100644 --- a/experimental/CMakeLists.txt +++ b/experimental/CMakeLists.txt @@ -33,6 +33,11 @@ if ( BUILD_SHARED_LIBS ) C_STANDARD 11 PUBLIC_HEADER "include/LAGraphX.h" RUNTIME_OUTPUT_DIRECTORY ${PROJECT_BINARY_DIR}/dlls ) + + if ( ${CMAKE_VERSION} VERSION_GREATER_EQUAL "3.25" ) + set_target_properties ( LAGraphX PROPERTIES EXPORT_NO_SYSTEM ON ) + endif ( ) + target_link_libraries ( LAGraphX PRIVATE LAGraph GraphBLAS::GraphBLAS ) target_include_directories ( LAGraphX PUBLIC @@ -61,10 +66,14 @@ if ( BUILD_STATIC_LIBS ) OUTPUT_NAME lagraphx_static ) endif ( ) + if ( ${CMAKE_VERSION} VERSION_GREATER_EQUAL "3.25" ) + set_target_properties ( LAGraphX_static PROPERTIES EXPORT_NO_SYSTEM ON ) + endif ( ) + if ( TARGET GraphBLAS::GraphBLAS_static ) - target_link_libraries ( LAGraphX_static PUBLIC GraphBLAS::GraphBLAS_static ) + target_link_libraries ( LAGraphX_static PRIVATE GraphBLAS::GraphBLAS_static ) else ( ) - target_link_libraries ( LAGraphX_static PUBLIC GraphBLAS::GraphBLAS ) + target_link_libraries ( LAGraphX_static PRIVATE GraphBLAS::GraphBLAS ) endif ( ) target_include_directories ( LAGraphX_static PUBLIC @@ -76,12 +85,12 @@ endif ( ) # add OpenMP #------------------------------------------------------------------------------- -if ( OPENMP_C_FOUND ) +if ( OpenMP_C_FOUND ) if ( BUILD_SHARED_LIBS ) target_link_libraries ( LAGraphX PRIVATE OpenMP::OpenMP_C ) endif ( ) if ( BUILD_STATIC_LIBS ) - target_link_libraries ( LAGraphX_static PUBLIC OpenMP::OpenMP_C ) + target_link_libraries ( LAGraphX_static PRIVATE OpenMP::OpenMP_C ) endif ( ) endif ( ) diff --git a/experimental/test/CMakeLists.txt b/experimental/test/CMakeLists.txt index ccd335f0be..bd25a3edb6 100644 --- a/experimental/test/CMakeLists.txt +++ b/experimental/test/CMakeLists.txt @@ -67,7 +67,7 @@ if ( BUILD_STATIC_LIBS ) OUTPUT_NAME lagraphxtest_static ) endif ( ) - target_link_libraries ( lagraphxtest_static PUBLIC LAGraph_static lagraphtest_static GraphBLAS::GraphBLAS ) + target_link_libraries ( lagraphxtest_static PRIVATE LAGraph_static lagraphtest_static GraphBLAS::GraphBLAS ) endif ( ) #------------------------------------------------------------------------------- @@ -79,7 +79,7 @@ if ( OPENMP_C_FOUND ) target_link_libraries ( lagraphxtest PRIVATE OpenMP::OpenMP_C ) endif ( ) if ( BUILD_STATIC_LIBS ) - target_link_libraries ( lagraphxtest_static PUBLIC OpenMP::OpenMP_C ) + target_link_libraries ( lagraphxtest_static PRIVATE OpenMP::OpenMP_C ) endif ( ) endif ( ) diff --git a/include/LAGraph.h b/include/LAGraph.h index 7bc41bdaab..46a4f45a6d 100644 --- a/include/LAGraph.h +++ b/include/LAGraph.h @@ -2,7 +2,7 @@ // LAGraph.h: user-visible include file for LAGraph //------------------------------------------------------------------------------ -// LAGraph, (c) 2019-2022 by The LAGraph Contributors, All Rights Reserved. +// LAGraph, (c) 2019-2023 by The LAGraph Contributors, All Rights Reserved. // SPDX-License-Identifier: BSD-2-Clause // // For additional details (including references to third party source code and @@ -99,7 +99,7 @@ #if ( !LAGRAPH_VANILLA ) && defined ( GxB_SUITESPARSE_GRAPHBLAS ) // use SuiteSparse, and its GxB* extensions #if GxB_IMPLEMENTATION < GxB_VERSION (7,1,0) - #error "If using SuiteSparse::GraphBLAS, version 7.1.0 or later s required" + #error "If using SuiteSparse::GraphBLAS, version 7.1.0 or later is required" #endif #define LAGRAPH_SUITESPARSE 1 #else diff --git a/src/CMakeLists.txt b/src/CMakeLists.txt index c5667d962a..3d6d40577e 100644 --- a/src/CMakeLists.txt +++ b/src/CMakeLists.txt @@ -29,7 +29,7 @@ endif ( ) if ( BUILD_SHARED_LIBS ) add_library ( LAGraph SHARED ${LAGRAPH_LIB_SOURCES} ) - SET_TARGET_PROPERTIES ( LAGraph PROPERTIES + set_target_properties ( LAGraph PROPERTIES VERSION ${LAGraph_VERSION_MAJOR}.${LAGraph_VERSION_MINOR}.${LAGraph_VERSION_SUB} SOVERSION ${LAGraph_VERSION_MAJOR} OUTPUT_NAME lagraph @@ -37,6 +37,11 @@ if ( BUILD_SHARED_LIBS ) C_STANDARD 11 PUBLIC_HEADER "include/LAGraph.h" RUNTIME_OUTPUT_DIRECTORY ${PROJECT_BINARY_DIR}/dlls ) + + if ( ${CMAKE_VERSION} VERSION_GREATER_EQUAL "3.25" ) + set_target_properties ( LAGraph PROPERTIES EXPORT_NO_SYSTEM ON ) + endif ( ) + target_link_libraries ( LAGraph PRIVATE GraphBLAS::GraphBLAS ${M_LIB} ) target_include_directories ( LAGraph PUBLIC @@ -66,6 +71,10 @@ if ( BUILD_STATIC_LIBS ) OUTPUT_NAME lagraph_static ) endif ( ) + if ( ${CMAKE_VERSION} VERSION_GREATER_EQUAL "3.25" ) + set_target_properties ( LAGraph_static PROPERTIES EXPORT_NO_SYSTEM ON ) + endif ( ) + if ( TARGET GraphBLAS::GraphBLAS_static ) target_link_libraries ( LAGraph_static PUBLIC GraphBLAS::GraphBLAS_static ) else ( ) @@ -82,12 +91,12 @@ endif ( ) # add OpenMP #------------------------------------------------------------------------------- -if ( OPENMP_C_FOUND ) +if ( OpenMP_C_FOUND ) if ( BUILD_SHARED_LIBS ) target_link_libraries ( LAGraph PRIVATE OpenMP::OpenMP_C ) endif ( ) if ( BUILD_STATIC_LIBS ) - target_link_libraries ( LAGraph_static PUBLIC OpenMP::OpenMP_C ) + target_link_libraries ( LAGraph_static PRIVATE OpenMP::OpenMP_C ) endif ( ) endif ( ) diff --git a/src/test/CMakeLists.txt b/src/test/CMakeLists.txt index 8a80762378..f61e12f4f5 100644 --- a/src/test/CMakeLists.txt +++ b/src/test/CMakeLists.txt @@ -69,7 +69,7 @@ if ( BUILD_STATIC_LIBS ) OUTPUT_NAME lagraphtest_static ) endif ( ) - target_link_libraries ( lagraphtest_static PUBLIC LAGraph_static GraphBLAS::GraphBLAS ) + target_link_libraries ( lagraphtest_static PRIVATE LAGraph_static GraphBLAS::GraphBLAS ) endif ( ) #------------------------------------------------------------------------------- @@ -81,7 +81,7 @@ if ( OPENMP_C_FOUND ) target_link_libraries ( lagraphtest PRIVATE OpenMP::OpenMP_C ) endif ( ) if ( BUILD_STATIC_LIBS ) - target_link_libraries ( lagraphtest_static PUBLIC OpenMP::OpenMP_C ) + target_link_libraries ( lagraphtest_static PRIVATE OpenMP::OpenMP_C ) endif ( ) endif ( ) diff --git a/src/test/LG_check_sssp.c b/src/test/LG_check_sssp.c index 55e1729d04..204775c602 100644 --- a/src/test/LG_check_sssp.c +++ b/src/test/LG_check_sssp.c @@ -102,25 +102,25 @@ int LG_check_sssp { etypecode = 0 ; etypesize = sizeof (int32_t) ; - etypeinf = INT32_MAX ; + etypeinf = (double) INT32_MAX ; } else if (etype == GrB_INT64) { etypecode = 1 ; etypesize = sizeof (int64_t) ; - etypeinf = INT64_MAX ; + etypeinf = (double) INT64_MAX ; } else if (etype == GrB_UINT32) { etypecode = 2 ; etypesize = sizeof (uint32_t) ; - etypeinf = UINT32_MAX ; + etypeinf = (double) UINT32_MAX ; } else if (etype == GrB_UINT64) { etypecode = 3 ; etypesize = sizeof (uint64_t) ; - etypeinf = UINT64_MAX ; + etypeinf = (double) UINT64_MAX ; } else if (etype == GrB_FP32) {