-
Notifications
You must be signed in to change notification settings - Fork 5
/
CMakeLists.txt
154 lines (128 loc) · 4.52 KB
/
CMakeLists.txt
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
cmake_minimum_required(VERSION 3.12)
list(APPEND CMAKE_MODULE_PATH
${CMAKE_CURRENT_LIST_DIR}/cmake
"${CMAKE_CURRENT_LIST_DIR}/cmake/third_party"
)
include(DownloadProject)
set(LBC_ROOT_DIR ${CMAKE_CURRENT_LIST_DIR})
set(CMAKE_ARCHIVE_OUTPUT_DIRECTORY ${CMAKE_CURRENT_LIST_DIR}/lib/)
set(CMAKE_LIBRARY_OUTPUT_DIRECTORY ${CMAKE_CURRENT_LIST_DIR}/lib/)
set(LBC_EXTERNAL ${CMAKE_CURRENT_LIST_DIR}/external/)
project(LBC_lib CXX C)
set(CMAKE_CXX_STANDARD 11)
set(CMAKE_C_FLAGS "${CMAKE_C_FLAGS} -fPIC")
get_directory_property(HAS_PARENT PARENT_DIRECTORY)
if(HAS_PARENT)
set(LBC_IS_TOPLEVEL OFF)
else()
set(LBC_IS_TOPLEVEL ON)
endif()
option(LBC_BUILD_EXAMPLES "Build LBC Examples" ${LBC_IS_TOPLEVEL})
option(LBC_BUILD_TESTS "Build LBC TESTs" ${LBC_IS_TOPLEVEL})
option(LBC_PROFILING "Build LBC Profiling Routines" ${LBC_IS_TOPLEVEL})
#TODO: remove mmio and use the sparse_io in smp repo
add_compile_options(-Wno-write-strings)
add_compile_options(-Wunused-result)
set(SPARSE_UTIL_SRC "${CMAKE_CURRENT_SOURCE_DIR}/utils")
set(LBC_INC "${CMAKE_CURRENT_SOURCE_DIR}/include")
set(LBC_SRC "${CMAKE_CURRENT_SOURCE_DIR}/src")
AUX_SOURCE_DIRECTORY(${LBC_SRC} LBC_SRC_FILES)
set(Sparse_TRSV_INC "${CMAKE_CURRENT_SOURCE_DIR}/example/sptrsv_src/include")
set(Sparse_TRSV_SRC "${CMAKE_CURRENT_SOURCE_DIR}/example/sptrsv_src/")
AUX_SOURCE_DIRECTORY(${Sparse_TRSV_SRC} Sparse_TRSV_SRC_FILES)
################################################################################
# HDagg
################################################################################
#Project options
option(HDAGG_WITH_SPMP "Use SpMP library with HDAGG" OFF)
option(HDAGG_WITH_DAGP "Add DAGP for benchmarking" OFF)
option(HDAGG_WITH_MKL "Add DAGP for benchmarking" OFF)
file(GLOB HDAGG_SRCFILES
"src/hdagg/*.cpp"
)
################################################################################
#find_package(OpenMP)
if(OpenMP_FOUND)
if(APPLE) #TODO: there might be a better support
set(OpenMP_CXX_INCLUDE_DIRS "/usr/local/include/")
endif()
include_directories(
${OpenMP_CXX_INCLUDE_DIRS}
)
link_libraries(
OpenMP::OpenMP_CXX
)
add_definitions(-DENABLE_OPENMP)
add_definitions(-D__OPENMP__)
endif()
include(metis)
if(METIS_FOUND)
add_definitions(-DMETIS)
set(METIS_SOURCE_FILES "${SPARSE_UTIL_SRC}/metis_interface.cpp")
endif()
### Find PAPI for Profiling
### Can be cloned directly from https://bitbucket.org/icl/papi.git
##TODO: create a cmake header
#find_package(PAPI)
if (PAPI_FOUND)
message(STATUS "PAPI found")
include_directories(
${PAPI_INCLUDE_DIRS}
)
add_definitions(-DPAPI)
if(LBC_PROFILING)
add_definitions(-DPROFILE)
message(STATUS "Profiling is enabled.")
endif()
endif()
file(GLOB_RECURSE EXT_SRC ${CMAKE_CURRENT_SOURCE_DIR}/utils/external/*.cpp
${CMAKE_CURRENT_SOURCE_DIR}/utils/external/*.c)
add_library(sym_amd SHARED
${EXT_SRC})
target_include_directories(sym_amd PRIVATE
${LBC_INC}
)
set(SPARSE_UTIL_SRC_FILES
"${CMAKE_CURRENT_SOURCE_DIR}/utils/sparse_inspector.cpp"
"${CMAKE_CURRENT_SOURCE_DIR}/utils/sparse_io.cpp"
"${CMAKE_CURRENT_SOURCE_DIR}/utils/sparse_utilities.cpp"
"${CMAKE_CURRENT_SOURCE_DIR}/utils/test_utils.cpp"
"${CMAKE_CURRENT_SOURCE_DIR}/utils/utils.cpp"
"${CMAKE_CURRENT_SOURCE_DIR}/utils/lfactor_creation.cpp"
"${CMAKE_CURRENT_SOURCE_DIR}/utils/etree.cpp"
"${CMAKE_CURRENT_SOURCE_DIR}/utils/FusionDemo.cpp"
"${CMAKE_CURRENT_SOURCE_DIR}/utils/BCSCMatrix.cpp"
"${CMAKE_CURRENT_SOURCE_DIR}/utils/external/mmio.cpp"
"${METIS_SOURCE_FILES}"
)
add_subdirectory(src)
#if(EXISTS "$ENV{PAPIROOT}")
# if(EXISTS "$ENV{PAPIROOT}/src")
# set(PAPI_LIB "$ENV{PAPIROOT}/src")
# set(PAPI_LIB2 "${PAPI_LIB}/libpfm4/lib/")
# elseif(EXISTS "$ENV{PAPIROOT}/lib")
# set(PAPI_LIB "$ENV{PAPIROOT}/lib")
# endif()
# if(EXISTS "$ENV{PAPIROOT}/include")
# set(PAPI_INC "$ENV{PAPIROOT}/include")
# else()
# set(PAPI_INC "$ENV{PAPIROOT}/src")
# endif()
#
# add_definitions(-DPAPI)
# set(PAPI_LIB_NAME "papi")
# set(PAPI_LIB_NAME2 "pfm")
# message(STATUS "PAPI found")
#else()
# message(STATUS "PAPI not found, building without PAPI.")
# set(PAPI_LIB_NAME "")
#endif()
if(LBC_PROFILING AND PAPI_FOUND)
add_subdirectory(profiler)
endif()
if(LBC_BUILD_EXAMPLES)
add_subdirectory(example)
endif()
if(LBC_BUILD_TESTS)
add_subdirectory(Catch_tests)
endif()