-
Notifications
You must be signed in to change notification settings - Fork 2
/
CMakeLists.txt
163 lines (129 loc) · 4.98 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
155
156
157
158
159
160
161
162
163
cmake_minimum_required(VERSION 3.2...3.5)
project(gart)
set(CMAKE_CXX_STANDARD 17)
set(CMAKE_EXPORT_COMPILE_COMMANDS ON)
set(DEFAULT_BUILD_TYPE "Release")
if(NOT CMAKE_BUILD_TYPE AND NOT CMAKE_CONFIGURATION_TYPES)
message(WARNING "Setting build type to '${DEFAULT_BUILD_TYPE}' as none was specified.")
set(CMAKE_BUILD_TYPE "${DEFAULT_BUILD_TYPE}" CACHE
STRING "Choose the type of build." FORCE
)
set_property(CACHE CMAKE_BUILD_TYPE PROPERTY STRINGS
"Debug" "Release" "MinSizeRel" "RelWithDebInfo"
)
else()
message(STATUS "Setting build type to '${CMAKE_BUILD_TYPE}'.")
endif()
### Forbid in-source builds ###
if("${CMAKE_SOURCE_DIR}" STREQUAL "${CMAKE_BINARY_DIR}")
message(FATAL_ERROR "In-source builds are not allowed.")
endif("${CMAKE_SOURCE_DIR}" STREQUAL "${CMAKE_BINARY_DIR}")
### Set up compiler flags ###
option(ADD_CONVERTER "Option to add converter" ON)
option(ADD_VEGITO "Option to add Vegito" ON)
option(ADD_PGQL "Option to add PGQL" ON)
option(ADD_GAE_ENGINE "Option to add GAE engine" OFF)
option(ENABLE_CHECKPOINT "Option to support checkpoint" OFF)
if (ADD_CONVERTER)
add_subdirectory(converter)
endif()
if (ADD_VEGITO)
add_subdirectory(vegito)
endif()
if (ADD_PGQL)
add_subdirectory(pgql)
endif()
if (ADD_GAE_ENGINE)
add_subdirectory(apps/analytical_engine apps)
endif()
### Copy test schema ###
file(COPY ${CMAKE_SOURCE_DIR}/vegito/test/schema DESTINATION ${CMAKE_BINARY_DIR})
### Create symbolic links for scripts ###
file(MAKE_DIRECTORY ${CMAKE_BINARY_DIR}/scripts)
file(CREATE_LINK ${CMAKE_SOURCE_DIR}/scripts/gart gart SYMBOLIC)
file(CREATE_LINK ${CMAKE_SOURCE_DIR}/scripts/stop-gart stop-gart SYMBOLIC)
file(CREATE_LINK ${CMAKE_SOURCE_DIR}/scripts/check_process.sh check_process.sh SYMBOLIC)
file(CREATE_LINK ${CMAKE_SOURCE_DIR}/scripts/extract_table_schema.py scripts/extract_table_schema.py SYMBOLIC)
file(CREATE_LINK ${CMAKE_SOURCE_DIR}/scripts/distributed_deployment.py scripts/distributed_deployment.py SYMBOLIC)
file(CREATE_LINK ${CMAKE_SOURCE_DIR}/scripts/launch_etcd.py scripts/launch_etcd.py SYMBOLIC)
file(CREATE_LINK ${CMAKE_SOURCE_DIR}/scripts/update_kafka_config_file.py scripts/update_kafka_config_file.py SYMBOLIC)
### install headers ###
set(CMAKE_INSTALL_INCLUDE_DIR "/usr/local/include")
file(GLOB FRAGMENT_HEADER_FILES
"vegito/include/fragment/id_parser.h"
)
add_library(frag_header INTERFACE)
set_target_properties(frag_header PROPERTIES
PUBLIC_HEADER "${FRAGMENT_HEADER_FILES}"
)
install(TARGETS frag_header
# RUNTIME DESTINATION /usr/local/bin
PUBLIC_HEADER DESTINATION ${CMAKE_INSTALL_INCLUDE_DIR}/gart/fragment
)
file(GLOB SEGGRAPH_HEADER_FILES
"vegito/include/seggraph/blocks.hpp"
"vegito/include/seggraph/bloom_filter.hpp"
"vegito/include/seggraph/epoch_graph_reader.hpp"
"vegito/include/seggraph/types.hpp"
"vegito/include/seggraph/utils.hpp"
)
add_library(seggraph_header INTERFACE)
set_target_properties(seggraph_header PROPERTIES
PUBLIC_HEADER "${SEGGRAPH_HEADER_FILES}"
)
install(TARGETS seggraph_header
PUBLIC_HEADER DESTINATION ${CMAKE_INSTALL_INCLUDE_DIR}/gart/seggraph
)
file(GLOB INTERFACE_HEADER_FILES
"interfaces/fragment/*.h"
)
add_library(interface_header INTERFACE)
set_target_properties(interface_header PROPERTIES
PUBLIC_HEADER "${INTERFACE_HEADER_FILES}"
)
install(TARGETS interface_header
PUBLIC_HEADER DESTINATION ${CMAKE_INSTALL_INCLUDE_DIR}/gart/interfaces/fragment
)
file(GLOB UTIL_HEADER_FILES
"vegito/include/util/inline_str.h"
"vegito/include/util/macros.h"
"vegito/include/util/serializer.h"
"vegito/include/util/varint.h"
"vegito/include/util/bitset.h"
"vegito/include/util/status.h"
)
add_library(util_header INTERFACE)
set_target_properties(util_header PROPERTIES
PUBLIC_HEADER "${UTIL_HEADER_FILES}"
)
install(TARGETS util_header
PUBLIC_HEADER DESTINATION ${CMAKE_INSTALL_INCLUDE_DIR}/gart/util
)
### check format ###
file(GLOB_RECURSE FILES_NEED_FORMAT "*.cc" "*.h" "*.cpp" "*.hpp")
add_custom_target(clformat
COMMAND clang-format --style=file -i ${FILES_NEED_FORMAT}
COMMENT "Running clang-format."
VERBATIM)
add_custom_target(pyformat
COMMAND python3 -m black ${CMAKE_SOURCE_DIR}
COMMENT "Running black for python formats."
VERBATIM)
### make docs ###
set(GART_DOC_SOURCE_DIR "${CMAKE_SOURCE_DIR}/docs")
add_custom_target(gart-docs
COMMAND make html
WORKING_DIRECTORY ${GART_DOC_SOURCE_DIR}
COMMENT "Building documentation."
VERBATIM)
### install PostgreSQL Extension ###
set(PGX_PLUGIN_SOURCE_DIR "${CMAKE_SOURCE_DIR}/apps/pgx")
add_custom_target(pgx
COMMAND ${CMAKE_MAKE_PROGRAM} USE_PGXS=1 -j
WORKING_DIRECTORY ${PGX_PLUGIN_SOURCE_DIR}
)
add_custom_target(pgx-install
COMMAND sudo ${CMAKE_MAKE_PROGRAM} install
WORKING_DIRECTORY ${PGX_PLUGIN_SOURCE_DIR}
DEPENDS pgx # Enusre pgx target is built before installing
)