2016-06-05 20:30:40 +08:00
|
|
|
cmake_minimum_required(VERSION 3.1)
|
2016-05-16 04:43:42 +08:00
|
|
|
|
|
|
|
# get directory name
|
|
|
|
get_filename_component(ProjectId ${CMAKE_SOURCE_DIR} NAME)
|
|
|
|
# replace whitespaces with underscores
|
|
|
|
string(REPLACE " " "_" ProjectId ${ProjectId})
|
|
|
|
# set project name
|
|
|
|
project(${ProjectId})
|
|
|
|
|
2016-06-26 00:26:26 +08:00
|
|
|
find_package(Threads REQUIRED)
|
|
|
|
|
2016-08-01 01:58:12 +08:00
|
|
|
# flags
|
2016-08-08 16:32:34 +08:00
|
|
|
|
2016-05-25 06:37:14 +08:00
|
|
|
# c++14
|
|
|
|
set(CMAKE_CXX_FLAGS "${CMAKE_CXX_FLAGS} -std=c++1y")
|
2016-08-08 16:32:34 +08:00
|
|
|
|
|
|
|
# glibcxx debug (useful for gdb)
|
2016-08-13 06:01:39 +08:00
|
|
|
# the problem is that the query engine doesn't work as it should work if
|
2016-08-08 16:32:34 +08:00
|
|
|
# this flag is present
|
|
|
|
# TODO: find more appropriate way to use this flag only when it is needed
|
2016-08-01 01:58:12 +08:00
|
|
|
# set(CMAKE_CXX_FLAGS_DEBUG "${CMAKE_CXX_FLAGS_DEBUG} -D_GLIBCXX_DEBUG")
|
2016-05-25 06:37:14 +08:00
|
|
|
|
|
|
|
# functions
|
|
|
|
|
2016-06-07 05:57:16 +08:00
|
|
|
# prints all included directories
|
2016-05-25 06:37:14 +08:00
|
|
|
function(list_includes)
|
2016-06-07 05:57:16 +08:00
|
|
|
get_property(dirs DIRECTORY ${CMAKE_CURRENT_SOURCE_DIR}
|
|
|
|
PROPERTY INCLUDE_DIRECTORIES)
|
2016-05-25 06:37:14 +08:00
|
|
|
foreach(dir ${dirs})
|
|
|
|
message(STATUS "dir='${dir}'")
|
|
|
|
endforeach()
|
|
|
|
endfunction(list_includes)
|
|
|
|
|
2016-06-07 05:57:16 +08:00
|
|
|
# get file names from list of file paths
|
|
|
|
function(get_file_names file_paths file_names)
|
|
|
|
set(file_names "")
|
|
|
|
foreach(file_path ${file_paths})
|
|
|
|
get_filename_component (file_name ${file_path} NAME_WE)
|
|
|
|
list(APPEND file_names ${file_name})
|
|
|
|
endforeach()
|
|
|
|
set(file_names "${file_names}" PARENT_SCOPE)
|
|
|
|
endfunction()
|
|
|
|
|
2016-06-27 06:43:28 +08:00
|
|
|
MACRO(SUBDIRLIST result curdir)
|
|
|
|
FILE(GLOB children RELATIVE ${curdir} ${curdir}/*)
|
|
|
|
SET(dirlist "")
|
|
|
|
FOREACH(child ${children})
|
|
|
|
IF(IS_DIRECTORY ${curdir}/${child})
|
|
|
|
LIST(APPEND dirlist ${child})
|
|
|
|
ENDIF()
|
|
|
|
ENDFOREACH()
|
|
|
|
SET(${result} ${dirlist})
|
|
|
|
ENDMACRO()
|
|
|
|
|
2016-05-29 03:18:26 +08:00
|
|
|
# custom targets
|
|
|
|
|
2016-06-03 22:48:23 +08:00
|
|
|
# move test data data to the build directory
|
2016-05-29 03:18:26 +08:00
|
|
|
if (UNIX)
|
2016-06-03 22:48:23 +08:00
|
|
|
set(test_data "tests/data")
|
|
|
|
set(test_data_src "${CMAKE_SOURCE_DIR}/${test_data}")
|
|
|
|
set(test_data_dst "${CMAKE_BINARY_DIR}/${test_data}")
|
2016-05-29 03:18:26 +08:00
|
|
|
add_custom_target (test_data
|
|
|
|
COMMAND rm -rf ${test_data_dst}
|
|
|
|
COMMAND cp -r ${test_data_src} ${test_data_dst}
|
|
|
|
)
|
|
|
|
endif (UNIX)
|
|
|
|
|
2016-05-23 13:51:36 +08:00
|
|
|
# external dependencies
|
|
|
|
|
2016-05-29 03:18:26 +08:00
|
|
|
set(src_dir ${CMAKE_SOURCE_DIR}/src)
|
|
|
|
set(libs_dir ${CMAKE_SOURCE_DIR}/libs)
|
2016-07-11 09:39:33 +08:00
|
|
|
set(include_dir ${CMAKE_SOURCE_DIR}/include)
|
|
|
|
set(build_include_dir ${CMAKE_BINARY_DIR}/include)
|
|
|
|
set(test_include_dir ${CMAKE_BINARY_DIR}/tests/include)
|
|
|
|
set(test_src_dir ${CMAKE_BINARY_DIR}/tests/src)
|
2016-05-23 13:51:36 +08:00
|
|
|
|
2016-06-26 00:26:26 +08:00
|
|
|
# setup external dependencies
|
2016-05-23 13:51:36 +08:00
|
|
|
|
2016-06-26 00:26:26 +08:00
|
|
|
# !! IMPORTANT !! run ./libs/setup.sh before cmake command
|
|
|
|
# TODO: run from execute_process
|
|
|
|
|
|
|
|
# lemon & lempar
|
|
|
|
set(lemon_dir ${libs_dir}/lemon)
|
|
|
|
# lexertl
|
|
|
|
set(lexertl_dir ${libs_dir}/lexertl)
|
|
|
|
# fmt
|
|
|
|
set(fmt_source_dir ${libs_dir}/fmt)
|
|
|
|
set(fmt_static_lib ${fmt_source_dir}/fmt/libfmt.a)
|
|
|
|
# r3
|
|
|
|
set(r3_source_dir ${libs_dir}/r3)
|
|
|
|
set(r3_static_lib ${r3_source_dir}/.libs/libr3.a)
|
|
|
|
# http-parser
|
|
|
|
set(http_parser_source_dir "${libs_dir}/http-parser")
|
|
|
|
set(http_parser_static_lib ${http_parser_source_dir}/libhttp_parser.a)
|
|
|
|
# libuv
|
|
|
|
set(libuv_source_dir ${libs_dir}/libuv)
|
|
|
|
set(libuv_static_lib ${libuv_source_dir}/.libs/libuv.a)
|
|
|
|
# rapidjson (C++ JSON encoder/decoder)
|
|
|
|
set(rapidjson_source_dir "${libs_dir}/rapidjson")
|
|
|
|
# Catch (C++ Automated Test Cases in Headers)
|
|
|
|
set(catch_source_dir "${libs_dir}/Catch")
|
2016-05-23 13:51:36 +08:00
|
|
|
|
2016-05-25 06:37:14 +08:00
|
|
|
# build memgraph's cypher grammar
|
2016-05-29 03:18:26 +08:00
|
|
|
# copy grammar file to the build directory
|
2016-05-25 06:37:14 +08:00
|
|
|
FILE(COPY ${src_dir}/cypher/cypher.y DESTINATION ${CMAKE_BINARY_DIR})
|
2016-05-29 03:18:26 +08:00
|
|
|
# build cypher parser (only c file - cypher.c)
|
2016-05-23 13:51:36 +08:00
|
|
|
EXECUTE_PROCESS(
|
|
|
|
COMMAND ${lemon_dir}/lemon ${CMAKE_BINARY_DIR}/cypher.y -s
|
|
|
|
WORKING_DIRECTORY ${CMAKE_BINARY_DIR}
|
|
|
|
)
|
2016-05-29 03:18:26 +08:00
|
|
|
# change cypher parser c extension to cpp (cypher.c -> cypher.cpp)
|
2016-05-23 13:51:36 +08:00
|
|
|
FILE(RENAME ${CMAKE_BINARY_DIR}/cypher.c ${CMAKE_BINARY_DIR}/cypher.cpp)
|
2016-05-29 03:18:26 +08:00
|
|
|
# add include file (cypher.h) to build include dir
|
|
|
|
SET(cypher_build_include_dir ${build_include_dir}/cypher)
|
|
|
|
FILE(MAKE_DIRECTORY ${cypher_build_include_dir})
|
|
|
|
FILE(RENAME ${CMAKE_BINARY_DIR}/cypher.h ${cypher_build_include_dir}/cypher.h)
|
2016-05-23 13:51:36 +08:00
|
|
|
|
2016-07-11 09:39:33 +08:00
|
|
|
# prepare template and destination folders for query engine (tests)
|
2016-08-10 16:39:02 +08:00
|
|
|
# and memgraph server binary
|
2016-06-27 06:43:28 +08:00
|
|
|
# copy query_engine's templates file
|
2016-07-11 09:39:33 +08:00
|
|
|
FILE(COPY ${src_dir}/query_engine/template DESTINATION ${CMAKE_BINARY_DIR}/tests)
|
2016-08-10 16:39:02 +08:00
|
|
|
FILE(COPY ${src_dir}/query_engine/template DESTINATION ${CMAKE_BINARY_DIR})
|
2016-06-27 06:43:28 +08:00
|
|
|
# create destination folder for compiled queries
|
2016-07-11 09:39:33 +08:00
|
|
|
FILE(MAKE_DIRECTORY ${CMAKE_BINARY_DIR}/tests/compiled/cpu)
|
2016-08-10 16:39:02 +08:00
|
|
|
FILE(MAKE_DIRECTORY ${CMAKE_BINARY_DIR}/compiled/cpu)
|
2016-06-27 06:43:28 +08:00
|
|
|
|
|
|
|
# TODO: filter header files, all files don't need to be copied
|
2016-07-03 08:02:42 +08:00
|
|
|
# they are all copied because query engine needs header files during
|
|
|
|
# query compilation
|
2016-07-11 09:39:33 +08:00
|
|
|
# TODO: make a function (REMOVE copy pasted part)
|
2016-08-10 16:39:02 +08:00
|
|
|
# SUBDIRLIST(source_folders ${src_dir})
|
|
|
|
# foreach(source_folder ${source_folders})
|
|
|
|
# file(COPY ${src_dir}/${source_folder} DESTINATION ${build_include_dir})
|
|
|
|
# endforeach()
|
2016-07-11 09:39:33 +08:00
|
|
|
SUBDIRLIST(source_folders ${src_dir})
|
|
|
|
foreach(source_folder ${source_folders})
|
|
|
|
file(COPY ${src_dir}/${source_folder} DESTINATION ${test_src_dir})
|
|
|
|
endforeach()
|
|
|
|
SUBDIRLIST(source_folders ${include_dir})
|
|
|
|
foreach(source_foler ${source_folders})
|
|
|
|
file(COPY ${include_dir}/${source_folder} DESTINATION ${test_include_dir})
|
|
|
|
endforeach()
|
2016-06-27 06:43:28 +08:00
|
|
|
|
2016-08-10 16:39:02 +08:00
|
|
|
# -----------------------------------------------------------------------------
|
|
|
|
# COPY header files required by query engine (query compiler)
|
|
|
|
# TODO: somehow automate (in destination dir should be only required include files)
|
|
|
|
FILE(COPY ${include_dir}/database/db.hpp DESTINATION ${build_include_dir}/database)
|
2016-08-14 20:45:47 +08:00
|
|
|
FILE(COPY ${include_dir}/database/db_transaction.hpp DESTINATION ${build_include_dir}/database)
|
2016-08-20 01:40:04 +08:00
|
|
|
FILE(COPY ${include_dir}/database/db_accessor.hpp DESTINATION ${build_include_dir}/database)
|
2016-08-10 16:39:02 +08:00
|
|
|
|
|
|
|
FILE(COPY ${include_dir}/storage/common.hpp DESTINATION ${build_include_dir}/storage)
|
|
|
|
FILE(COPY ${include_dir}/storage/graph.hpp DESTINATION ${build_include_dir}/storage)
|
|
|
|
FILE(COPY ${include_dir}/storage/edge.hpp DESTINATION ${build_include_dir}/storage)
|
2016-08-14 20:45:47 +08:00
|
|
|
FILE(COPY ${include_dir}/storage/edge_record.hpp DESTINATION ${build_include_dir}/storage)
|
2016-08-10 16:39:02 +08:00
|
|
|
FILE(COPY ${include_dir}/storage/edge_accessor.hpp DESTINATION ${build_include_dir}/storage)
|
|
|
|
FILE(COPY ${include_dir}/storage/edges.hpp DESTINATION ${build_include_dir}/storage)
|
|
|
|
FILE(COPY ${include_dir}/storage/vertices.hpp DESTINATION ${build_include_dir}/storage)
|
|
|
|
FILE(COPY ${include_dir}/storage/vertex.hpp DESTINATION ${build_include_dir}/storage)
|
|
|
|
FILE(COPY ${include_dir}/storage/vertex_accessor.hpp DESTINATION ${build_include_dir}/storage)
|
|
|
|
FILE(COPY ${include_dir}/storage/record_accessor.hpp DESTINATION ${build_include_dir}/storage)
|
|
|
|
FILE(COPY ${include_dir}/storage/locking/record_lock.hpp DESTINATION ${build_include_dir}/storage/locking)
|
|
|
|
FILE(COPY ${include_dir}/storage/locking/lock_status.hpp DESTINATION ${build_include_dir}/storage/locking)
|
|
|
|
FILE(COPY ${include_dir}/storage/edge_type/edge_type_store.hpp DESTINATION ${build_include_dir}/storage/edge_type)
|
|
|
|
FILE(COPY ${include_dir}/storage/edge_type/edge_type.hpp DESTINATION ${build_include_dir}/storage/edge_type)
|
|
|
|
FILE(COPY ${include_dir}/storage/label/label_store.hpp DESTINATION ${build_include_dir}/storage/label)
|
2016-08-14 20:45:47 +08:00
|
|
|
FILE(COPY ${include_dir}/storage/model/edge_map.hpp DESTINATION ${build_include_dir}/storage/model)
|
2016-08-20 01:40:04 +08:00
|
|
|
FILE(COPY ${include_dir}/storage/model/properties/flags.hpp DESTINATION ${build_include_dir}/storage/model/properties)
|
2016-08-10 16:39:02 +08:00
|
|
|
|
|
|
|
FILE(COPY ${include_dir}/query_engine/util.hpp DESTINATION ${build_include_dir}/query_engine)
|
|
|
|
FILE(COPY ${include_dir}/query_engine/i_code_cpu.hpp DESTINATION ${build_include_dir}/query_engine)
|
|
|
|
FILE(COPY ${include_dir}/query_engine/query_result.hpp DESTINATION ${build_include_dir}/query_engine)
|
|
|
|
FILE(COPY ${include_dir}/query_engine/query_stripped.hpp DESTINATION ${build_include_dir}/query_engine)
|
|
|
|
|
|
|
|
FILE(COPY ${include_dir}/data_structures/concurrent/concurrent_map.hpp DESTINATION ${build_include_dir}/data_structures/concurrent)
|
|
|
|
FILE(COPY ${include_dir}/data_structures/concurrent/concurrent_set.hpp DESTINATION ${build_include_dir}/data_structures/concurrent)
|
2016-08-20 01:40:04 +08:00
|
|
|
FILE(COPY ${include_dir}/data_structures/concurrent/concurrent_list.hpp DESTINATION ${build_include_dir}/data_structures/concurrent)
|
2016-08-10 16:39:02 +08:00
|
|
|
FILE(COPY ${include_dir}/data_structures/concurrent/common.hpp DESTINATION ${build_include_dir}/data_structures/concurrent)
|
|
|
|
FILE(COPY ${include_dir}/data_structures/concurrent/skiplist.hpp DESTINATION ${build_include_dir}/data_structures/concurrent)
|
|
|
|
FILE(COPY ${include_dir}/data_structures/concurrent/skiplist_gc.hpp DESTINATION ${build_include_dir}/data_structures/concurrent)
|
2016-08-14 20:45:47 +08:00
|
|
|
FILE(COPY ${include_dir}/data_structures/map/rh_hashmultimap.hpp DESTINATION ${build_include_dir}/data_structures/map)
|
|
|
|
FILE(COPY ${include_dir}/data_structures/map/rh_common.hpp DESTINATION ${build_include_dir}/data_structures/map)
|
2016-08-10 16:39:02 +08:00
|
|
|
|
|
|
|
FILE(COPY ${include_dir}/data_structures/bitset/dynamic_bitset.hpp DESTINATION ${build_include_dir}/data_structures/bitset)
|
|
|
|
|
|
|
|
FILE(COPY ${include_dir}/threading/sync/lockable.hpp DESTINATION ${build_include_dir}/threading/sync)
|
|
|
|
FILE(COPY ${include_dir}/threading/sync/spinlock.hpp DESTINATION ${build_include_dir}/threading/sync)
|
|
|
|
FILE(COPY ${include_dir}/threading/sync/futex.hpp DESTINATION ${build_include_dir}/threading/sync)
|
|
|
|
FILE(COPY ${include_dir}/threading/sync/lock_timeout_error.hpp DESTINATION ${build_include_dir}/threading/sync)
|
|
|
|
|
|
|
|
FILE(COPY ${include_dir}/memory/freelist.hpp DESTINATION ${build_include_dir}/memory)
|
|
|
|
FILE(COPY ${include_dir}/memory/lazy_gc.hpp DESTINATION ${build_include_dir}/memory)
|
|
|
|
|
|
|
|
FILE(COPY ${include_dir}/mvcc/cre_exp.hpp DESTINATION ${build_include_dir}/mvcc)
|
|
|
|
FILE(COPY ${include_dir}/mvcc/hints.hpp DESTINATION ${build_include_dir}/mvcc)
|
|
|
|
FILE(COPY ${include_dir}/mvcc/id.hpp DESTINATION ${build_include_dir}/mvcc)
|
|
|
|
FILE(COPY ${include_dir}/mvcc/mvcc_error.hpp DESTINATION ${build_include_dir}/mvcc)
|
|
|
|
FILE(COPY ${include_dir}/mvcc/record.hpp DESTINATION ${build_include_dir}/mvcc)
|
|
|
|
FILE(COPY ${include_dir}/mvcc/serialization_error.hpp DESTINATION ${build_include_dir}/mvcc)
|
|
|
|
FILE(COPY ${include_dir}/mvcc/version.hpp DESTINATION ${build_include_dir}/mvcc)
|
|
|
|
FILE(COPY ${include_dir}/mvcc/version_list.hpp DESTINATION ${build_include_dir}/mvcc)
|
|
|
|
|
|
|
|
FILE(COPY ${include_dir}/transactions/transaction.hpp DESTINATION ${build_include_dir}/transactions)
|
|
|
|
FILE(COPY ${include_dir}/transactions/lock_store.hpp DESTINATION ${build_include_dir}/transactions)
|
|
|
|
FILE(COPY ${include_dir}/transactions/snapshot.hpp DESTINATION ${build_include_dir}/transactions)
|
|
|
|
FILE(COPY ${include_dir}/transactions/commit_log.hpp DESTINATION ${build_include_dir}/transactions)
|
|
|
|
FILE(COPY ${include_dir}/transactions/engine.hpp DESTINATION ${build_include_dir}/transactions)
|
|
|
|
FILE(COPY ${include_dir}/transactions/transaction_store.hpp DESTINATION ${build_include_dir}/transactions)
|
|
|
|
|
|
|
|
FILE(COPY ${include_dir}/storage/model/properties/properties.hpp DESTINATION ${build_include_dir}/storage/model/properties)
|
|
|
|
FILE(COPY ${include_dir}/storage/model/properties/property.hpp DESTINATION ${build_include_dir}/storage/model/properties)
|
|
|
|
FILE(COPY ${include_dir}/storage/model/properties/traversers/consolewriter.hpp DESTINATION ${build_include_dir}/storage/model/properties/traversers)
|
|
|
|
FILE(COPY ${include_dir}/storage/model/properties/traversers/jsonwriter.hpp DESTINATION ${build_include_dir}/storage/model/properties/traversers)
|
|
|
|
FILE(COPY ${include_dir}/storage/model/properties/handler.hpp DESTINATION ${build_include_dir}/storage/model/properties)
|
|
|
|
FILE(COPY ${include_dir}/storage/model/properties/all.hpp DESTINATION ${build_include_dir}/storage/model/properties)
|
|
|
|
FILE(COPY ${include_dir}/storage/model/properties/bool.hpp DESTINATION ${build_include_dir}/storage/model/properties)
|
|
|
|
FILE(COPY ${include_dir}/storage/model/properties/float.hpp DESTINATION ${build_include_dir}/storage/model/properties)
|
|
|
|
FILE(COPY ${include_dir}/storage/model/properties/double.hpp DESTINATION ${build_include_dir}/storage/model/properties)
|
|
|
|
FILE(COPY ${include_dir}/storage/model/properties/int32.hpp DESTINATION ${build_include_dir}/storage/model/properties)
|
|
|
|
FILE(COPY ${include_dir}/storage/model/properties/int64.hpp DESTINATION ${build_include_dir}/storage/model/properties)
|
|
|
|
FILE(COPY ${include_dir}/storage/model/properties/string.hpp DESTINATION ${build_include_dir}/storage/model/properties)
|
|
|
|
FILE(COPY ${include_dir}/storage/model/properties/floating.hpp DESTINATION ${build_include_dir}/storage/model/properties)
|
|
|
|
FILE(COPY ${include_dir}/storage/model/properties/number.hpp DESTINATION ${build_include_dir}/storage/model/properties)
|
|
|
|
FILE(COPY ${include_dir}/storage/model/properties/integral.hpp DESTINATION ${build_include_dir}/storage/model/properties)
|
2016-08-18 22:34:36 +08:00
|
|
|
FILE(COPY ${include_dir}/storage/model/properties/property_family.hpp DESTINATION ${build_include_dir}/storage/model/properties)
|
2016-08-10 16:39:02 +08:00
|
|
|
FILE(COPY ${include_dir}/storage/model/properties/utils/math_operations.hpp DESTINATION ${build_include_dir}/storage/model/properties/utils)
|
|
|
|
FILE(COPY ${include_dir}/storage/model/properties/utils/unary_negation.hpp DESTINATION ${build_include_dir}/storage/model/properties/utils)
|
|
|
|
FILE(COPY ${include_dir}/storage/model/properties/utils/modulo.hpp DESTINATION ${build_include_dir}/storage/model/properties/utils)
|
|
|
|
|
2016-08-18 22:34:36 +08:00
|
|
|
|
2016-08-10 16:39:02 +08:00
|
|
|
FILE(COPY ${include_dir}/storage/model/edge_model.hpp DESTINATION ${build_include_dir}/storage/model)
|
|
|
|
FILE(COPY ${include_dir}/storage/model/property_model.hpp DESTINATION ${build_include_dir}/storage/model)
|
|
|
|
FILE(COPY ${include_dir}/storage/model/vertex_model.hpp DESTINATION ${build_include_dir}/storage/model)
|
|
|
|
FILE(COPY ${include_dir}/storage/model/edge_list.hpp DESTINATION ${build_include_dir}/storage/model)
|
|
|
|
|
|
|
|
FILE(COPY ${include_dir}/storage/label/label.hpp DESTINATION ${build_include_dir}/storage/label)
|
|
|
|
FILE(COPY ${include_dir}/storage/label/label_collection.hpp DESTINATION ${build_include_dir}/storage/label)
|
|
|
|
FILE(COPY ${include_dir}/storage/label/label_store.hpp DESTINATION ${build_include_dir}/storage/label)
|
|
|
|
|
|
|
|
FILE(COPY ${include_dir}/storage/indexes/index.hpp DESTINATION ${build_include_dir}/storage/indexes)
|
|
|
|
FILE(COPY ${include_dir}/storage/indexes/index_record.hpp DESTINATION ${build_include_dir}/storage/indexes)
|
|
|
|
FILE(COPY ${include_dir}/storage/indexes/index_record_collection.hpp DESTINATION ${build_include_dir}/storage/indexes)
|
2016-08-20 01:40:04 +08:00
|
|
|
FILE(COPY ${include_dir}/storage/indexes/index_base.hpp DESTINATION ${build_include_dir}/storage/indexes)
|
|
|
|
FILE(COPY ${include_dir}/storage/indexes/impl/nonunique_unordered_index.hpp DESTINATION ${build_include_dir}/storage/indexes/impl)
|
2016-08-10 16:39:02 +08:00
|
|
|
|
|
|
|
FILE(COPY ${include_dir}/utils/sys.hpp DESTINATION ${build_include_dir}/utils)
|
2016-08-11 11:47:30 +08:00
|
|
|
FILE(COPY ${include_dir}/utils/bswap.hpp DESTINATION ${build_include_dir}/utils)
|
2016-08-10 16:39:02 +08:00
|
|
|
FILE(COPY ${include_dir}/utils/stacktrace.hpp DESTINATION ${build_include_dir}/utils)
|
|
|
|
FILE(COPY ${include_dir}/utils/auto_scope.hpp DESTINATION ${build_include_dir}/utils)
|
|
|
|
FILE(COPY ${include_dir}/utils/assert.hpp DESTINATION ${build_include_dir}/utils)
|
|
|
|
FILE(COPY ${include_dir}/utils/reference_wrapper.hpp DESTINATION ${build_include_dir}/utils)
|
|
|
|
FILE(COPY ${include_dir}/utils/underlying_cast.hpp DESTINATION ${build_include_dir}/utils)
|
|
|
|
FILE(COPY ${include_dir}/utils/total_ordering.hpp DESTINATION ${build_include_dir}/utils)
|
|
|
|
FILE(COPY ${include_dir}/utils/crtp.hpp DESTINATION ${build_include_dir}/utils)
|
|
|
|
FILE(COPY ${include_dir}/utils/placeholder.hpp DESTINATION ${build_include_dir}/utils)
|
|
|
|
FILE(COPY ${include_dir}/utils/likely.hpp DESTINATION ${build_include_dir}/utils)
|
|
|
|
FILE(COPY ${include_dir}/utils/cpu_relax.hpp DESTINATION ${build_include_dir}/utils)
|
|
|
|
FILE(COPY ${include_dir}/utils/counters/atomic_counter.hpp DESTINATION ${build_include_dir}/utils/counters)
|
|
|
|
FILE(COPY ${include_dir}/utils/counters/simple_counter.hpp DESTINATION ${build_include_dir}/utils/counters)
|
|
|
|
FILE(COPY ${include_dir}/utils/random/fast_binomial.hpp DESTINATION ${build_include_dir}/utils/random)
|
|
|
|
FILE(COPY ${include_dir}/utils/random/xorshift128plus.hpp DESTINATION ${build_include_dir}/utils/random)
|
|
|
|
FILE(COPY ${include_dir}/utils/exceptions/basic_exception.hpp DESTINATION ${build_include_dir}/utils/exceptions)
|
2016-08-11 11:47:30 +08:00
|
|
|
FILE(COPY ${include_dir}/utils/datetime/timestamp.hpp DESTINATION ${build_include_dir}/utils/datetime)
|
|
|
|
FILE(COPY ${include_dir}/utils/datetime/datetime_error.hpp DESTINATION ${build_include_dir}/utils/datetime)
|
|
|
|
FILE(COPY ${include_dir}/utils/types/byte.hpp DESTINATION ${build_include_dir}/utils/types)
|
2016-08-20 01:40:04 +08:00
|
|
|
FILE(COPY ${include_dir}/utils/iterator/iterator_base.hpp DESTINATION ${build_include_dir}/utils/iterator)
|
2016-08-14 20:45:47 +08:00
|
|
|
FILE(COPY ${include_dir}/utils/option_ptr.hpp DESTINATION ${build_include_dir}/utils)
|
2016-08-20 01:40:04 +08:00
|
|
|
FILE(COPY ${include_dir}/utils/option.hpp DESTINATION ${build_include_dir}/utils)
|
|
|
|
FILE(COPY ${include_dir}/utils/border.hpp DESTINATION ${build_include_dir}/utils)
|
2016-08-11 11:47:30 +08:00
|
|
|
|
|
|
|
FILE(COPY ${include_dir}/communication/communication.hpp DESTINATION ${build_include_dir}/communication)
|
|
|
|
FILE(COPY ${include_dir}/communication/bolt/v1/config.hpp DESTINATION ${build_include_dir}/communication/bolt/v1)
|
|
|
|
FILE(COPY ${include_dir}/communication/bolt/v1/serialization/record_stream.hpp DESTINATION ${build_include_dir}/communication/bolt/v1/serialization)
|
|
|
|
FILE(COPY ${include_dir}/communication/bolt/v1/serialization/bolt_serializer.hpp DESTINATION ${build_include_dir}/communication/bolt/v1/serialization)
|
|
|
|
FILE(COPY ${include_dir}/communication/bolt/v1/transport/bolt_encoder.hpp DESTINATION ${build_include_dir}/communication/bolt/v1/transport)
|
|
|
|
FILE(COPY ${include_dir}/communication/bolt/v1/transport/chunked_buffer.hpp DESTINATION ${build_include_dir}/communication/bolt/v1/transport)
|
|
|
|
FILE(COPY ${include_dir}/communication/bolt/v1/transport/chunked_encoder.hpp DESTINATION ${build_include_dir}/communication/bolt/v1/transport)
|
|
|
|
FILE(COPY ${include_dir}/communication/bolt/v1/transport/socket_stream.hpp DESTINATION ${build_include_dir}/communication/bolt/v1/transport)
|
|
|
|
FILE(COPY ${include_dir}/communication/bolt/v1/transport/stream_error.hpp DESTINATION ${build_include_dir}/communication/bolt/v1/transport)
|
|
|
|
FILE(COPY ${include_dir}/communication/bolt/v1/packing/codes.hpp DESTINATION ${build_include_dir}/communication/bolt/v1/packing)
|
|
|
|
FILE(COPY ${include_dir}/communication/bolt/v1/messaging/codes.hpp DESTINATION ${build_include_dir}/communication/bolt/v1/messaging)
|
|
|
|
|
|
|
|
FILE(COPY ${include_dir}/io/network/socket.hpp DESTINATION ${build_include_dir}/io/network)
|
|
|
|
FILE(COPY ${include_dir}/io/network/addrinfo.hpp DESTINATION ${build_include_dir}/io/network)
|
|
|
|
FILE(COPY ${include_dir}/io/network/network_error.hpp DESTINATION ${build_include_dir}/io/network)
|
|
|
|
FILE(COPY ${include_dir}/io/network/socket.hpp DESTINATION ${build_include_dir}/io/network)
|
|
|
|
|
|
|
|
FILE(COPY ${include_dir}/logging/default.hpp DESTINATION ${build_include_dir}/logging)
|
|
|
|
FILE(COPY ${include_dir}/logging/log.hpp DESTINATION ${build_include_dir}/logging)
|
|
|
|
FILE(COPY ${include_dir}/logging/logger.hpp DESTINATION ${build_include_dir}/logging)
|
|
|
|
FILE(COPY ${include_dir}/logging/levels.hpp DESTINATION ${build_include_dir}/logging)
|
2016-08-10 16:39:02 +08:00
|
|
|
# -----------------------------------------------------------------------------
|
|
|
|
|
2016-05-16 04:43:42 +08:00
|
|
|
# add all cpp file recursive into sourceFiles varibale
|
2016-06-26 00:26:26 +08:00
|
|
|
# FILE(GLOB_RECURSE sourceFiles ${src_dir}/*.cpp)
|
2016-05-16 04:43:42 +08:00
|
|
|
# print list of source files
|
|
|
|
# MESSAGE(STATUS "All source files are: ${sourceFiles}")
|
|
|
|
|
2016-08-10 16:39:02 +08:00
|
|
|
# debug flags
|
|
|
|
if ("${CMAKE_CXX_COMPILER_ID}" STREQUAL "Clang")
|
|
|
|
# set(CMAKE_CXX_FLAGS_DEBUG "-Wl,--export-dynamic ${CMAKE_CXX_FLAGS_DEBUG}")
|
|
|
|
elseif ("${CMAKE_CXX_COMPILER_ID}" STREQUAL "GNU")
|
|
|
|
# set(CMAKE_CXX_FLAGS_DEBUG "-rdynamic ${CMAKE_CXX_FLAGS_DEBUG}")
|
|
|
|
endif()
|
|
|
|
|
|
|
|
# release flags
|
|
|
|
set(CMAKE_CXX_FLAGS_RELEASE
|
2016-08-13 06:01:39 +08:00
|
|
|
"${CMAKE_CXX_FLAGS_RELEASE} -march=native -Wall")
|
2016-08-08 16:32:34 +08:00
|
|
|
|
2016-08-11 11:47:30 +08:00
|
|
|
# -- configure defines -- default is ON | true | enabled ----------------------
|
|
|
|
# -- logging ------------------------------------------------------------------
|
|
|
|
option(LOG_NO_TRACE "Disable trace logging" OFF)
|
|
|
|
message(STATUS "LOG_NO_TRACE: ${LOG_NO_TRACE}")
|
|
|
|
if (LOG_NO_TRACE)
|
|
|
|
add_definitions(-DLOG_NO_TRACE)
|
|
|
|
endif()
|
|
|
|
|
|
|
|
option(LOG_NO_DEBUG "Disable debug logging" OFF)
|
|
|
|
message(STATUS "LOG_NO_DEBUG: ${LOG_NO_DEBUG}")
|
|
|
|
if (LOG_NO_DEBUG)
|
|
|
|
add_definitions(-DLOG_NO_DEBUG)
|
|
|
|
endif()
|
|
|
|
|
|
|
|
option(LOG_NO_INFO "Disable info logging" OFF)
|
|
|
|
message(STATUS "LOG_NO_INFO: ${LOG_NO_INFO}")
|
|
|
|
if (LOG_NO_INFO)
|
|
|
|
add_definitions(-DLOG_NO_INFO)
|
|
|
|
endif()
|
|
|
|
|
|
|
|
option(LOG_NO_WARN "Disable warn logging" OFF)
|
|
|
|
message(STATUS "LOG_NO_WARN: ${LOG_NO_WARN}")
|
|
|
|
if (LOG_NO_WARN)
|
|
|
|
add_definitions(-DLOG_NO_WARN)
|
|
|
|
endif()
|
|
|
|
|
|
|
|
option(LOG_NO_ERROR "Disable error logging" OFF)
|
|
|
|
message(STATUS "LOG_NO_ERROR: ${LOG_NO_ERROR}")
|
|
|
|
if (LOG_NO_ERROR)
|
|
|
|
add_definitions(-DLOG_NO_ERROR)
|
|
|
|
endif()
|
|
|
|
# -- logging ------------------------------------------------------------------
|
2016-08-19 08:28:22 +08:00
|
|
|
# -- logger -------------------------------------------------------------------
|
|
|
|
option(SYNC_LOGGER "" OFF)
|
|
|
|
message(STATUS "SYNC LOGGER: ${SYNC_LOGGER}")
|
|
|
|
if (SYNC_LOGGER)
|
|
|
|
add_definitions(-DSYNC_LOGGER)
|
|
|
|
endif()
|
|
|
|
# -- logger -------------------------------------------------------------------
|
2016-08-11 11:47:30 +08:00
|
|
|
# -- assert -------------------------------------------------------------------
|
|
|
|
option(RUNTIME_ASSERT "Enable runtime assertions" ON)
|
|
|
|
message(STATUS "RUNTIME_ASSERT: ${RUNTIME_ASSERT}")
|
2016-06-15 06:06:21 +08:00
|
|
|
if(RUNTIME_ASSERT)
|
2016-08-11 11:47:30 +08:00
|
|
|
add_definitions(-DRUNTIME_ASSERT_ON)
|
2016-06-15 06:06:21 +08:00
|
|
|
endif()
|
|
|
|
|
2016-08-11 11:47:30 +08:00
|
|
|
option(THROW_EXCEPTION_ON_ERROR "Throw exception on error" ON)
|
|
|
|
message(STATUS "THROW_EXCEPTION_ON_ERROR: ${THROW_EXCEPTION_ON_ERROR}")
|
2016-06-15 06:06:21 +08:00
|
|
|
if(THROW_EXCEPTION_ON_ERROR)
|
2016-08-11 11:47:30 +08:00
|
|
|
add_definitions(-DTHROW_EXCEPTION_ON_ERROR)
|
2016-06-15 06:06:21 +08:00
|
|
|
endif()
|
2016-08-11 11:47:30 +08:00
|
|
|
# -- assert -------------------------------------------------------------------
|
|
|
|
# -- ndebug -------------------------------------------------------------------
|
2016-06-15 06:06:21 +08:00
|
|
|
option(NDEBUG "No debug" OFF)
|
2016-08-11 11:47:30 +08:00
|
|
|
message(STATUS "NDEBUG: ${NDEBUG} (be careful CMAKE_BUILD_TYPE can also append this flag)")
|
2016-06-15 06:06:21 +08:00
|
|
|
if(NDEBUG)
|
|
|
|
add_definitions( -DNDEBUG )
|
|
|
|
endif()
|
2016-08-11 11:47:30 +08:00
|
|
|
# -- ndebug -------------------------------------------------------------------
|
|
|
|
# -- binaries -----------------------------------------------------------------
|
2016-08-10 16:39:02 +08:00
|
|
|
option(MEMGRAPH "Build memgraph binary" ON)
|
2016-08-11 11:47:30 +08:00
|
|
|
message(STATUS "MEMGRAPH binary: ${MEMGRAPH}")
|
2016-08-10 16:39:02 +08:00
|
|
|
option(POC "Build proof of concept binaries" ON)
|
2016-08-11 11:47:30 +08:00
|
|
|
message(STATUS "POC binaries: ${POC}")
|
2016-08-10 16:39:02 +08:00
|
|
|
option(TESTS "Build test binaries" ON)
|
2016-08-11 11:47:30 +08:00
|
|
|
message(STATUS "TESTS binaries: ${TESTS}")
|
|
|
|
# -- binaries -----------------------------------------------------------------
|
|
|
|
# -- configure defines --------------------------------------------------------
|
2016-08-10 16:39:02 +08:00
|
|
|
|
|
|
|
# -- includes -----------------------------------------------------------------
|
2016-07-05 11:01:22 +08:00
|
|
|
include_directories(${CMAKE_SOURCE_DIR}/include)
|
2016-05-25 06:37:14 +08:00
|
|
|
include_directories(${src_dir})
|
2016-05-29 03:18:26 +08:00
|
|
|
include_directories(${build_include_dir})
|
2016-06-26 00:26:26 +08:00
|
|
|
include_directories(${fmt_source_dir})
|
|
|
|
include_directories(${http_parser_source_dir})
|
|
|
|
include_directories(${lexertl_dir})
|
|
|
|
include_directories(${libuv_source_dir}/include)
|
|
|
|
include_directories(${rapidjson_source_dir}/include)
|
|
|
|
include_directories(${r3_source_dir}/include)
|
2016-08-10 16:39:02 +08:00
|
|
|
# -----------------------------------------------------------------------------
|
2016-05-25 06:37:14 +08:00
|
|
|
|
2016-05-29 03:18:26 +08:00
|
|
|
# creates build/libcypher_lib.a
|
|
|
|
add_library(cypher_lib STATIC ${CMAKE_BINARY_DIR}/cypher.cpp)
|
2016-05-25 06:37:14 +08:00
|
|
|
|
2016-06-27 06:43:28 +08:00
|
|
|
# REST API preprocessor
|
2016-06-26 00:26:26 +08:00
|
|
|
EXECUTE_PROCESS(
|
|
|
|
COMMAND python link_resources.py
|
|
|
|
WORKING_DIRECTORY ${CMAKE_SOURCE_DIR}/src/api
|
|
|
|
)
|
|
|
|
|
2016-08-10 16:39:02 +08:00
|
|
|
# TODO: create separate static library from bolt code
|
2016-07-07 08:58:26 +08:00
|
|
|
set(memgraph_src_files
|
2016-08-10 16:39:02 +08:00
|
|
|
${src_dir}/utils/string/transform.cpp
|
|
|
|
${src_dir}/utils/string/join.cpp
|
|
|
|
${src_dir}/utils/string/file.cpp
|
|
|
|
${src_dir}/query_engine/util.cpp
|
2016-08-11 11:47:30 +08:00
|
|
|
${src_dir}/communication/bolt/v1/bolt.cpp
|
|
|
|
${src_dir}/communication/bolt/v1/states.cpp
|
|
|
|
${src_dir}/communication/bolt/v1/session.cpp
|
|
|
|
${src_dir}/communication/bolt/v1/states/error.cpp
|
|
|
|
${src_dir}/communication/bolt/v1/states/executor.cpp
|
|
|
|
${src_dir}/communication/bolt/v1/states/init.cpp
|
|
|
|
${src_dir}/communication/bolt/v1/states/handshake.cpp
|
|
|
|
${src_dir}/communication/bolt/v1/transport/bolt_decoder.cpp
|
|
|
|
${src_dir}/communication/bolt/v1/transport/buffer.cpp
|
2016-07-07 08:58:26 +08:00
|
|
|
${src_dir}/mvcc/id.cpp
|
|
|
|
${src_dir}/storage/vertices.cpp
|
2016-08-10 16:39:02 +08:00
|
|
|
${src_dir}/storage/edges.cpp
|
2016-07-07 08:58:26 +08:00
|
|
|
${src_dir}/storage/label/label.cpp
|
|
|
|
${src_dir}/storage/label/label_collection.cpp
|
|
|
|
${src_dir}/storage/label/label_store.cpp
|
|
|
|
${src_dir}/storage/edge_type/edge_type.cpp
|
|
|
|
${src_dir}/storage/edge_type/edge_type_store.cpp
|
|
|
|
${src_dir}/storage/model/properties/property.cpp
|
|
|
|
${src_dir}/storage/model/properties/null.cpp
|
|
|
|
${src_dir}/storage/model/properties/bool.cpp
|
|
|
|
${src_dir}/storage/model/properties/string.cpp
|
|
|
|
${src_dir}/storage/model/properties/properties.cpp
|
2016-08-18 22:34:36 +08:00
|
|
|
${src_dir}/storage/model/properties/property_family.cpp
|
|
|
|
${src_dir}/storage/indexes/impl/nonunique_unordered_index.cpp
|
2016-07-07 08:58:26 +08:00
|
|
|
${src_dir}/storage/locking/record_lock.cpp
|
|
|
|
${src_dir}/storage/vertex_accessor.cpp
|
|
|
|
${src_dir}/transactions/transaction.cpp
|
2016-07-11 09:39:33 +08:00
|
|
|
${src_dir}/template_engine/engine.cpp
|
2016-08-10 16:39:02 +08:00
|
|
|
${src_dir}/logging/streams/stdout.cpp
|
|
|
|
${src_dir}/logging/levels.cpp
|
|
|
|
${src_dir}/logging/logs/sync_log.cpp
|
|
|
|
${src_dir}/logging/logs/async_log.cpp
|
|
|
|
${src_dir}/logging/default.cpp
|
|
|
|
${src_dir}/logging/log.cpp
|
|
|
|
${src_dir}/io/network/tls.cpp
|
2016-08-13 06:01:39 +08:00
|
|
|
${src_dir}/database/db.cpp
|
|
|
|
${src_dir}/database/db_accessor.cpp
|
|
|
|
${src_dir}/storage/edge_accessor.cpp
|
2016-08-18 22:34:36 +08:00
|
|
|
${src_dir}/storage/record_accessor.cpp
|
2016-07-07 08:58:26 +08:00
|
|
|
)
|
2016-08-08 16:32:34 +08:00
|
|
|
|
|
|
|
# STATIC library used by memgraph executables
|
|
|
|
add_library(memgraph STATIC ${memgraph_src_files})
|
|
|
|
|
|
|
|
# STATIC PIC library used by query engine
|
|
|
|
add_library(memgraph_pic STATIC ${memgraph_src_files})
|
|
|
|
set_property(TARGET memgraph_pic PROPERTY POSITION_INDEPENDENT_CODE TRUE)
|
2016-07-02 05:05:03 +08:00
|
|
|
|
|
|
|
# tests
|
2016-08-10 16:39:02 +08:00
|
|
|
if (TESTS)
|
|
|
|
enable_testing()
|
|
|
|
add_subdirectory(tests)
|
|
|
|
endif()
|
2016-08-01 01:58:12 +08:00
|
|
|
|
2016-08-10 16:39:02 +08:00
|
|
|
# proof of concepts
|
|
|
|
if (POC)
|
|
|
|
add_subdirectory(poc)
|
|
|
|
endif()
|
2016-08-08 16:32:34 +08:00
|
|
|
|
2016-08-01 01:58:12 +08:00
|
|
|
# memgraph build name
|
|
|
|
execute_process(
|
2016-08-15 01:49:56 +08:00
|
|
|
OUTPUT_VARIABLE COMMIT_BRANCH
|
|
|
|
COMMAND git rev-parse --abbrev-ref HEAD
|
2016-08-01 01:58:12 +08:00
|
|
|
)
|
|
|
|
execute_process(
|
|
|
|
OUTPUT_VARIABLE COMMIT_HASH
|
|
|
|
COMMAND git rev-parse --short HEAD
|
|
|
|
)
|
2016-08-15 01:49:56 +08:00
|
|
|
execute_process(
|
2016-08-20 01:40:04 +08:00
|
|
|
OUTPUT_VARIABLE COMMIT_NO
|
2016-08-15 01:49:56 +08:00
|
|
|
COMMAND git rev-list --count HEAD
|
|
|
|
)
|
|
|
|
string(STRIP ${COMMIT_BRANCH} COMMIT_BRANCH)
|
2016-08-01 01:58:12 +08:00
|
|
|
string(STRIP ${COMMIT_NO} COMMIT_NO)
|
2016-08-15 01:49:56 +08:00
|
|
|
string(STRIP ${COMMIT_HASH} COMMIT_HASH)
|
2016-08-10 16:39:02 +08:00
|
|
|
set(MEMGRAPH_BUILD_NAME
|
2016-08-15 01:49:56 +08:00
|
|
|
"memgraph_${COMMIT_BRANCH}_${COMMIT_HASH}_${COMMIT_NO}_${CMAKE_BUILD_TYPE}")
|
2016-08-01 01:58:12 +08:00
|
|
|
|
2016-08-08 16:32:34 +08:00
|
|
|
# memgraph main executable
|
2016-08-10 16:39:02 +08:00
|
|
|
if (MEMGRAPH)
|
|
|
|
add_executable(${MEMGRAPH_BUILD_NAME} ${src_dir}/memgraph_bolt.cpp)
|
|
|
|
target_link_libraries(${MEMGRAPH_BUILD_NAME} memgraph)
|
|
|
|
target_link_libraries(${MEMGRAPH_BUILD_NAME} Threads::Threads)
|
|
|
|
target_link_libraries(${MEMGRAPH_BUILD_NAME} cypher_lib)
|
|
|
|
if (UNIX)
|
|
|
|
target_link_libraries(${MEMGRAPH_BUILD_NAME} crypto)
|
|
|
|
# target_link_libraries(${MEMGRAPH_BUILD_NAME} ssl)
|
|
|
|
target_link_libraries(${MEMGRAPH_BUILD_NAME} ${fmt_static_lib})
|
|
|
|
target_link_libraries(${MEMGRAPH_BUILD_NAME} dl)
|
|
|
|
endif (UNIX)
|
|
|
|
endif()
|
|
|
|
|
|
|
|
# # memgraph executable HTTP TODO: DEPRICATED
|
|
|
|
# add_executable(memgraph_http src/memgraph.cpp)
|
|
|
|
# add_dependencies(memgraph_http cypher_lib)
|
|
|
|
# target_link_libraries(memgraph_http Threads::Threads)
|
|
|
|
# target_link_libraries(memgraph_http pcre)
|
|
|
|
# target_link_libraries(memgraph_http ${libuv_static_lib})
|
|
|
|
# target_link_libraries(memgraph_http ${r3_static_lib})
|
|
|
|
# target_link_libraries(memgraph_http ${http_parser_static_lib})
|