Skip to content

Commit

Permalink
cmake revisions
Browse files Browse the repository at this point in the history
  • Loading branch information
DrTimothyAldenDavis committed Nov 4, 2022
1 parent 7af9e07 commit 244aa17
Show file tree
Hide file tree
Showing 11 changed files with 64 additions and 39 deletions.
21 changes: 14 additions & 7 deletions CMakeLists.txt
Original file line number Diff line number Diff line change
Expand Up @@ -39,9 +39,7 @@ message ( STATUS "GraphBLAS C API: v"

set ( CMAKE_MODULE_PATH ${CMAKE_MODULE_PATH}
${CMAKE_SOURCE_DIR}/cmake_modules
${CMAKE_SOURCE_DIR}/../SuiteSparse_config/cmake_modules
${CMAKE_SOURCE_DIR}/../SuiteSparse/SuiteSparse_config/cmake_modules
)
${CMAKE_SOURCE_DIR}/../SuiteSparse_config/cmake_modules )

if ( NOT DEFINED NSTATIC )
# default for GraphBLAS: do not build the static libraries
Expand All @@ -52,6 +50,7 @@ endif ( )
# FIXME
# set ( ENABLE_CUDA false )
set ( ENABLE_CUDA true )

include ( SuiteSparsePolicy )

#-------------------------------------------------------------------------------
Expand Down Expand Up @@ -269,11 +268,13 @@ endif ( )

if ( CMAKE_CUDA_DEV )
# for CUDA development only; not for production use
file ( GLOB GRAPHBLAS_SOURCES "Source/*.c" "Source/Generated1/*.c"
"Source/Shared/*.c" )
file ( GLOB GRAPHBLAS_SOURCES "Source/*.c"
"Source/Shared/*.c"
"Source/Generated1/*.c" )
else ( )
file ( GLOB GRAPHBLAS_SOURCES "Source/*.c" "Source/Generated1/*.c"
"Source/Shared/*.c" "Source/Generated2/*.c" )
file ( GLOB GRAPHBLAS_SOURCES "Source/*.c"
"Source/Shared/*.c"
"Source/Generated1/*.c" "Source/Generated2/*.c" )
endif ( )

add_library ( graphblas SHARED ${GRAPHBLAS_SOURCES} )
Expand Down Expand Up @@ -458,6 +459,9 @@ if ( GLOBAL_INSTALL )
install ( TARGETS graphblas
LIBRARY DESTINATION ${CMAKE_INSTALL_LIBDIR}
PUBLIC_HEADER DESTINATION ${CMAKE_INSTALL_INCLUDEDIR} )
install ( FILES ${CMAKE_SOURCE_DIR}/cmake_modules/FindGraphBLAS.cmake
DESTINATION ${CMAKE_INSTALL_LIBDIR}/cmake/SuiteSparse
COMPONENT Development )
if ( NOT NSTATIC )
install ( TARGETS graphblas_static
ARCHIVE DESTINATION ${CMAKE_INSTALL_LIBDIR} )
Expand All @@ -472,6 +476,9 @@ if ( INSIDE_SUITESPARSE )
install ( TARGETS graphblas
LIBRARY DESTINATION ${SUITESPARSE_LIBDIR}
PUBLIC_HEADER DESTINATION ${SUITESPARSE_INCLUDEDIR} )
install ( FILES ${CMAKE_SOURCE_DIR}/cmake_modules/FindGraphBLAS.cmake
DESTINATION ${SUITESPARSE_LIBDIR}/cmake/SuiteSparse
COMPONENT Development )
if ( NOT NSTATIC )
install ( TARGETS graphblas_static
ARCHIVE DESTINATION ${SUITESPARSE_LIBDIR} )
Expand Down
2 changes: 1 addition & 1 deletion Config/README.md.in
Original file line number Diff line number Diff line change
Expand Up @@ -53,7 +53,7 @@ To remove all compiled files:

To compile and run the demos:

make demo
make demos

See the GraphBLAS/ subfolder for the Octave/MATLAB interface, which contains a
README.md file with further details.
Expand Down
Binary file modified Doc/GraphBLAS_UserGuide.pdf
Binary file not shown.
2 changes: 1 addition & 1 deletion Doc/GraphBLAS_UserGuide.tex
Original file line number Diff line number Diff line change
Expand Up @@ -14869,7 +14869,7 @@ \subsection{On Linux and Mac}
make CMAKE_OPTIONS='-DGBNCPUFEAT=1 -DGBAVX2=1' JOBS=40 \end{verbatim} }

After compiling the library, you can compile the demos with
\verb'make all' and then \verb'make demo' while in the top-level
\verb'make all' and then \verb'make demos' while in the top-level
GraphBLAS folder.

If \verb'cmake' or \verb'make' fail, it might be that your default compiler
Expand Down
2 changes: 1 addition & 1 deletion Makefile
Original file line number Diff line number Diff line change
Expand Up @@ -55,7 +55,7 @@ all:
( cd build && cmake $(CMAKE_OPTIONS) -DDEMO=1 .. && $(MAKE) --jobs=$(JOBS) )

# run the demos
demo: all
demos: all
( cd Demo && ./demo )

# just do 'make' in build; do not rerun the cmake script
Expand Down
2 changes: 1 addition & 1 deletion README.md
Original file line number Diff line number Diff line change
Expand Up @@ -53,7 +53,7 @@ To remove all compiled files:

To compile and run the demos:

make demo
make demos

See the GraphBLAS/ subfolder for the Octave/MATLAB interface, which contains a
README.md file with further details.
Expand Down
2 changes: 1 addition & 1 deletion alternative/Makefile
Original file line number Diff line number Diff line change
Expand Up @@ -142,7 +142,7 @@ DOBJ = $(DSRC2:.c=.o)
DEMO_PRG = $(notdir $(wildcard ../Demo/Program/*_demo.c))
DEMO = $(DEMO_PRG:.c=)

demo: $(DEMO)
demos: $(DEMO)
./altdemo

clean:
Expand Down
2 changes: 1 addition & 1 deletion alternative/README.txt
Original file line number Diff line number Diff line change
Expand Up @@ -35,5 +35,5 @@ to compile the static library: make static
to compile in parallel with 4 cores: make -j4
to install in /usr/local/*: sudo make install
to cleanup: make distclean
to compile and run the demos: make demo
to compile and run the demos: make demos

11 changes: 6 additions & 5 deletions cmake_modules/FindGraphBLAS.cmake
Original file line number Diff line number Diff line change
Expand Up @@ -72,11 +72,12 @@ find_library(
)

# get version of .so using REALPATH
get_filename_component(GRAPHBLAS_LIBRARY ${GRAPHBLAS_LIBRARY} REALPATH)
string(
REGEX MATCH "[0-9]+.[0-9]+.[0-9]+"
GRAPHBLAS_VERSION
${GRAPHBLAS_LIBRARY}
get_filename_component ( GRAPHBLAS_LIBRARY ${GRAPHBLAS_LIBRARY} REALPATH )
get_filename_component ( GRAPHBLAS_FILENAME ${GRAPHBLAS_LIBRARY} NAME )
string (
REGEX MATCH "[0-9]+.[0-9]+.[0-9]+"
GRAPHBLAS_VERSION
${GRAPHBLAS_FILENAME}
)
set(GRAPHBLAS_LIBRARIES ${GRAPHBLAS_LIBRARY})

Expand Down
18 changes: 17 additions & 1 deletion cmake_modules/SuiteSparsePolicy.cmake
Original file line number Diff line number Diff line change
Expand Up @@ -28,7 +28,9 @@
# NSTATIC: if true, static libraries are not built.
# Default is false, except for GraphBLAS, which
# takes a long time to compile so the default for
# GraphBLAS is true.
# 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
Expand All @@ -48,6 +50,20 @@ cmake_policy ( SET CMP0048 NEW ) # VERSION variable policy
cmake_policy ( SET CMP0054 NEW ) # if ( expression ) handling policy
cmake_policy ( SET CMP0104 NEW ) # initialize CUDA architectures

# look for cmake modules installed by prior compilations of SuiteSparse packages
set ( CMAKE_MODULE_PATH ${CMAKE_MODULE_PATH}
${CMAKE_SOURCE_DIR}/cmake_modules )

if ( SUITESPARSE_SECOND_LEVEL )
# some packages in SuiteSparse is in SuiteSparse/Package/Package
set ( CMAKE_MODULE_PATH ${CMAKE_MODULE_PATH}
${CMAKE_SOURCE_DIR}/../../lib/cmake )
else ( )
# most packages in SuiteSparse are located in SuiteSparse/Package
set ( CMAKE_MODULE_PATH ${CMAKE_MODULE_PATH}
${CMAKE_SOURCE_DIR}/../lib/cmake )
endif ( )

set ( CMAKE_MACOSX_RPATH TRUE )
enable_language ( C )
include ( GNUInstallDirs )
Expand Down
41 changes: 21 additions & 20 deletions cmake_modules/SuiteSparseReport.cmake
Original file line number Diff line number Diff line change
Expand Up @@ -9,38 +9,39 @@
# report status and compile flags
#-------------------------------------------------------------------------------

message ( STATUS
"----------------------------------------------------------------------------" )
message ( STATUS "------------------------------------------------------------------------" )
message ( STATUS "SuiteSparse CMAKE report for: ${CMAKE_PROJECT_NAME}" )
message ( STATUS
"----------------------------------------------------------------------------" )
message ( STATUS "------------------------------------------------------------------------" )
if ( GLOBAL_INSTALL )
message ( STATUS "install in ${CMAKE_INSTALL_PREFIX}: true" )
else ( )
message ( STATUS "install in ${CMAKE_INSTALL_PREFIX}: false" )
endif ( )
message ( STATUS "install in SuiteSparse/lib and SuiteSparse/include: ${INSIDE_SUITESPARSE}" )
message ( STATUS "build type: ${CMAKE_BUILD_TYPE}" )
message ( STATUS "have OpenMP: ${OPENMP_FOUND} ")
message ( STATUS "C compiler: ${CMAKE_C_COMPILER_ID} ")
message ( STATUS "C flags: ${CMAKE_C_FLAGS}" )
message ( STATUS "C++ compiler: ${CMAKE_CXX_COMPILER_ID}" )
message ( STATUS "C++ flags: ${CMAKE_CXX_FLAGS}" )
message ( STATUS "build type: ${CMAKE_BUILD_TYPE}" )
if ( NSTATIC )
message ( STATUS "build static library: no" )
else ( )
message ( STATUS "build static library: yes" )
endif ( )
message ( STATUS "have OpenMP: ${OPENMP_FOUND} ")
message ( STATUS "C compiler: ${CMAKE_C_COMPILER_ID} ")
message ( STATUS "C flags: ${CMAKE_C_FLAGS}" )
message ( STATUS "C++ compiler: ${CMAKE_CXX_COMPILER_ID}" )
message ( STATUS "C++ flags: ${CMAKE_CXX_FLAGS}" )
if ( ${CMAKE_BUILD_TYPE} STREQUAL "Debug" )
message ( STATUS "C Flags debug: ${CMAKE_C_FLAGS_DEBUG} ")
message ( STATUS "C++ Flags debug: ${CMAKE_CXX_FLAGS_DEBUG} ")
message ( STATUS "C Flags debug: ${CMAKE_C_FLAGS_DEBUG} ")
message ( STATUS "C++ Flags debug: ${CMAKE_CXX_FLAGS_DEBUG} ")
else ( )
message ( STATUS "C Flags release: ${CMAKE_C_FLAGS_RELEASE} ")
message ( STATUS "C++ Flags release: ${CMAKE_CXX_FLAGS_RELEASE} ")
message ( STATUS "C Flags release: ${CMAKE_C_FLAGS_RELEASE} ")
message ( STATUS "C++ Flags release: ${CMAKE_CXX_FLAGS_RELEASE} ")
endif ( )
get_property ( CDEFN DIRECTORY PROPERTY COMPILE_DEFINITIONS )
message ( STATUS "compile definitions: ${CDEFN}")
message ( STATUS "compile definitions: ${CDEFN}")
if ( DEFINED SuiteSparse_BLAS_integer )
message ( STATUS "BLAS integer: ${SuiteSparse_BLAS_integer}" )
message ( STATUS "BLAS integer: ${SuiteSparse_BLAS_integer}" )
endif ( )
if ( DEFINED CMAKE_CUDA_ARCHITECTURES )
message ( STATUS "CUDA architectures: ${CMAKE_CUDA_ARCHITECTURES}" )
message ( STATUS "CUDA architectures: ${CMAKE_CUDA_ARCHITECTURES}" )
endif ( )
message ( STATUS
"----------------------------------------------------------------------------" )

message ( STATUS "------------------------------------------------------------------------" )

0 comments on commit 244aa17

Please sign in to comment.