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-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-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)
|
2020-01-03 20:06:20 +08:00
|
|
|
add_subdirectory(query)
|
2018-05-29 17:13:13 +08:00
|
|
|
|
2020-01-13 21:48:13 +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)
|
|
|
|
#
|
|
|
|
#add_custom_target(generate_lcp_common DEPENDS ${generated_lcp_common_files})
|
|
|
|
#
|
|
|
|
## ----------------------------------------------------------------------------
|
|
|
|
## END Common LCP files
|
|
|
|
## ----------------------------------------------------------------------------
|
|
|
|
#
|
|
|
|
## ----------------------------------------------------------------------------
|
|
|
|
## Memgraph Single Node High Availability
|
|
|
|
## ----------------------------------------------------------------------------
|
|
|
|
#set(mg_single_node_ha_sources
|
|
|
|
# ${lcp_common_cpp_files}
|
|
|
|
# audit/log.cpp
|
|
|
|
# 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
|
|
|
|
# durability/single_node_ha/recovery.cpp
|
|
|
|
# glue/auth.cpp
|
|
|
|
# glue/communication.cpp
|
|
|
|
# raft/coordination.cpp
|
|
|
|
# raft/raft_server.cpp
|
|
|
|
# raft/storage_info.cpp
|
|
|
|
# query/common.cpp
|
|
|
|
# query/frontend/ast/cypher_main_visitor.cpp
|
|
|
|
# query/frontend/ast/pretty_print.cpp
|
|
|
|
# query/frontend/parsing.cpp
|
|
|
|
# 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
|
|
|
|
# query/plan/profile.cpp
|
|
|
|
# query/plan/rewrite/index_lookup.cpp
|
|
|
|
# query/plan/rule_based_planner.cpp
|
|
|
|
# query/plan/variable_start_planner.cpp
|
|
|
|
# query/procedure/mg_procedure_impl.cpp
|
|
|
|
# query/procedure/module.cpp
|
|
|
|
# query/typed_value.cpp
|
|
|
|
# storage/common/constraints/record.cpp
|
|
|
|
# storage/common/constraints/unique_constraints.cpp
|
|
|
|
# storage/common/types/slk.cpp
|
|
|
|
# storage/common/types/property_value_store.cpp
|
|
|
|
# storage/common/locking/record_lock.cpp
|
|
|
|
# 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)
|
|
|
|
#add_lcp_single_node_ha(database/single_node_ha/serialization.lcp SLK_SERIALIZE
|
|
|
|
# DEPENDS durability/single_node_ha/state_delta.lcp)
|
|
|
|
#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)
|
|
|
|
#
|
|
|
|
#add_custom_target(generate_lcp_single_node_ha DEPENDS generate_lcp_common ${generated_lcp_single_node_ha_files})
|
|
|
|
#
|
|
|
|
#set(MG_SINGLE_NODE_HA_LIBS stdc++fs Threads::Threads fmt cppitertools
|
|
|
|
# antlr_opencypher_parser_lib dl glog gflags
|
|
|
|
# mg-utils mg-io mg-requests mg-communication mg-comm-rpc
|
|
|
|
# mg-auth)
|
|
|
|
#
|
|
|
|
#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()
|
|
|
|
#
|
|
|
|
#add_library(mg-single-node-ha STATIC ${mg_single_node_ha_sources})
|
|
|
|
#target_include_directories(mg-single-node-ha PUBLIC ${CMAKE_SOURCE_DIR}/include)
|
|
|
|
#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)
|
|
|
|
## TODO: Make these symbols visible once we add support for custom procedure
|
|
|
|
## modules in HA.
|
|
|
|
## NOTE: `include/mg_procedure.syms` describes a pattern match for symbols which
|
|
|
|
## should be dynamically exported, so that `dlopen` can correctly link the
|
|
|
|
## symbols in custom procedure module libraries.
|
|
|
|
## target_link_libraries(mg-single-node-ha "-Wl,--dynamic-list=${CMAKE_SOURCE_DIR}/include/mg_procedure.syms")
|
|
|
|
#
|
|
|
|
## ----------------------------------------------------------------------------
|
|
|
|
## END Memgraph Single Node High Availability
|
|
|
|
## ----------------------------------------------------------------------------
|
|
|
|
#
|
|
|
|
#add_custom_target(generate_lcp)
|
|
|
|
#add_dependencies(generate_lcp 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})
|
|
|
|
|
2020-01-09 16:49:02 +08:00
|
|
|
# ----------------------------------------------------------------------------
|
|
|
|
# Memgraph Single Node v2 Executable
|
|
|
|
# ----------------------------------------------------------------------------
|
|
|
|
set(mg_single_node_v2_sources
|
|
|
|
audit/log.cpp
|
|
|
|
glue/auth.cpp
|
|
|
|
glue/communication.cpp
|
|
|
|
memgraph_init.cpp
|
|
|
|
memgraph.cpp
|
|
|
|
)
|
|
|
|
|
|
|
|
set(MG_SINGLE_NODE_V2_LIBS stdc++fs Threads::Threads
|
|
|
|
telemetry_lib mg-query mg-communication)
|
|
|
|
# These are enterprise subsystems
|
|
|
|
set(MG_SINGLE_NODE_V2_LIBS ${MG_SINGLE_NODE_V2_LIBS} mg-auth)
|
|
|
|
|
|
|
|
if (USE_LTALLOC)
|
|
|
|
list(APPEND MG_SINGLE_NODE_V2_LIBS ltalloc)
|
|
|
|
# TODO(mferencevic): Enable this when clang is updated on apollo.
|
|
|
|
# set(CMAKE_EXE_LINKER_FLAGS "${CMAKE_EXE_LINKER_FLAGS} -flto")
|
|
|
|
endif()
|
|
|
|
|
2017-12-04 20:56:17 +08:00
|
|
|
# memgraph main executable
|
2020-01-09 16:49:02 +08:00
|
|
|
add_executable(memgraph ${mg_single_node_v2_sources})
|
|
|
|
target_include_directories(memgraph PUBLIC ${CMAKE_SOURCE_DIR}/include)
|
|
|
|
target_compile_definitions(memgraph PUBLIC MG_SINGLE_NODE_V2)
|
|
|
|
target_link_libraries(memgraph ${MG_SINGLE_NODE_V2_LIBS})
|
|
|
|
# NOTE: `include/mg_procedure.syms` describes a pattern match for symbols which
|
|
|
|
# should be dynamically exported, so that `dlopen` can correctly link the
|
|
|
|
# symbols in custom procedure module libraries.
|
|
|
|
target_link_libraries(memgraph "-Wl,--dynamic-list=${CMAKE_SOURCE_DIR}/include/mg_procedure.syms")
|
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
|
2019-12-09 18:31:27 +08:00
|
|
|
COMMENT "Creating symlink to memgraph executable")
|
2017-12-11 22:51:53 +08:00
|
|
|
|
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>
|
2019-12-09 18:31:27 +08:00
|
|
|
COMMENT "Stripping symbols and sections from memgraph")
|
2017-12-04 20:56:17 +08:00
|
|
|
endif()
|
|
|
|
|
2019-12-09 18:31:27 +08:00
|
|
|
# Generate the configuration file.
|
|
|
|
add_custom_command(TARGET memgraph POST_BUILD
|
|
|
|
COMMAND ${CMAKE_SOURCE_DIR}/config/generate.py
|
|
|
|
${CMAKE_BINARY_DIR}/memgraph
|
|
|
|
${CMAKE_BINARY_DIR}/config/memgraph.conf
|
|
|
|
DEPENDS ${CMAKE_SOURCE_DIR}/config/generate.py
|
|
|
|
${CMAKE_SOURCE_DIR}/config/flags.yaml
|
|
|
|
BYPRODUCTS ${CMAKE_BINARY_DIR}/config/memgraph.conf
|
|
|
|
COMMENT "Generating memgraph configuration file")
|
|
|
|
|
2020-01-09 16:49:02 +08:00
|
|
|
# ----------------------------------------------------------------------------
|
|
|
|
# END Memgraph Single Node v2 Executable
|
|
|
|
# ----------------------------------------------------------------------------
|
|
|
|
|
2017-12-04 20:56:17 +08:00
|
|
|
# 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)
|
Integrate loading openCypher module procedures
Summary:
All mgp_* symbols are exported from Memgraph executable, no other
symbols should be visible.
The primary C API header, mg_procedure.h, is now part of the
installation. Also, added a shippable query module example.
Directory `query_modules` is meant to contain sources of modules we
write and ship as part of the installation. Currently, there's only an
example module, but there may be potentially more. Some modules could
only be installed as part of the enterprise release.
For Memgraph to load custom procedures, it needs to be started with a
flag pointing to a directory with compiled shared libraries implementing
those procedures.
Reviewers: mferencevic, ipaljak, llugovic, dsantl, buda
Reviewed By: mferencevic
Subscribers: pullbot
Differential Revision: https://phabricator.memgraph.io/D2538
2019-10-31 23:36:34 +08:00
|
|
|
# Install the include file for writing custom procedures.
|
|
|
|
install(FILES ${CMAKE_SOURCE_DIR}/include/mg_procedure.h
|
|
|
|
DESTINATION include/memgraph)
|
2017-12-04 20:56:17 +08:00
|
|
|
# Install the config file (must use absolute path).
|
2019-12-09 18:31:27 +08:00
|
|
|
install(FILES ${CMAKE_BINARY_DIR}/config/memgraph.conf
|
2017-12-04 20:56:17 +08:00
|
|
|
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
|
2019-12-09 22:20:43 +08:00
|
|
|
${CMAKE_BINARY_DIR}/tools/src/mg_client
|
2018-04-20 20:58:49 +08:00
|
|
|
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
|
|
|
|
|
|
|
|
2020-01-13 21:48:13 +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")
|