2017-12-04 20:56:17 +08:00
|
|
|
# CMake configuration for the main memgraph library and executable
|
|
|
|
|
2018-06-19 20:37:02 +08:00
|
|
|
# add memgraph sub libraries, ordered by dependency
|
2018-10-15 17:01:57 +08:00
|
|
|
add_subdirectory(lisp)
|
2018-05-29 17:13:13 +08:00
|
|
|
add_subdirectory(utils)
|
2018-07-06 15:28:05 +08:00
|
|
|
add_subdirectory(requests)
|
2018-06-19 20:37:02 +08:00
|
|
|
add_subdirectory(integrations)
|
2018-05-30 19:00:25 +08:00
|
|
|
add_subdirectory(io)
|
2018-06-20 19:46:54 +08:00
|
|
|
add_subdirectory(telemetry)
|
Extract communication to static library
Summary:
Session specifics have been move out of the Bolt `executing` state, and
are accessed via pure virtual Session type. Our server is templated on
the session and we are setting the concrete type, so there should be no
virtual call overhead. Abstract Session is used to indicate the
interface, this could have also been templated, but the explicit
interface definition makes it clearer.
Specific session implementation for running Memgraph is now implemented
in memgraph_bolt, which instantiates the concrete session type. This may
not be 100% appropriate place, but Memgraph specific session isn't
needed anywhere else.
Bolt/communication tests now use a dummy session and depend only on
communication, which significantly improves test run times.
All these changes make the communication a library which doesn't depend
on storage nor the database. Only shared connection points, which aren't
part of the base communication library are:
* glue/conversion -- which converts between storage and bolt types, and
* communication/result_stream_faker -- templated, but used in tests and query/repl
Depends on D1453
Reviewers: mferencevic, buda, mtomic, msantl
Reviewed By: mferencevic, mtomic
Subscribers: pullbot
Differential Revision: https://phabricator.memgraph.io/D1456
2018-07-10 22:18:19 +08:00
|
|
|
add_subdirectory(communication)
|
2018-08-22 21:26:51 +08:00
|
|
|
add_subdirectory(stats)
|
2018-07-27 16:54:20 +08:00
|
|
|
add_subdirectory(auth)
|
2019-05-02 20:24:11 +08:00
|
|
|
add_subdirectory(slk)
|
2019-07-03 21:32:03 +08:00
|
|
|
add_subdirectory(storage/v2)
|
2018-05-29 17:13:13 +08:00
|
|
|
|
2019-05-09 23:23:30 +08:00
|
|
|
# ----------------------------------------------------------------------------
|
|
|
|
# Common LCP files
|
|
|
|
# ----------------------------------------------------------------------------
|
|
|
|
|
|
|
|
define_add_lcp(add_lcp_common lcp_common_cpp_files generated_lcp_common_files)
|
|
|
|
|
|
|
|
add_lcp_common(query/frontend/ast/ast.lcp)
|
|
|
|
add_lcp_common(query/frontend/semantic/symbol.lcp)
|
|
|
|
add_lcp_common(query/plan/operator.lcp)
|
|
|
|
|
2019-05-10 03:07:30 +08:00
|
|
|
add_custom_target(generate_lcp_common DEPENDS ${generated_lcp_common_files})
|
|
|
|
|
2019-05-09 23:23:30 +08:00
|
|
|
# ----------------------------------------------------------------------------
|
|
|
|
# END Common LCP files
|
|
|
|
# ----------------------------------------------------------------------------
|
|
|
|
|
2018-10-04 21:23:07 +08:00
|
|
|
# ----------------------------------------------------------------------------
|
|
|
|
# Memgraph Single Node
|
|
|
|
# ----------------------------------------------------------------------------
|
|
|
|
set(mg_single_node_sources
|
2019-05-09 23:23:30 +08:00
|
|
|
${lcp_common_cpp_files}
|
2019-02-19 20:50:46 +08:00
|
|
|
audit/log.cpp
|
2017-12-04 20:56:17 +08:00
|
|
|
data_structures/concurrent/skiplist_gc.cpp
|
2018-10-05 18:37:23 +08:00
|
|
|
database/single_node/config.cpp
|
2019-05-07 21:10:28 +08:00
|
|
|
database/single_node/dump.cpp
|
2018-10-05 18:37:23 +08:00
|
|
|
database/single_node/graph_db.cpp
|
|
|
|
database/single_node/graph_db_accessor.cpp
|
2018-10-04 21:23:07 +08:00
|
|
|
durability/single_node/state_delta.cpp
|
2018-10-11 17:37:59 +08:00
|
|
|
durability/single_node/paths.cpp
|
2018-10-04 21:23:07 +08:00
|
|
|
durability/single_node/recovery.cpp
|
|
|
|
durability/single_node/snapshooter.cpp
|
|
|
|
durability/single_node/wal.cpp
|
|
|
|
glue/auth.cpp
|
|
|
|
glue/communication.cpp
|
|
|
|
query/common.cpp
|
|
|
|
query/frontend/ast/cypher_main_visitor.cpp
|
2019-01-25 22:45:13 +08:00
|
|
|
query/frontend/ast/pretty_print.cpp
|
2019-07-10 20:30:11 +08:00
|
|
|
query/frontend/parsing.cpp
|
2018-10-04 21:23:07 +08:00
|
|
|
query/frontend/semantic/required_privileges.cpp
|
|
|
|
query/frontend/semantic/symbol_generator.cpp
|
|
|
|
query/frontend/stripped.cpp
|
|
|
|
query/interpret/awesome_memgraph_functions.cpp
|
|
|
|
query/interpreter.cpp
|
|
|
|
query/plan/operator.cpp
|
|
|
|
query/plan/preprocess.cpp
|
|
|
|
query/plan/pretty_print.cpp
|
2019-01-15 18:11:06 +08:00
|
|
|
query/plan/profile.cpp
|
2019-02-05 23:12:02 +08:00
|
|
|
query/plan/rewrite/index_lookup.cpp
|
2018-10-04 21:23:07 +08:00
|
|
|
query/plan/rule_based_planner.cpp
|
|
|
|
query/plan/variable_start_planner.cpp
|
|
|
|
query/repl.cpp
|
|
|
|
query/typed_value.cpp
|
2019-05-22 15:54:28 +08:00
|
|
|
storage/common/constraints/record.cpp
|
2019-07-10 20:30:11 +08:00
|
|
|
storage/common/constraints/unique_constraints.cpp
|
2018-11-07 01:15:55 +08:00
|
|
|
storage/common/locking/record_lock.cpp
|
|
|
|
storage/common/types/property_value_store.cpp
|
2019-05-22 15:54:28 +08:00
|
|
|
storage/single_node/edge_accessor.cpp
|
2018-10-04 21:23:07 +08:00
|
|
|
storage/single_node/record_accessor.cpp
|
|
|
|
storage/single_node/vertex_accessor.cpp
|
2018-10-09 17:09:10 +08:00
|
|
|
transactions/single_node/engine.cpp
|
2018-10-04 21:23:07 +08:00
|
|
|
memgraph_init.cpp
|
|
|
|
)
|
|
|
|
|
|
|
|
define_add_lcp(add_lcp_single_node mg_single_node_sources generated_lcp_single_node_files)
|
|
|
|
|
|
|
|
add_lcp_single_node(durability/single_node/state_delta.lcp)
|
|
|
|
|
2019-05-10 03:07:30 +08:00
|
|
|
add_custom_target(generate_lcp_single_node DEPENDS generate_lcp_common ${generated_lcp_single_node_files})
|
2018-10-04 21:23:07 +08:00
|
|
|
|
|
|
|
set(MG_SINGLE_NODE_LIBS stdc++fs Threads::Threads fmt cppitertools
|
2019-02-06 19:29:04 +08:00
|
|
|
antlr_opencypher_parser_lib dl glog gflags
|
|
|
|
mg-utils mg-io mg-requests mg-communication)
|
|
|
|
# These are enterprise subsystems
|
2019-02-11 20:32:09 +08:00
|
|
|
set(MG_SINGLE_NODE_LIBS ${MG_SINGLE_NODE_LIBS} mg-integrations-kafka mg-auth)
|
2018-10-04 21:23:07 +08:00
|
|
|
|
|
|
|
if (USE_LTALLOC)
|
|
|
|
list(APPEND MG_SINGLE_NODE_LIBS ltalloc)
|
|
|
|
# TODO(mferencevic): Enable this when clang is updated on apollo.
|
|
|
|
# set(CMAKE_EXE_LINKER_FLAGS "${CMAKE_EXE_LINKER_FLAGS} -flto")
|
|
|
|
endif()
|
|
|
|
|
|
|
|
if (READLINE_FOUND)
|
|
|
|
list(APPEND MG_SINGLE_NODE_LIBS readline)
|
|
|
|
endif()
|
|
|
|
|
|
|
|
add_library(mg-single-node STATIC ${mg_single_node_sources})
|
|
|
|
target_link_libraries(mg-single-node ${MG_SINGLE_NODE_LIBS})
|
|
|
|
add_dependencies(mg-single-node generate_opencypher_parser)
|
|
|
|
add_dependencies(mg-single-node generate_lcp_single_node)
|
|
|
|
target_compile_definitions(mg-single-node PUBLIC MG_SINGLE_NODE)
|
|
|
|
|
|
|
|
# ----------------------------------------------------------------------------
|
|
|
|
# END Memgraph Single Node
|
|
|
|
# ----------------------------------------------------------------------------
|
|
|
|
|
2018-10-26 22:18:20 +08:00
|
|
|
# ----------------------------------------------------------------------------
|
|
|
|
# Memgraph Single Node High Availability
|
|
|
|
# ----------------------------------------------------------------------------
|
|
|
|
set(mg_single_node_ha_sources
|
2019-05-09 23:23:30 +08:00
|
|
|
${lcp_common_cpp_files}
|
2019-02-19 20:50:46 +08:00
|
|
|
audit/log.cpp
|
2018-10-26 22:18:20 +08:00
|
|
|
data_structures/concurrent/skiplist_gc.cpp
|
|
|
|
database/single_node_ha/config.cpp
|
|
|
|
database/single_node_ha/graph_db.cpp
|
|
|
|
database/single_node_ha/graph_db_accessor.cpp
|
|
|
|
durability/single_node_ha/state_delta.cpp
|
|
|
|
durability/single_node_ha/paths.cpp
|
|
|
|
durability/single_node_ha/snapshooter.cpp
|
2019-01-16 17:40:06 +08:00
|
|
|
durability/single_node_ha/recovery.cpp
|
2018-10-26 22:18:20 +08:00
|
|
|
glue/auth.cpp
|
|
|
|
glue/communication.cpp
|
2018-11-19 18:27:45 +08:00
|
|
|
raft/coordination.cpp
|
|
|
|
raft/raft_server.cpp
|
2019-03-05 22:02:16 +08:00
|
|
|
raft/storage_info.cpp
|
2018-10-26 22:18:20 +08:00
|
|
|
query/common.cpp
|
|
|
|
query/frontend/ast/cypher_main_visitor.cpp
|
2019-01-25 22:45:13 +08:00
|
|
|
query/frontend/ast/pretty_print.cpp
|
2019-07-10 20:30:11 +08:00
|
|
|
query/frontend/parsing.cpp
|
2018-10-26 22:18:20 +08:00
|
|
|
query/frontend/semantic/required_privileges.cpp
|
|
|
|
query/frontend/semantic/symbol_generator.cpp
|
|
|
|
query/frontend/stripped.cpp
|
|
|
|
query/interpret/awesome_memgraph_functions.cpp
|
|
|
|
query/interpreter.cpp
|
|
|
|
query/plan/operator.cpp
|
|
|
|
query/plan/preprocess.cpp
|
|
|
|
query/plan/pretty_print.cpp
|
2019-01-15 18:11:06 +08:00
|
|
|
query/plan/profile.cpp
|
2019-02-05 23:12:02 +08:00
|
|
|
query/plan/rewrite/index_lookup.cpp
|
2018-10-26 22:18:20 +08:00
|
|
|
query/plan/rule_based_planner.cpp
|
|
|
|
query/plan/variable_start_planner.cpp
|
|
|
|
query/repl.cpp
|
|
|
|
query/typed_value.cpp
|
2019-05-24 19:26:24 +08:00
|
|
|
storage/common/constraints/record.cpp
|
2019-07-10 20:30:11 +08:00
|
|
|
storage/common/constraints/unique_constraints.cpp
|
2018-12-07 21:02:53 +08:00
|
|
|
storage/common/types/slk.cpp
|
2018-11-07 01:15:55 +08:00
|
|
|
storage/common/types/property_value_store.cpp
|
|
|
|
storage/common/locking/record_lock.cpp
|
2018-10-26 22:18:20 +08:00
|
|
|
storage/single_node_ha/edge_accessor.cpp
|
|
|
|
storage/single_node_ha/record_accessor.cpp
|
|
|
|
storage/single_node_ha/vertex_accessor.cpp
|
|
|
|
transactions/single_node_ha/engine.cpp
|
|
|
|
memgraph_init.cpp
|
|
|
|
)
|
|
|
|
|
|
|
|
define_add_lcp(add_lcp_single_node_ha mg_single_node_ha_sources generated_lcp_single_node_ha_files)
|
|
|
|
|
|
|
|
add_lcp_single_node_ha(durability/single_node_ha/state_delta.lcp)
|
2019-05-03 02:53:54 +08:00
|
|
|
add_lcp_single_node_ha(database/single_node_ha/serialization.lcp SLK_SERIALIZE
|
2018-11-07 20:41:39 +08:00
|
|
|
DEPENDS durability/single_node_ha/state_delta.lcp)
|
2019-05-03 02:53:54 +08:00
|
|
|
add_lcp_single_node_ha(raft/raft_rpc_messages.lcp SLK_SERIALIZE)
|
|
|
|
add_lcp_single_node_ha(raft/log_entry.lcp SLK_SERIALIZE)
|
|
|
|
add_lcp_single_node_ha(raft/snapshot_metadata.lcp SLK_SERIALIZE)
|
|
|
|
add_lcp_single_node_ha(raft/storage_info_rpc_messages.lcp SLK_SERIALIZE)
|
2018-10-26 22:18:20 +08:00
|
|
|
|
2019-05-10 03:07:30 +08:00
|
|
|
add_custom_target(generate_lcp_single_node_ha DEPENDS generate_lcp_common ${generated_lcp_single_node_ha_files})
|
2018-10-26 22:18:20 +08:00
|
|
|
|
|
|
|
set(MG_SINGLE_NODE_HA_LIBS stdc++fs Threads::Threads fmt cppitertools
|
2019-05-03 02:53:54 +08:00
|
|
|
antlr_opencypher_parser_lib dl glog gflags
|
2019-02-06 19:29:04 +08:00
|
|
|
mg-utils mg-io mg-integrations-kafka mg-requests mg-communication mg-comm-rpc
|
2019-05-03 02:53:54 +08:00
|
|
|
mg-auth)
|
2018-10-26 22:18:20 +08:00
|
|
|
|
|
|
|
if (USE_LTALLOC)
|
|
|
|
list(APPEND MG_SINGLE_NODE_HA_LIBS ltalloc)
|
|
|
|
# TODO(mferencevic): Enable this when clang is updated on apollo.
|
|
|
|
# set(CMAKE_EXE_LINKER_FLAGS "${CMAKE_EXE_LINKER_FLAGS} -flto")
|
|
|
|
endif()
|
|
|
|
|
|
|
|
if (READLINE_FOUND)
|
|
|
|
list(APPEND MG_SINGLE_NODE_HA_LIBS readline)
|
|
|
|
endif()
|
|
|
|
|
|
|
|
add_library(mg-single-node-ha STATIC ${mg_single_node_ha_sources})
|
|
|
|
target_link_libraries(mg-single-node-ha ${MG_SINGLE_NODE_HA_LIBS})
|
|
|
|
add_dependencies(mg-single-node-ha generate_opencypher_parser)
|
|
|
|
add_dependencies(mg-single-node-ha generate_lcp_single_node_ha)
|
|
|
|
target_compile_definitions(mg-single-node-ha PUBLIC MG_SINGLE_NODE_HA)
|
|
|
|
|
|
|
|
# ----------------------------------------------------------------------------
|
|
|
|
# END Memgraph Single Node High Availability
|
|
|
|
# ----------------------------------------------------------------------------
|
|
|
|
|
2019-05-24 20:16:42 +08:00
|
|
|
add_custom_target(generate_lcp)
|
2019-07-17 18:32:22 +08:00
|
|
|
add_dependencies(generate_lcp generate_lcp_single_node generate_lcp_single_node_ha)
|
2019-05-24 20:16:42 +08:00
|
|
|
|
2018-10-04 21:23:07 +08:00
|
|
|
string(TOLOWER ${CMAKE_BUILD_TYPE} lower_build_type)
|
2017-12-04 20:56:17 +08:00
|
|
|
|
2018-04-27 17:23:40 +08:00
|
|
|
# STATIC library used to store key-value pairs
|
2018-11-07 01:15:55 +08:00
|
|
|
add_library(kvstore_lib STATIC storage/common/kvstore/kvstore.cpp)
|
2018-06-19 20:37:02 +08:00
|
|
|
target_link_libraries(kvstore_lib stdc++fs mg-utils rocksdb bzip2 zlib glog gflags)
|
2018-04-27 17:23:40 +08:00
|
|
|
|
2018-06-12 17:29:22 +08:00
|
|
|
# STATIC library for dummy key-value storage
|
2018-11-07 01:15:55 +08:00
|
|
|
add_library(kvstore_dummy_lib STATIC storage/common/kvstore/kvstore_dummy.cpp)
|
2018-06-12 17:29:22 +08:00
|
|
|
target_link_libraries(kvstore_dummy_lib mg-utils)
|
|
|
|
|
2017-12-04 20:56:17 +08:00
|
|
|
# Generate a version.hpp file
|
|
|
|
set(VERSION_STRING ${memgraph_VERSION})
|
|
|
|
configure_file(version.hpp.in version.hpp @ONLY)
|
|
|
|
include_directories(${CMAKE_CURRENT_BINARY_DIR})
|
|
|
|
|
|
|
|
# memgraph main executable
|
2018-10-04 21:23:07 +08:00
|
|
|
add_executable(memgraph memgraph.cpp)
|
|
|
|
target_link_libraries(memgraph mg-single-node kvstore_lib telemetry_lib)
|
2017-12-11 22:51:53 +08:00
|
|
|
set_target_properties(memgraph PROPERTIES
|
|
|
|
# Set the executable output name to include version information.
|
|
|
|
OUTPUT_NAME "memgraph-${memgraph_VERSION}-${COMMIT_HASH}_${CMAKE_BUILD_TYPE}"
|
|
|
|
# Output the executable in main binary dir.
|
2017-12-04 20:56:17 +08:00
|
|
|
RUNTIME_OUTPUT_DIRECTORY ${CMAKE_BINARY_DIR})
|
2017-12-11 22:51:53 +08:00
|
|
|
# Create symlink to the built executable.
|
|
|
|
add_custom_command(TARGET memgraph POST_BUILD
|
|
|
|
COMMAND ${CMAKE_COMMAND} -E create_symlink $<TARGET_FILE:memgraph> ${CMAKE_BINARY_DIR}/memgraph
|
|
|
|
BYPRODUCTS ${CMAKE_BINARY_DIR}/memgraph
|
|
|
|
COMMENT Creating symlink to memgraph executable)
|
|
|
|
|
2017-12-04 20:56:17 +08:00
|
|
|
# Strip the executable in release build.
|
|
|
|
if (lower_build_type STREQUAL "release")
|
2017-12-11 22:51:53 +08:00
|
|
|
add_custom_command(TARGET memgraph POST_BUILD
|
|
|
|
COMMAND strip -s $<TARGET_FILE:memgraph>
|
|
|
|
COMMENT Stripping symbols and sections from memgraph)
|
2017-12-04 20:56:17 +08:00
|
|
|
endif()
|
|
|
|
|
|
|
|
# Everything here is under "memgraph" install component.
|
|
|
|
set(CMAKE_INSTALL_DEFAULT_COMPONENT_NAME "memgraph")
|
|
|
|
|
2018-04-10 16:40:03 +08:00
|
|
|
# TODO: Default directory permissions to 755
|
|
|
|
# NOTE: This is added in CMake 3.11, so enable it then
|
|
|
|
#set(CMAKE_INSTALL_DEFAULT_DIRECTORY_PERMISSIONS
|
|
|
|
# OWNER_READ OWNER_WRITE OWNER_EXECUTE GROUP_READ WORLD_READ)
|
|
|
|
|
2017-12-04 20:56:17 +08:00
|
|
|
# Install and rename executable to just 'memgraph' Since we have to rename,
|
|
|
|
# we cannot use the recommended `install(TARGETS ...)`.
|
2017-12-11 22:51:53 +08:00
|
|
|
install(PROGRAMS $<TARGET_FILE:memgraph>
|
2017-12-21 23:03:54 +08:00
|
|
|
DESTINATION lib/memgraph RENAME memgraph)
|
2017-12-04 20:56:17 +08:00
|
|
|
# Install the config file (must use absolute path).
|
|
|
|
install(FILES ${CMAKE_SOURCE_DIR}/config/community.conf
|
|
|
|
DESTINATION /etc/memgraph RENAME memgraph.conf)
|
|
|
|
# Install logrotate configuration (must use absolute path).
|
|
|
|
install(FILES ${CMAKE_SOURCE_DIR}/release/logrotate.conf
|
|
|
|
DESTINATION /etc/logrotate.d RENAME memgraph)
|
2019-02-19 20:50:46 +08:00
|
|
|
install(FILES ${CMAKE_SOURCE_DIR}/release/logrotate_audit.conf
|
|
|
|
DESTINATION /etc/logrotate.d RENAME memgraph_audit)
|
2017-12-04 20:56:17 +08:00
|
|
|
# Create empty directories for default location of lib and log.
|
|
|
|
install(CODE "file(MAKE_DIRECTORY \$ENV{DESTDIR}/var/log/memgraph
|
|
|
|
\$ENV{DESTDIR}/var/lib/memgraph)")
|
|
|
|
# Install the license file.
|
|
|
|
install(FILES ${CMAKE_SOURCE_DIR}/release/LICENSE.md
|
|
|
|
DESTINATION share/doc/memgraph RENAME copyright)
|
|
|
|
# Install systemd service (must use absolute path).
|
|
|
|
install(FILES ${CMAKE_SOURCE_DIR}/release/memgraph.service
|
|
|
|
DESTINATION /lib/systemd/system)
|
|
|
|
|
2017-12-12 20:34:27 +08:00
|
|
|
# Install examples
|
|
|
|
set(examples ${CMAKE_SOURCE_DIR}/release/examples)
|
2018-04-20 20:58:49 +08:00
|
|
|
install(
|
|
|
|
CODE
|
|
|
|
"execute_process(COMMAND ${examples}/build_examples
|
2018-04-24 22:06:45 +08:00
|
|
|
${CMAKE_BINARY_DIR}/memgraph
|
2018-04-20 20:58:49 +08:00
|
|
|
${CMAKE_BINARY_DIR}/tests/manual/bolt_client
|
|
|
|
WORKING_DIRECTORY ${examples})")
|
2017-12-12 20:34:27 +08:00
|
|
|
install(DIRECTORY ${examples}/build/ DESTINATION share/memgraph/examples)
|
2018-10-04 21:23:07 +08:00
|
|
|
|
|
|
|
|
2018-10-26 22:18:20 +08:00
|
|
|
# memgraph single node high availability executable
|
|
|
|
add_executable(memgraph_ha memgraph_ha.cpp)
|
|
|
|
target_link_libraries(memgraph_ha mg-single-node-ha kvstore_lib telemetry_lib)
|
|
|
|
set_target_properties(memgraph_ha PROPERTIES
|
|
|
|
# Set the executable output name to include version information.
|
|
|
|
OUTPUT_NAME "memgraph_ha-${memgraph_VERSION}-${COMMIT_HASH}_${CMAKE_BUILD_TYPE}"
|
|
|
|
# Output the executable in main binary dir.
|
|
|
|
RUNTIME_OUTPUT_DIRECTORY ${CMAKE_BINARY_DIR})
|
|
|
|
# Create symlink to the built executable.
|
|
|
|
add_custom_command(TARGET memgraph_ha POST_BUILD
|
|
|
|
COMMAND ${CMAKE_COMMAND} -E create_symlink $<TARGET_FILE:memgraph_ha> ${CMAKE_BINARY_DIR}/memgraph_ha
|
|
|
|
BYPRODUCTS ${CMAKE_BINARY_DIR}/memgraph_ha
|
|
|
|
COMMENT Creating symlink to memgraph single node high availability executable)
|