File: CMakeLists.txt

package info (click to toggle)
combblas 2.0.0-6
  • links: PTS, VCS
  • area: main
  • in suites: forky, sid, trixie
  • size: 190,476 kB
  • sloc: cpp: 55,912; ansic: 25,134; sh: 3,691; makefile: 548; csh: 66; python: 49; perl: 21
file content (126 lines) | stat: -rw-r--r-- 4,581 bytes parent folder | download
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
cmake_minimum_required(VERSION 3.3)
project(CombBLAS VERSION 2.0.0 LANGUAGES C CXX)

# require c++14
set(CMAKE_CXX_STANDARD 14)
set(CMAKE_CXX_STANDARD_REQUIRED YES)
set(CMAKE_CXX_EXTENSIONS OFF)

# Main CombBLAS library
add_library(CombBLAS src/CommGrid.cpp src/mmio.c src/MPIType.cpp src/MPIOp.cpp src/MemoryPool.cpp src/hash.cpp)

# require c++14 in CombBLAS interface
if("cxx_std_14" IN_LIST CMAKE_CXX_COMPILE_FEATURES) # Use language feature if available (CMake >= 3.8)
  target_compile_features(CombBLAS PUBLIC cxx_std_14)
else()
  # Use C++14-specific features for CMake >= 3.3, which will force the appropriate language level flags.
  target_compile_features(CombBLAS PUBLIC cxx_return_type_deduction)
endif()

# set include directories
include(GNUInstallDirs)
target_include_directories(CombBLAS PUBLIC $<BUILD_INTERFACE:${CMAKE_CURRENT_SOURCE_DIR}/include> $<INSTALL_INTERFACE:include>)
target_include_directories(CombBLAS PUBLIC $<BUILD_INTERFACE:${CMAKE_CURRENT_SOURCE_DIR}/psort-1.0/include> $<INSTALL_INTERFACE:include>)
target_include_directories(CombBLAS PRIVATE include/CombBLAS)

# MPI and OpenMP dependencies
find_package(MPI REQUIRED)
find_package(OpenMP)

if(TARGET MPI::MPI_CXX) # Use target if available (CMake >= 3.9)
  target_link_libraries(CombBLAS PUBLIC MPI::MPI_CXX)
else()
  target_compile_options(CombBLAS PUBLIC "${MPI_CXX_COMPILE_FLAGS}")
  target_link_libraries(CombBLAS PUBLIC "${MPI_CXX_LIBRARIES}" "${MPI_CXX_LINKFLAGS}")
  target_include_directories(CombBLAS PUBLIC "${MPI_CXX_INCLUDE_PATH}")
endif()

if(TARGET OpenMP::OpenMP_CXX) # Use target if available (CMake >= 3.9)
  target_compile_definitions(CombBLAS PUBLIC THREADED)
  target_link_libraries(CombBLAS PUBLIC OpenMP::OpenMP_CXX)
elseif(OPENMP_FOUND)
  target_compile_definitions(CombBLAS PUBLIC THREADED)
  target_compile_options(CombBLAS PUBLIC "${OpenMP_CXX_FLAGS}")
  target_link_libraries(CombBLAS PUBLIC "${OpenMP_CXX_FLAGS}")
endif()

add_subdirectory(usort)
target_link_libraries(CombBLAS PUBLIC Usortlib)
set_property(TARGET Usortlib PROPERTY VERSION "${CMAKE_PROJECT_NAME}_${CMAKE_PROJECT_VERSION}")

add_subdirectory(graph500-1.2/generator)
target_link_libraries(CombBLAS PUBLIC GraphGenlib)
set_property(TARGET GraphGenlib PROPERTY VERSION "${CMAKE_PROJECT_NAME}_${CMAKE_PROJECT_VERSION}")

# Set up exported configuration
# This allows CombBLAS to be installed in two ways:
#   1. In /usr/local (or whatever prefix is specified)
#   2. Exporting the current build directory. This allows a user to make
#      modifications to CombBLAS and have the changes automatically recompiled for
#      dependent projects.
# Either way, we need to create a CombBLASConfig.cmake.
set(ConfigPackageLocation ${CMAKE_INSTALL_LIBDIR}/cmake/CombBLAS)

# Generate version number header
include(GenerateExportHeader)
generate_export_header(CombBLAS)
set_target_properties(CombBLAS PROPERTIES VERSION ${CombBLAS_VERSION})

# installation
install(DIRECTORY include/ DESTINATION ${CMAKE_INSTALL_INCLUDEDIR})
install(DIRECTORY psort-1.0/include/ DESTINATION ${CMAKE_INSTALL_INCLUDEDIR})
install(TARGETS CombBLAS EXPORT CombBLASTargets
        LIBRARY DESTINATION ${CMAKE_INSTALL_LIBDIR}
        ARCHIVE DESTINATION ${CMAKE_INSTALL_LIBDIR}
        RUNTIME DESTINATION ${CMAKE_INSTALL_BINDIR}
        INCLUDES DESTINATION ${CMAKE_INSTALL_INCLUDEDIR}
        )

include(CMakePackageConfigHelpers)

write_basic_package_version_file(
    "${CMAKE_CURRENT_BINARY_DIR}/CombBLAS/CombBLASConfigVersion.cmake"
    VERSION ${CombBLAS_VERSION}
    COMPATIBILITY AnyNewerVersion
)

# The following commands allow for option 2.
export(EXPORT CombBLASTargets
       FILE "${CMAKE_CURRENT_BINARY_DIR}/CombBLAS/CombBLASTargets.cmake"
       NAMESPACE CombBLAS::
       )
configure_file(cmake/CombBLASConfig.cmake
               "${CMAKE_CURRENT_BINARY_DIR}/CombBLAS/CombBLASConfig.cmake"
               COPYONLY
               )

# Allow for option 2
install(EXPORT CombBLASTargets
        FILE
        CombBLASTargets.cmake
        NAMESPACE
        CombBLAS::
        DESTINATION
        ${ConfigPackageLocation}
        )
export(PACKAGE CombBLAS)
install(
    FILES
    cmake/CombBLASConfig.cmake
    "${CMAKE_CURRENT_BINARY_DIR}/CombBLAS/CombBLASConfigVersion.cmake"
    DESTINATION
    ${ConfigPackageLocation}
    COMPONENT
    Devel
)

# Testing
enable_testing()
include(CTest)

add_subdirectory(ReleaseTests)
add_subdirectory(Applications)
add_subdirectory(Applications/Ordering)
add_subdirectory(Applications/BipartiteMatchings)
add_subdirectory(Applications/SpMSpV-IPDPS2017)
add_subdirectory(3DSpGEMM)