-
Notifications
You must be signed in to change notification settings - Fork 29
/
CMakeLists.txt
113 lines (82 loc) · 2.92 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
project (wukong)
## CMake version
cmake_minimum_required(VERSION 2.8)
## Set root directory of Wukong
set(ROOT $ENV{WUKONG_ROOT})
## Use C++11 features
add_definitions(-std=c++11)
## Set dependencies
set(CMAKE_CXX_COMPILER ${ROOT}/deps/openmpi-1.6.5-install/bin/mpic++)
set(CMAKE_CXX_FLAGS "${CMAKE_CXX_FLAGS} -O2 -fopenmp")
set(BOOST_LIB "${ROOT}/deps/boost_1_67_0-install/lib")
## Set include paths
include_directories(deps/boost_1_67_0-install/include)
include_directories(core)
include_directories(utils)
include_directories(rdma_lib)
include_directories(deps/googletest/googletest/include)
## Add sub-directories
add_subdirectory(${ROOT}/deps/googletest)
## Source code
file(GLOB SOURCES "core/*.hpp" "utils/*.hpp" "rdma_lib/*.hpp")
## Set options (cached)
## usage: cmake .. -DUSE_RDMA=OFF -DUSE_HADOOP=ON
#### RDMA
option (USE_RDMA "enable RDMA support" ON)
if(USE_RDMA)
add_definitions(-DHAS_RDMA)
set(WUKONG_LIBS ${WUKONG_LIBS} ibverbs)
endif(USE_RDMA)
#### GPU (NOT YET READY)
option (USE_GPU "enable GPU support" OFF)
if(USE_GPU)
add_definitions(-DUSE_GPU)
find_package(CUDA REQUIRED)
## CUDA configs
set(CUDA_NVCC_FLAGS -arch=sm_35;-std=c++11)
set(CUDA_HOST_COMPILER ${CMAKE_CXX_COMPILER})
set(CUDA_SEPARABLE_COMPILATION ON)
set(WUKONG_LIBS ${WUKONG_LIBS} cudart)
cuda_add_executable(wukong ${SOURCES} "core/wukong.cpp" "core/gpu/gpu_hash.cu")
else(USE_GPU)
add_executable(wukong ${SOURCES} "core/wukong.cpp")
endif(USE_GPU)
#### HDFS
option (USE_HADOOP "enable HDFS support" OFF)
if(USE_HADOOP)
add_definitions(-DHAS_HADOOP)
target_link_libraries(wukong hdfs)
set(WUKONG_LIBS ${WUKONG_LIBS} hdfs)
endif(USE_HADOOP)
#### JEMALLOC
option (USE_JEMALLOC "enable jemalloc support" ON)
if(USE_JEMALLOC)
add_definitions(-DUSE_JEMALLOC)
target_link_libraries(wukong jemalloc)
set(WUKONG_LIBS ${WUKONG_LIBS} jemalloc)
endif(USE_JEMALLOC)
#### Dynamic GStore
option (USE_DYNAMIC_GSTORE "enable dynamic gstore" OFF)
if(USE_DYNAMIC_GSTORE)
add_definitions(-DDYNAMIC_GSTORE)
endif(USE_DYNAMIC_GSTORE)
#### Verstile queries (e.g., ?S ?P ?O)
option (USE_VERSATILE "support versatile queries" ON)
if(USE_VERSATILE)
add_definitions(-DVERSATILE)
endif(USE_VERSATILE)
#### 64-bit ID (32-bit ID by default)
option (USE_DTYPE_64BIT "use 64-bit ID" OFF)
if(USE_DTYPE_64BIT)
add_definitions(-DDTYPE_64BIT)
endif(USE_DTYPE_64BIT)
set(WUKONG_LIBS ${WUKONG_LIBS} zmq rt tbb hwloc)
## Build Wukong
target_link_libraries(wukong ${WUKONG_LIBS} ${BOOST_LIB}/libboost_mpi.a ${BOOST_LIB}/libboost_serialization.a ${BOOST_LIB}/libboost_program_options.a)
file(GLOB TS "${ROOT}/tests/*.cc")
add_executable(coretest ${TS})
target_link_libraries(coretest gtest gtest_main ${WUKONG_LIBS} ${BOOST_LIB}/libboost_mpi.a ${BOOST_LIB}/libboost_serialization.a ${BOOST_LIB}/libboost_program_options.a)
## tests
enable_testing()
add_test(NAME test COMMAND coretest)
add_custom_target(check COMMAND ${CMAKE_CTEST_COMMAND} --verbose DEPENDS coretest)