1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 28 29 30 31 32 33 34 35 36 37 38 39 40 41 42 43 44 45 46 47 48 49 50 51 52 53 54 55 56 57 58 59 60 61 62 63 64 65 66 67 68 69 70 71 72 73 74 75 76 77 78 79 80 81 82 83 84 85 86 87 88 89 90 91 92 93 94 95 96 97 98 99 100 101 102 103 104 105 106 107 108 109 110 111 112 113 114 115 116 117 118 119 120 121 122 123 124 125 126 127 128 129 130 131 132 133 134 135 136 137 138 139 140 141 142 143 144 145 146 147 148 149 150 151 152 153 154 155 156 157 158 159 160 161 162 163 164 165 166 167 168 169 170 171 172 173 174 175 176 177 178 179 180 181 182 183 184 185 186 187 188 189 190 191 192 193 194 195 196 197 198 199 200 201 202 203 204 205 206 207 208 209 210 211 212 213 214 215 216 217 218 219 220 221 222 223 224 225 226 227 228 229 230 231 232 233 234 235 236 237 238 239 240 241 242 243 244 245 246 247 248 249 250 251 252 253 254 255 256 257 258 259 260 261 262 263 264 265 266 267 268 269 270 271 272 273 274 275 276 277 278 279 280 281 282 283 284 285 286 287 288 289 290 291 292 293 294 295 296 297 298 299 300 301 302 303 304 305 306 307 308 309 310 311 312 313 314 315 316 317 318 319 320 321 322 323 324 325 326 327 328 329 330 331 332 333 334 335 336 337 338 339 340 341 342 343 344 345 346 347 348 349 350 351 352 353 354 355 356 357 358 359 360 361 362 363 364 365 366 367 368 369 370 371 372 373 374 375 376 377 378 379 380 381 382 383 384 385 386 387 388 389 390 391 392 393 394 395 396 397 398 399 400 401 402 403 404 405 406 407 408 409 410 411 412 413 414 415 416 417 418 419 420 421 422 423 424 425 426 427 428 429 430 431 432 433 434 435 436 437 438 439 440 441 442 443 444 445 446 447 448 449 450 451 452 453 454 455 456 457 458 459 460 461 462 463 464 465 466 467 468 469 470 471 472 473 474 475 476 477 478 479 480 481 482 483 484 485 486 487 488 489 490 491 492 493 494 495 496 497 498 499 500 501 502 503 504 505 506 507 508 509 510 511 512 513 514 515 516 517 518 519 520 521 522 523 524 525 526 527 528 529 530 531 532 533 534 535 536 537 538 539 540 541 542 543 544 545 546 547 548 549 550 551 552 553 554 555 556 557 558 559 560 561 562 563 564 565 566 567 568
|
#-------------------------------------------------------------------------------
# GraphBLAS/CMakeLists.txt: cmake script for GraphBLAS
#-------------------------------------------------------------------------------
# SuiteSparse:GraphBLAS, Timothy A. Davis, (c) 2017-2022, All Rights Reserved.
# SPDX-License-Identifier: Apache-2.0
# See the User Guide for details on how to compile SuiteSparse:GraphBLAS.
#-------------------------------------------------------------------------------
# get the version
#-------------------------------------------------------------------------------
# cmake 3.13 is required; cmake 3.17 or later required for CUDA
cmake_minimum_required ( VERSION 3.13 )
message ( STATUS "GrapphBLAS source: " ${CMAKE_SOURCE_DIR} )
message ( STATUS "GrapphBLAS build: " ${CMAKE_BINARY_DIR} )
message ( STATUS "CMake version: " ${CMAKE_VERSION} )
if ( CMAKE_VERSION VERSION_GREATER "3.0" )
cmake_policy ( SET CMP0042 NEW )
cmake_policy ( SET CMP0048 NEW )
cmake_policy ( SET CMP0054 NEW )
endif ( )
set ( CMAKE_MACOSX_RPATH TRUE )
# version of SuiteSparse:GraphBLAS
set ( GraphBLAS_DATE "Apr 8, 2022" )
set ( GraphBLAS_VERSION_MAJOR 7 )
set ( GraphBLAS_VERSION_MINOR 0 )
set ( GraphBLAS_VERSION_SUB 3 )
message ( STATUS "Building SuiteSparse:GraphBLAS version: v" ${GraphBLAS_VERSION_MAJOR}.${GraphBLAS_VERSION_MINOR}.${GraphBLAS_VERSION_SUB} " date: " ${GraphBLAS_DATE} )
# GraphBLAS C API Specification version, at graphblas.org
if ( GraphBLAS_VERSION_MAJOR GREATER_EQUAL 6 )
# SuiteSparse:GraphBLAS v6.0.0 and later fully implement the v2 spec
set ( GraphBLAS_API_DATE "Nov 15, 2021" )
set ( GraphBLAS_API_VERSION_MAJOR 2 )
set ( GraphBLAS_API_VERSION_MINOR 0 )
set ( GraphBLAS_API_VERSION_SUB 0 )
else ( )
# SuiteSparse:GraphBLAS v5.2.0 has much of the v2 spec but not all.
# It is backward compatible with all v5.x which have little of the new
# features of the v2 C API Specification.
set ( GraphBLAS_API_DATE "Sept 25, 2019" )
set ( GraphBLAS_API_VERSION_MAJOR 1 )
set ( GraphBLAS_API_VERSION_MINOR 3 )
set ( GraphBLAS_API_VERSION_SUB 0 )
endif ( )
message ( STATUS "GraphBLAS C API: v" "${GraphBLAS_API_VERSION_MAJOR}.${GraphBLAS_API_VERSION_MINOR}, date: ${GraphBLAS_API_DATE}" )
#-------------------------------------------------------------------------------
# find CUDA
#-------------------------------------------------------------------------------
# TODO: use something like this:
# if ( set some flag to ignore cuda )
# set ( CMAKE_CUDA off )
# message ( STATUS "CUDA: disabled" )
# elseif ( ${CMAKE_VERSION} VERSION_LESS "3.17.0" )
# ...
if ( ${CMAKE_VERSION} VERSION_LESS "3.17.0" )
# CUDA requires cmake 3.17 or later
set ( CMAKE_CUDA off )
message ( STATUS "CUDA: not enabled (cmake 3.17.0 or later required)" )
else ( )
# try finding CUDA
project ( graphblas LANGUAGES C )
include ( CheckLanguage )
check_language ( CUDA )
message ( STATUS "Looking for CUDA" )
if ( CMAKE_CUDA_COMPILER )
# with CUDA:
message ( STATUS "Find CUDA tool kit:" )
# FindCUDAToolKit needs to have C or CXX enabled first
# now C is enabled so FindCudaToolKit will work
include ( FindCUDAToolkit )
message ( STATUS "CUDA toolkit found: " ${CUDAToolkit_FOUND} )
message ( STATUS "CUDA toolkit version: " ${CUDAToolkit_VERSION} )
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 ( CMAKE_CUDA off )
else ( )
# CUDA 11.2 or later present
enable_language ( CUDA )
set ( CMAKE_CUDA on )
endif ( )
else ( )
# without CUDA:
message ( STATUS "CUDA: not found" )
set ( CMAKE_CUDA off )
endif ( )
endif ( )
# CUDA is under development for now, and not deployed in production:
set ( CMAKE_CUDA off)
# Edit these lines for code development only, not for end-users:
# set ( CMAKE_BUILD_TYPE Debug )
if ( CMAKE_CUDA )
# for CUDA development only; not for production use
set ( CMAKE_CUDA_DEV on )
project ( graphblas
VERSION "${GraphBLAS_VERSION_MAJOR}.${GraphBLAS_VERSION_MINOR}.${GraphBLAS_VERSION_SUB}"
LANGUAGES CUDA C )
else ( )
set ( CMAKE_CUDA_DEV off )
project ( graphblas
VERSION "${GraphBLAS_VERSION_MAJOR}.${GraphBLAS_VERSION_MINOR}.${GraphBLAS_VERSION_SUB}"
LANGUAGES C )
endif ( )
#-------------------------------------------------------------------------------
# find OpenMP, CUDA, RMM, and cpu_features
#-------------------------------------------------------------------------------
find_package ( OpenMP )
if ( CMAKE_CUDA )
set ( CMAKE_CUDA_FLAG " -DGBCUDA" )
add_subdirectory ( CUDA )
set ( GB_CUDA graphblascuda ${CUDA_LIBRARIES} )
link_directories ( "CUDA" ${CUDA_LIBRARIES} )
else ( )
set ( CMAKE_CUDA_FLAG " " )
set ( GB_CUDA )
endif ( )
if ( CMAKE_CUDA )
message ( STATUS "CUDA: enabled" )
set ( CMAKE_RMM_FLAG " -DGBRMM" )
set ( GB_RMM rmm_wrap ${CUDA_LIBRARIES} stdc++ )
add_subdirectory ( rmm_wrap )
include_directories ( "rmm_wrap" ${CUDA_INCLUDE_DIRS} )
link_directories ( "CUDA" "${CUDA_LIBRARIES}" "/usr/local/cuda/lib64/stubs" "rmm_wrap" )
else ( )
message ( STATUS "CUDA: not enabled" )
set ( CMAKE_RMM_FLAG " " )
set ( GB_RMM )
endif ( )
if ( NOT GBNCPUFEAT )
# default: enable Google's cpu_features package
message ( STATUS "cpu_features (by google.com): enabled " )
include_directories ( "cpu_features/include" "cpu_features" "cpu_features/src" "cpu_features/include/internal" )
else ( )
# disable Google's cpu_features package
message ( STATUS "cpu_features (by google.com): disabled" )
set ( CMAKE_C_FLAGS "${CMAKE_C_FLAGS} -DGBNCPUFEAT " )
endif ( )
if ( DEFINED GBX86 )
# default: this is detected automatically, but can be set here also
if ( GBX86 )
set ( CMAKE_C_FLAGS "${CMAKE_C_FLAGS} -DGBX86=1 " )
else ( )
set ( CMAKE_C_FLAGS "${CMAKE_C_FLAGS} -DGBX86=0 " )
endif ( )
endif ( )
if ( DEFINED GBAVX2 )
# default: this is detected automatically, but can be set here also
if ( GBAVX2 )
set ( CMAKE_C_FLAGS "${CMAKE_C_FLAGS} -DGBAVX2=1 " )
else ( )
set ( CMAKE_C_FLAGS "${CMAKE_C_FLAGS} -DGBAVX2=0 " )
endif ( )
endif ( )
if ( DEFINED GBAVX512F )
# default: this is detected automatically, but can be set here also
if ( GBAVX512F )
set ( CMAKE_C_FLAGS "${CMAKE_C_FLAGS} -DGBAVX512F=1 " )
else ( )
set ( CMAKE_C_FLAGS "${CMAKE_C_FLAGS} -DGBAVX512F=0 " )
endif ( )
endif ( )
#-------------------------------------------------------------------------------
# determine build type
#-------------------------------------------------------------------------------
include ( GNUInstallDirs )
if ( NOT CMAKE_BUILD_TYPE )
set ( CMAKE_BUILD_TYPE Release )
endif ( )
# select "true" to build both dynamic and static libraries:
# set ( BUILD_GRB_STATIC_LIBRARY true )
# set ( BUILD_GRB_STATIC_LIBRARY false )
# or use cmake with -DBUILD_GRB_STATIC_LIBRARY=1
if ( BUILD_GRB_STATIC_LIBRARY )
message ( STATUS "Building all GraphBLAS libraries (static and dynamic)" )
else ( )
message ( STATUS "Building dynamic GraphBLAS library" )
endif ( )
if ( CMAKE_CUDA_DEV )
# for CUDA development only; not for production use
set ( CMAKE_C_FLAGS "${CMAKE_C_FLAGS} -DGBCUDA_DEV=1 " )
endif ( )
#-------------------------------------------------------------------------------
# Configure Include/GraphBLAS.h and documentation with version number
#-------------------------------------------------------------------------------
configure_file (
"Config/GraphBLAS.h.in"
"${PROJECT_SOURCE_DIR}/Include/GraphBLAS.h"
)
configure_file (
"Config/GraphBLAS_version.tex.in"
"${PROJECT_SOURCE_DIR}/Doc/GraphBLAS_version.tex"
)
configure_file (
"Config/GraphBLAS_API_version.tex.in"
"${PROJECT_SOURCE_DIR}/Doc/GraphBLAS_API_version.tex"
)
configure_file (
"Config/README.md.in"
"${PROJECT_SOURCE_DIR}/README.md"
)
#-------------------------------------------------------------------------------
# report status
#-------------------------------------------------------------------------------
message ( STATUS "CMAKE build type: " ${CMAKE_BUILD_TYPE} )
if ( ${CMAKE_BUILD_TYPE} STREQUAL "Debug" )
message ( STATUS "CMAKE C Flags debug: " ${CMAKE_C_FLAGS_DEBUG} )
else ( )
message ( STATUS "CMAKE C Flags release: " ${CMAKE_C_FLAGS_RELEASE} )
endif ( )
message ( STATUS "CMAKE compiler ID: " ${CMAKE_C_COMPILER_ID} )
message ( STATUS "CMAKE have OpenMP: " ${OPENMP_FOUND} )
#-------------------------------------------------------------------------------
# include directories for both graphblas and graphblasdemo libraries
#-------------------------------------------------------------------------------
set ( CMAKE_INCLUDE_CURRENT_DIR ON )
if ( CMAKE_CUDA_DEV )
# for CUDA development only; not for production use
include_directories ( Source/Template Source Include Source/Generated1 lz4 Demo/Include rmm_wrap )
else ( )
include_directories ( Source/Template Source Include Source/Generated1 lz4 Source/Generated2 Demo/Include rmm_wrap )
endif ( )
#-------------------------------------------------------------------------------
# compiler options
#-------------------------------------------------------------------------------
# check which compiler is being used. If you need to make
# compiler-specific modifications, here is the place to do it.
if ( "${CMAKE_C_COMPILER_ID}" STREQUAL "GNU" )
# The -g option is useful for the Intel VTune tool, but it should be
# removed in production. Comment this line out if not in use:
# set ( CMAKE_C_FLAGS "${CMAKE_C_FLAGS} -g" )
# cmake 2.8 workaround: gcc needs to be told to do ANSI C11.
# cmake 3.0 doesn't have this problem.
set ( CMAKE_C_FLAGS "${CMAKE_C_FLAGS} -std=c11 -lm -Wno-pragmas " )
# operations may be carried out in higher precision
set ( CMAKE_C_FLAGS "${CMAKE_C_FLAGS} -fexcess-precision=fast " )
# faster single complex multiplication and division
set ( CMAKE_C_FLAGS "${CMAKE_C_FLAGS} -fcx-limited-range " )
# math functions do not need to report errno
set ( CMAKE_C_FLAGS "${CMAKE_C_FLAGS} -fno-math-errno " )
# integer operations wrap
set ( CMAKE_C_FLAGS "${CMAKE_C_FLAGS} -fwrapv " )
# check all warnings (uncomment for development only)
# set ( CMAKE_C_FLAGS "${CMAKE_C_FLAGS} -Wall -Wextra -Wpedantic -Werror " )
if ( CMAKE_C_COMPILER_VERSION VERSION_LESS 4.9 )
message ( FATAL_ERROR "gcc version must be at least 4.9" )
endif ( )
elseif ( "${CMAKE_C_COMPILER_ID}" STREQUAL "Intel" )
# options for icc: also needs -std=c11
set ( CMAKE_C_FLAGS "${CMAKE_C_FLAGS} -diag-disable 10397,15552 " )
set ( CMAKE_C_FLAGS "${CMAKE_C_FLAGS} -qopt-report=5 -qopt-report-phase=vec" )
# the -mp1 option is important for predictable floating-point results with
# the icc compiler. Without, ((float) 1.)/((float) 0.) produces NaN,
# instead of the correct result, Inf.
set ( CMAKE_C_FLAGS "${CMAKE_C_FLAGS} -std=c11 -mp1" )
# The -g option is useful for the Intel VTune tool, but it should be
# removed in production. Comment this line out if not in use:
# set ( CMAKE_C_FLAGS "${CMAKE_C_FLAGS} -g" )
# set ( CMAKE_C_FLAGS "${CMAKE_C_FLAGS} -qopt-malloc-options=3" )
# check all warnings and remarks (uncomment for development only):
# set ( CMAKE_C_FLAGS "${CMAKE_C_FLAGS} -w3 -Wremarks -Werror " )
if ( CMAKE_C_COMPILER_VERSION VERSION_LESS 19.0 )
message ( FATAL_ERROR "icc version must be at least 19.0" )
endif ( )
elseif ( "${CMAKE_C_COMPILER_ID}" STREQUAL "IntelLLVM" )
# options for icx
elseif ( "${CMAKE_C_COMPILER_ID}" STREQUAL "Clang" )
# options for clang
set ( CMAKE_C_FLAGS "${CMAKE_C_FLAGS} -Wno-pointer-sign " )
if ( CMAKE_C_COMPILER_VERSION VERSION_LESS 3.3 )
message ( FATAL_ERROR "clang version must be at least 3.3" )
endif ( )
elseif ( "${CMAKE_C_COMPILER_ID}" STREQUAL "MSVC" )
# options for MicroSoft Visual Studio
set ( CMAKE_C_FLAGS "${CMAKE_C_FLAGS} /O2 -wd\"4244\" -wd\"4146\" -wd\"4018\" -wd\"4996\" -wd\"4047\" -wd\"4554\"" )
elseif ( "${CMAKE_C_COMPILER_ID}" STREQUAL "PGI" )
# options for PGI pgcc compiler. The compiler has a bug, and the
# -DPGI_COMPILER_BUG causes GraphBLAS to use a workaround.
set ( CMAKE_C_FLAGS "${CMAKE_C_FLAGS} -Mnoopenmp -noswitcherror -c11 -lm -DPGI_COMPILER_BUG" )
set ( CMAKE_CXX_FLAGS "${CMAKE_C_FLAGS} -Mnoopenmp -D__GCC_ATOMIC_TEST_AND_SET_TRUEVAL=1 -noswitcherror --c++11 -lm -DPGI_COMPILER_BUG" )
endif ( )
if ( ${CMAKE_BUILD_TYPE} STREQUAL "Debug" )
set ( CMAKE_C_FLAGS "${CMAKE_C_FLAGS} ${CMAKE_C_FLAGS_DEBUG}" )
else ( )
set ( CMAKE_C_FLAGS "${CMAKE_C_FLAGS} ${CMAKE_C_FLAGS_RELEASE}" )
endif ( )
set ( CMAKE_C_FLAGS "${CMAKE_C_FLAGS} ${CMAKE_CUDA_FLAG}" )
#-------------------------------------------------------------------------------
# dynamic graphblas library properties
#-------------------------------------------------------------------------------
# Notes from Sebastien Villemot (sebastien@debian.org):
# SOVERSION policy: if a binary compiled against the old version of the shared
# library needs recompiling in order to work with the new version, then a
# SO_VERSION increase # is needed. Otherwise not. Examples of the changes that
# require a SO_VERSION increase:
#
# - a public function or static variable is removed
# - the prototype of a public function changes
# - the integer value attached to a public #define or enum changes
# - the fields of a public structure are modified
#
# Examples of changes that do not require a SO_VERSION increase:
#
# - a new public function or static variable is added
# - a private function or static variable is removed or modified
# - changes in the internals of a structure that is opaque to the calling
# program (i.e. is only a pointer manipulated through public functions of
# the library)
# - a public enum is extended (by adding a new item at the end, but without
# changing the already existing items)
if ( CMAKE_CUDA_DEV )
# for CUDA development only; not for production use
file ( GLOB GRAPHBLAS_SOURCES "Source/*.c" "Source/Generated1/*.c" )
else ( )
file ( GLOB GRAPHBLAS_SOURCES "Source/*.c" "Source/Generated1/*.c" "Source/Generated2/*.c" )
endif ( )
add_library ( graphblas SHARED ${GRAPHBLAS_SOURCES} )
SET_TARGET_PROPERTIES ( graphblas PROPERTIES
VERSION ${GraphBLAS_VERSION_MAJOR}.${GraphBLAS_VERSION_MINOR}.${GraphBLAS_VERSION_SUB}
SOVERSION ${GraphBLAS_VERSION_MAJOR}
C_STANDARD_REQUIRED 11
PUBLIC_HEADER "Include/GraphBLAS.h" )
set_property ( TARGET graphblas PROPERTY C_STANDARD 11 )
if ( CMAKE_CUDA )
add_dependencies ( graphblas graphblascuda )
add_dependencies ( graphblas rmm_wrap )
endif ( )
#-------------------------------------------------------------------------------
# static graphblas library properties
#-------------------------------------------------------------------------------
if ( BUILD_GRB_STATIC_LIBRARY )
add_library ( graphblas_static STATIC ${GRAPHBLAS_SOURCES} )
SET_TARGET_PROPERTIES ( graphblas_static PROPERTIES
VERSION ${GraphBLAS_VERSION_MAJOR}.${GraphBLAS_VERSION_MINOR}.${GraphBLAS_VERSION_SUB}
OUTPUT_NAME graphblas
SOVERSION ${GraphBLAS_VERSION_MAJOR}
C_STANDARD_REQUIRED 11
PUBLIC_HEADER "Include/GraphBLAS.h" )
set_property ( TARGET graphblas_static PROPERTY C_STANDARD 11 )
if ( CMAKE_CUDA )
add_dependencies ( graphblas_static graphblascuda )
add_dependencies ( graphblas_static rmm_wrap )
endif ( )
endif ( )
#-------------------------------------------------------------------------------
# cpu_features settings
#-------------------------------------------------------------------------------
if ( NOT GBNCPUFEAT )
if ( UNIX )
# look for requirements for cpu_features/src/hwcaps.c
include ( CheckIncludeFile )
include ( CheckSymbolExists )
check_include_file ( dlfcn.h HAVE_DLFCN_H )
if ( HAVE_DLFCN_H )
target_compile_definitions ( graphblas PRIVATE HAVE_DLFCN_H )
if ( BUILD_GRB_STATIC_LIBRARY )
target_compile_definitions ( graphblas_static PRIVATE HAVE_DLFCN_H )
endif ( )
endif ( )
check_symbol_exists ( getauxval "sys/auxv.h" HAVE_STRONG_GETAUXVAL )
if ( HAVE_STRONG_GETAUXVAL )
target_compile_definitions ( graphblas PRIVATE HAVE_STRONG_GETAUXVAL )
if ( BUILD_GRB_STATIC_LIBRARY )
target_compile_definitions ( graphblas_static PRIVATE HAVE_STRONG_GETAUXVAL )
endif ( )
endif ( )
endif ( )
endif ( )
#-------------------------------------------------------------------------------
# select the math library (not required for Microsoft Visual Studio)
#-------------------------------------------------------------------------------
if ( "${CMAKE_C_COMPILER_ID}" STREQUAL "MSVC" )
set ( M_LIB "" )
else ( )
set ( M_LIB "m" )
endif ( )
target_link_libraries ( graphblas PUBLIC ${M_LIB} )
if ( BUILD_GRB_STATIC_LIBRARY )
target_link_libraries ( graphblas_static PUBLIC ${M_LIB} )
endif ( )
#-------------------------------------------------------------------------------
# add the OpenMP, IPP, CUDA, BLAS, etc libraries
#-------------------------------------------------------------------------------
if ( OPENMP_FOUND )
message ( STATUS "CMAKE OpenMP libraries: " ${OpenMP_C_LIBRARIES} )
message ( STATUS "CMAKE OpenMP include: " ${OpenMP_C_INCLUDE_DIRS} )
target_link_libraries ( graphblas PUBLIC ${OpenMP_C_LIBRARIES} )
if ( BUILD_GRB_STATIC_LIBRARY )
target_link_libraries ( graphblas_static PUBLIC ${OpenMP_C_LIBRARIES} )
endif ( )
message ( STATUS "CMAKE OpenMP C flags: " ${OpenMP_C_FLAGS} )
set ( CMAKE_C_FLAGS "${CMAKE_C_FLAGS} ${OpenMP_C_FLAGS} " )
include_directories ( ${OpenMP_C_INCLUDE_DIRS} )
endif ( )
if ( CMAKE_CUDA )
target_link_libraries ( graphblas PUBLIC ${GB_CUDA} ${GB_RMM} )
if ( BUILD_GRB_STATIC_LIBRARY )
target_link_libraries ( graphblas_static PUBLIC ${GB_CUDA} ${GB_RMM} )
endif ( )
endif ( )
#-------------------------------------------------------------------------------
# print final C flags
#-------------------------------------------------------------------------------
message ( STATUS "CMAKE C flags: " ${CMAKE_C_FLAGS} )
#-------------------------------------------------------------------------------
# Demo library and programs
#-------------------------------------------------------------------------------
if ( DEMO )
#---------------------------------------------------------------------------
# demo library
#---------------------------------------------------------------------------
message ( STATUS "Also compiling the demos in GraphBLAS/Demo" )
file ( GLOB DEMO_SOURCES "Demo/Source/*.c" )
add_library ( graphblasdemo SHARED ${DEMO_SOURCES} )
SET_TARGET_PROPERTIES ( graphblasdemo PROPERTIES
VERSION ${GraphBLAS_VERSION_MAJOR}.${GraphBLAS_VERSION_MINOR}.${GraphBLAS_VERSION_SUB}
SOVERSION ${GraphBLAS_VERSION_MAJOR}
C_STANDARD_REQUIRED 11 )
set_property ( TARGET graphblasdemo PROPERTY C_STANDARD 11 )
target_link_libraries ( graphblasdemo PUBLIC ${M_LIB} graphblas ${GB_CUDA} ${GB_RMM} )
if ( BUILD_GRB_STATIC_LIBRARY )
add_library ( graphblasdemo_static STATIC ${DEMO_SOURCES} )
SET_TARGET_PROPERTIES ( graphblasdemo_static PROPERTIES
VERSION ${GraphBLAS_VERSION_MAJOR}.${GraphBLAS_VERSION_MINOR}.${GraphBLAS_VERSION_SUB}
C_STANDARD_REQUIRED 11 )
set_property ( TARGET graphblasdemo_static PROPERTY C_STANDARD 11 )
target_link_libraries ( graphblasdemo_static PUBLIC graphblas_static ${GB_CUDA} ${GB_RMM} )
endif ( )
#---------------------------------------------------------------------------
# Demo programs
#---------------------------------------------------------------------------
add_executable ( openmp_demo "Demo/Program/openmp_demo.c" )
add_executable ( complex_demo "Demo/Program/complex_demo.c" )
add_executable ( kron_demo "Demo/Program/kron_demo.c" )
add_executable ( simple_demo "Demo/Program/simple_demo.c" )
add_executable ( wildtype_demo "Demo/Program/wildtype_demo.c" )
add_executable ( reduce_demo "Demo/Program/reduce_demo.c" )
add_executable ( import_demo "Demo/Program/import_demo.c" )
add_executable ( wathen_demo "Demo/Program/wathen_demo.c" )
# Libraries required for Demo programs
target_link_libraries ( openmp_demo PUBLIC graphblas graphblasdemo ${GB_CUDA} ${GB_RMM} )
target_link_libraries ( complex_demo PUBLIC graphblas graphblasdemo ${GB_CUDA} ${GB_RMM} )
target_link_libraries ( kron_demo PUBLIC graphblas graphblasdemo ${GB_CUDA} ${GB_RMM} )
target_link_libraries ( simple_demo PUBLIC graphblasdemo ${GB_CUDA} ${GB_RMM} )
target_link_libraries ( wildtype_demo PUBLIC graphblas ${GB_CUDA} ${GB_RMM} )
target_link_libraries ( reduce_demo PUBLIC graphblas ${GB_CUDA} ${GB_RMM} )
target_link_libraries ( import_demo PUBLIC graphblas graphblasdemo ${GB_CUDA} ${GB_RMM} )
target_link_libraries ( wathen_demo PUBLIC graphblas graphblasdemo ${GB_CUDA} ${GB_RMM} )
else ( )
message ( STATUS "Skipping the demos in GraphBLAS/Demo" )
endif ( )
#-------------------------------------------------------------------------------
# graphblas installation location
#-------------------------------------------------------------------------------
if ( BUILD_GRB_STATIC_LIBRARY )
# install both the dynamic and static libraries
install ( TARGETS graphblas graphblas_static
LIBRARY DESTINATION ${CMAKE_INSTALL_LIBDIR}
PUBLIC_HEADER DESTINATION ${CMAKE_INSTALL_INCLUDEDIR}
ARCHIVE DESTINATION ${CMAKE_INSTALL_LIBDIR} )
else ( )
# only install the dynamic graphblas library
install ( TARGETS graphblas
LIBRARY DESTINATION ${CMAKE_INSTALL_LIBDIR}
PUBLIC_HEADER DESTINATION ${CMAKE_INSTALL_INCLUDEDIR}
ARCHIVE DESTINATION ${CMAKE_INSTALL_LIBDIR} )
endif ( )
#-------------------------------------------------------------------------------
# dump all variables, for debugging only
#-------------------------------------------------------------------------------
# uncomment this line to dump all cmake variables:
# set ( DUMP true )
if ( DUMP )
get_cmake_property ( _variableNames VARIABLES )
list ( SORT _variableNames )
foreach ( _variableName ${_variableNames} )
message ( STATUS "${_variableName}=${${_variableName}}" )
endforeach ( )
endif ( )
|