-
Notifications
You must be signed in to change notification settings - Fork 53
/
CMakeLists.txt
79 lines (62 loc) · 2.07 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
cmake_minimum_required (VERSION 2.6)
project (FlashGraph)
include(CheckCCompilerFlag)
# The version number.
set (FlashGraph_VERSION_MAJOR 0)
set (FlashGraph_VERSION_MINOR 3)
set(CMAKE_MODULE_PATH ${CMAKE_MODULE_PATH} "${CMAKE_SOURCE_DIR}/cmake/")
if(CMAKE_CXX_COMPILER_ID STREQUAL "GNU")
if(CMAKE_CXX_COMPILER_VERSION VERSION_LESS "4.6.3")
message(FATAL_ERROR "Insufficient gcc version")
endif()
else()
message(FATAL_ERROR "We require GCC")
endif()
find_package(Boost REQUIRED)
find_package(Threads REQUIRED)
find_package(LibRt REQUIRED)
# configure a header file to pass some of the CMake settings
# to the source code
configure_file (
"${PROJECT_SOURCE_DIR}/config.h.in"
"${PROJECT_BINARY_DIR}/config.h"
)
SET(CMAKE_CXX_FLAGS "${CMAKE_CXX_FLAGS} -std=c++0x -O3 -fPIC" )
execute_process(COMMAND bash ${PROJECT_SOURCE_DIR}/get_num_nodes.sh OUTPUT_VARIABLE num_nodes)
message("#node: ${num_nodes}")
find_package(OpenMP)
if (OPENMP_FOUND)
set (CMAKE_C_FLAGS "${CMAKE_C_FLAGS} ${OpenMP_C_FLAGS}")
set (CMAKE_CXX_FLAGS "${CMAKE_CXX_FLAGS} ${OpenMP_CXX_FLAGS}")
endif()
if (${num_nodes} GREATER 1)
find_package(hwloc)
if (hwloc_FOUND)
set (CMAKE_C_FLAGS "${CMAKE_C_FLAGS} -DUSE_HWLOC")
set (CMAKE_CXX_FLAGS "${CMAKE_CXX_FLAGS} -DUSE_HWLOC")
endif()
endif()
if (${num_nodes} GREATER 1)
find_package(LibNuma)
if (LIBNUMA_FOUND)
message(STATUS "Find libnuma.")
set (CMAKE_C_FLAGS "${CMAKE_C_FLAGS} -DUSE_NUMA")
set (CMAKE_CXX_FLAGS "${CMAKE_CXX_FLAGS} -DUSE_NUMA")
endif()
endif()
find_package(LibAio)
if (LIBAIO_FOUND)
message(STATUS "Find libaio.")
set (CMAKE_C_FLAGS "${CMAKE_C_FLAGS} -DUSE_LIBAIO")
set (CMAKE_CXX_FLAGS "${CMAKE_CXX_FLAGS} -DUSE_LIBAIO")
endif()
check_c_compiler_flag("-mavx" HAVE_FLAG_M_AVX)
if(HAVE_FLAG_M_AVX)
set (CMAKE_C_FLAGS "${CMAKE_C_FLAGS} -mavx")
set (CMAKE_CXX_FLAGS "${CMAKE_CXX_FLAGS} -mavx")
endif()
#set(CMAKE_BUILD_TYPE Release)
# add the binary tree to the search path for include files
# so that we will find TutorialConfig.h
include_directories("${PROJECT_BINARY_DIR}" libsafs flash-graph matrix)
subdirs(libsafs utils flash-graph matrix)