2017-12-04 20:56:17 +08:00
|
|
|
# CMake configuration for the main memgraph library and executable
|
|
|
|
|
|
|
|
# all memgraph src files
|
|
|
|
set(memgraph_src_files
|
2018-03-23 23:32:17 +08:00
|
|
|
communication/buffer.cpp
|
2017-12-04 20:56:17 +08:00
|
|
|
communication/bolt/v1/decoder/decoded_value.cpp
|
2018-01-24 19:16:14 +08:00
|
|
|
communication/rpc/client.cpp
|
|
|
|
communication/rpc/protocol.cpp
|
|
|
|
communication/rpc/server.cpp
|
2017-12-04 20:56:17 +08:00
|
|
|
data_structures/concurrent/skiplist_gc.cpp
|
2018-01-12 22:17:04 +08:00
|
|
|
database/config.cpp
|
2018-01-10 19:18:03 +08:00
|
|
|
database/counters.cpp
|
2017-12-04 20:56:17 +08:00
|
|
|
database/graph_db.cpp
|
|
|
|
database/graph_db_accessor.cpp
|
2017-12-07 20:09:34 +08:00
|
|
|
database/state_delta.cpp
|
2018-04-03 22:19:17 +08:00
|
|
|
distributed/cluster_discovery_master.cpp
|
|
|
|
distributed/cluster_discovery_worker.cpp
|
|
|
|
distributed/coordination.cpp
|
2017-12-19 19:40:30 +08:00
|
|
|
distributed/coordination_master.cpp
|
|
|
|
distributed/coordination_worker.cpp
|
2018-04-06 15:59:54 +08:00
|
|
|
distributed/durability_rpc_clients.cpp
|
|
|
|
distributed/durability_rpc_server.cpp
|
2018-03-19 21:42:32 +08:00
|
|
|
distributed/index_rpc_server.cpp
|
2018-01-22 22:24:04 +08:00
|
|
|
distributed/plan_consumer.cpp
|
|
|
|
distributed/plan_dispatcher.cpp
|
2018-03-23 22:21:46 +08:00
|
|
|
distributed/cache.cpp
|
|
|
|
distributed/data_manager.cpp
|
|
|
|
distributed/data_rpc_clients.cpp
|
|
|
|
distributed/data_rpc_server.cpp
|
|
|
|
distributed/produce_rpc_server.cpp
|
|
|
|
distributed/pull_rpc_clients.cpp
|
|
|
|
distributed/updates_rpc_clients.cpp
|
|
|
|
distributed/updates_rpc_server.cpp
|
2017-12-04 20:56:17 +08:00
|
|
|
durability/paths.cpp
|
|
|
|
durability/recovery.cpp
|
|
|
|
durability/snapshooter.cpp
|
|
|
|
durability/wal.cpp
|
|
|
|
io/network/addrinfo.cpp
|
2018-01-15 21:03:07 +08:00
|
|
|
io/network/endpoint.cpp
|
2017-12-04 20:56:17 +08:00
|
|
|
io/network/socket.cpp
|
|
|
|
query/common.cpp
|
2018-03-08 17:36:17 +08:00
|
|
|
query/repl.cpp
|
2017-12-04 20:56:17 +08:00
|
|
|
query/frontend/ast/ast.cpp
|
|
|
|
query/frontend/ast/cypher_main_visitor.cpp
|
|
|
|
query/frontend/semantic/symbol_generator.cpp
|
|
|
|
query/frontend/stripped.cpp
|
|
|
|
query/interpret/awesome_memgraph_functions.cpp
|
|
|
|
query/interpreter.cpp
|
2018-01-25 21:09:06 +08:00
|
|
|
query/plan/distributed.cpp
|
2017-12-04 20:56:17 +08:00
|
|
|
query/plan/operator.cpp
|
|
|
|
query/plan/preprocess.cpp
|
|
|
|
query/plan/rule_based_planner.cpp
|
|
|
|
query/plan/variable_start_planner.cpp
|
|
|
|
query/typed_value.cpp
|
2018-02-15 23:28:38 +08:00
|
|
|
stats/metrics.cpp
|
2018-02-02 18:11:06 +08:00
|
|
|
stats/stats.cpp
|
2017-12-15 17:48:21 +08:00
|
|
|
storage/concurrent_id_mapper_master.cpp
|
|
|
|
storage/concurrent_id_mapper_worker.cpp
|
2017-12-04 20:56:17 +08:00
|
|
|
storage/edge_accessor.cpp
|
|
|
|
storage/locking/record_lock.cpp
|
|
|
|
storage/property_value.cpp
|
|
|
|
storage/record_accessor.cpp
|
|
|
|
storage/vertex_accessor.cpp
|
Add deletion, more stats to card fraud and RWLock
Summary:
^^
this is a sample config to be used:
```
{
"num_workers": 1,
"cards_per_worker": 10001,
"pos_per_worker": 10001,
"fraud_probability": 0.01,
"hop_probability": 0.05,
"cleanup": {
"check_interval_sec": 10,
"tx_hi": 150000,
"tx_lo": 100000
},
"analytic": {
"query_interval_ms": 500,
"pos_limit": 10
}
}
```
I also added `RWLock` --- a wrapper around `pthread_rwlock`
Reviewers: mferencevic, mculinovic, florijan, teon.banek
Reviewed By: florijan
Subscribers: pullbot
Differential Revision: https://phabricator.memgraph.io/D1280
2018-03-14 20:47:18 +08:00
|
|
|
threading/sync/rwlock.cpp
|
2017-12-04 20:56:17 +08:00
|
|
|
threading/thread.cpp
|
|
|
|
transactions/engine_master.cpp
|
2018-01-10 22:10:22 +08:00
|
|
|
transactions/engine_single_node.cpp
|
2017-12-04 20:56:17 +08:00
|
|
|
transactions/engine_worker.cpp
|
2018-02-22 19:34:25 +08:00
|
|
|
utils/demangle.cpp
|
2018-01-16 20:34:19 +08:00
|
|
|
utils/file.cpp
|
2018-01-15 21:03:07 +08:00
|
|
|
utils/network.cpp
|
2018-04-01 16:50:52 +08:00
|
|
|
utils/signals.cpp
|
2017-12-04 20:56:17 +08:00
|
|
|
utils/watchdog.cpp
|
|
|
|
)
|
|
|
|
# -----------------------------------------------------------------------------
|
|
|
|
|
Add Lisp C++ Preprocessing (LCP)
Summary:
In order to enhance C++ metaprogramming capabilities, a custom
preprocessing step is added before compilation. C++ code may be mixed
with Lisp code in order to generate a complete C++ source code. The
mechanism is hooked into cmake. To notify cmake of .lcp files, `add_lcp`
function in src/CMakeLists.txt needs to be invoked.
The main executable entry point is in tools/lcp, while the source code
is in src/lisp/lcp.lisp
The main goal of LCP is to auto generate class serialization code and
member variable getter functions. This should now be significantly less
error prone, since you cannot forget to serialize a member variable
through this mechanism. Future uses should be generating other repeating
code, such as `Clone` methods or perhaps some debug information.
.lcp files may contain mixed C++ code (enclosed in #>cpp ... cpp<#
blocks) with Common Lisp code.
NOTE: With great power comes great responsibility. Lisp metaprogramming
capabilities are incredibly powerful. To keep the sanity of the team
intact, use Lisp preprocessing only when *really* necessary.
Reviewers: buda, mferencevic, msantl, dgleich, ipaljak, mculinovic, mtomic
Reviewed By: mtomic
Subscribers: pullbot
Differential Revision: https://phabricator.memgraph.io/D1361
2018-04-27 21:48:30 +08:00
|
|
|
# Lisp C++ Preprocessing
|
|
|
|
|
|
|
|
set(lcp_exe ${CMAKE_SOURCE_DIR}/tools/lcp)
|
|
|
|
set(lcp_src_files lisp/lcp.lisp ${lcp_exe})
|
|
|
|
|
|
|
|
# Use this function to add each lcp file to generation. This way each file is
|
|
|
|
# standalone and we avoid recompiling everything.
|
|
|
|
# NOTE: Only .hpp files are generated from .lcp, so there's no need to update memgraph_src_files.
|
|
|
|
# NOTE: generated_lcp_files are globally updated.
|
|
|
|
function(add_lcp lcp_file)
|
|
|
|
string(REGEX REPLACE "\.lcp$" ".hpp" h_file
|
|
|
|
"${CMAKE_CURRENT_SOURCE_DIR}/${lcp_file}")
|
|
|
|
add_custom_command(OUTPUT ${h_file}
|
|
|
|
COMMAND ${lcp_exe} ${lcp_file} > ${h_file}
|
|
|
|
DEPENDS ${lcp_file} ${lcp_src_files}
|
|
|
|
WORKING_DIRECTORY ${CMAKE_CURRENT_SOURCE_DIR})
|
|
|
|
# Update *global* generated_lcp_files
|
|
|
|
set(generated_lcp_files ${generated_lcp_files} ${h_file} PARENT_SCOPE)
|
|
|
|
endfunction(add_lcp)
|
|
|
|
|
|
|
|
add_custom_target(generate_lcp DEPENDS ${generated_lcp_files})
|
2018-05-02 15:54:28 +08:00
|
|
|
|
|
|
|
# Use this function to add each capnp file to generation. This way each file is
|
|
|
|
# standalone and we avoid recompiling everything.
|
|
|
|
# NOTE: memgraph_src_files and generated_capnp_files are globally updated.
|
|
|
|
function(add_capnp capnp_src_file)
|
|
|
|
set(cpp_file ${CMAKE_CURRENT_SOURCE_DIR}/${capnp_src_file}.c++)
|
|
|
|
set(h_file ${CMAKE_CURRENT_SOURCE_DIR}/${capnp_src_file}.h)
|
|
|
|
add_custom_command(OUTPUT ${cpp_file} ${h_file}
|
2018-04-03 16:27:50 +08:00
|
|
|
COMMAND ${CAPNP_EXE} compile -o${CAPNP_CXX_EXE} ${capnp_src_file} -I ${CMAKE_CURRENT_SOURCE_DIR}
|
2018-05-02 15:54:28 +08:00
|
|
|
DEPENDS ${capnp_src_file} capnproto-proj
|
|
|
|
WORKING_DIRECTORY ${CMAKE_CURRENT_SOURCE_DIR})
|
|
|
|
# Update *global* generated_capnp_files
|
|
|
|
set(generated_capnp_files ${generated_capnp_files} ${cpp_file} ${h_file} PARENT_SCOPE)
|
|
|
|
# Update *global* memgraph_src_files
|
|
|
|
set(memgraph_src_files ${memgraph_src_files} ${cpp_file} PARENT_SCOPE)
|
|
|
|
endfunction(add_capnp)
|
|
|
|
|
|
|
|
add_capnp(query/frontend/semantic/symbol.capnp)
|
2018-04-03 16:27:50 +08:00
|
|
|
add_capnp(query/frontend/ast/ast.capnp)
|
2018-05-04 16:35:31 +08:00
|
|
|
add_capnp(utils/serialization.capnp)
|
2018-04-03 16:27:50 +08:00
|
|
|
add_capnp(storage/types.capnp)
|
2018-05-02 15:54:28 +08:00
|
|
|
|
|
|
|
add_custom_target(generate_capnp DEPENDS ${generated_capnp_files})
|
Add Lisp C++ Preprocessing (LCP)
Summary:
In order to enhance C++ metaprogramming capabilities, a custom
preprocessing step is added before compilation. C++ code may be mixed
with Lisp code in order to generate a complete C++ source code. The
mechanism is hooked into cmake. To notify cmake of .lcp files, `add_lcp`
function in src/CMakeLists.txt needs to be invoked.
The main executable entry point is in tools/lcp, while the source code
is in src/lisp/lcp.lisp
The main goal of LCP is to auto generate class serialization code and
member variable getter functions. This should now be significantly less
error prone, since you cannot forget to serialize a member variable
through this mechanism. Future uses should be generating other repeating
code, such as `Clone` methods or perhaps some debug information.
.lcp files may contain mixed C++ code (enclosed in #>cpp ... cpp<#
blocks) with Common Lisp code.
NOTE: With great power comes great responsibility. Lisp metaprogramming
capabilities are incredibly powerful. To keep the sanity of the team
intact, use Lisp preprocessing only when *really* necessary.
Reviewers: buda, mferencevic, msantl, dgleich, ipaljak, mculinovic, mtomic
Reviewed By: mtomic
Subscribers: pullbot
Differential Revision: https://phabricator.memgraph.io/D1361
2018-04-27 21:48:30 +08:00
|
|
|
# -----------------------------------------------------------------------------
|
|
|
|
|
2018-01-15 19:19:55 +08:00
|
|
|
string(TOLOWER ${CMAKE_BUILD_TYPE} lower_build_type)
|
|
|
|
|
2017-12-04 20:56:17 +08:00
|
|
|
# memgraph_lib depend on these libraries
|
2017-12-22 21:36:25 +08:00
|
|
|
set(MEMGRAPH_ALL_LIBS stdc++fs Threads::Threads fmt cppitertools
|
2018-05-02 15:54:28 +08:00
|
|
|
antlr_opencypher_parser_lib dl glog gflags capnp kj
|
2018-01-15 18:16:19 +08:00
|
|
|
${Boost_IOSTREAMS_LIBRARY_RELEASE}
|
|
|
|
${Boost_SERIALIZATION_LIBRARY_RELEASE})
|
2017-12-04 20:56:17 +08:00
|
|
|
|
|
|
|
if (USE_LTALLOC)
|
|
|
|
list(APPEND MEMGRAPH_ALL_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 MEMGRAPH_ALL_LIBS readline)
|
|
|
|
endif()
|
|
|
|
|
|
|
|
# STATIC library used by memgraph executables
|
|
|
|
add_library(memgraph_lib STATIC ${memgraph_src_files})
|
|
|
|
target_link_libraries(memgraph_lib ${MEMGRAPH_ALL_LIBS})
|
|
|
|
add_dependencies(memgraph_lib generate_opencypher_parser)
|
Add Lisp C++ Preprocessing (LCP)
Summary:
In order to enhance C++ metaprogramming capabilities, a custom
preprocessing step is added before compilation. C++ code may be mixed
with Lisp code in order to generate a complete C++ source code. The
mechanism is hooked into cmake. To notify cmake of .lcp files, `add_lcp`
function in src/CMakeLists.txt needs to be invoked.
The main executable entry point is in tools/lcp, while the source code
is in src/lisp/lcp.lisp
The main goal of LCP is to auto generate class serialization code and
member variable getter functions. This should now be significantly less
error prone, since you cannot forget to serialize a member variable
through this mechanism. Future uses should be generating other repeating
code, such as `Clone` methods or perhaps some debug information.
.lcp files may contain mixed C++ code (enclosed in #>cpp ... cpp<#
blocks) with Common Lisp code.
NOTE: With great power comes great responsibility. Lisp metaprogramming
capabilities are incredibly powerful. To keep the sanity of the team
intact, use Lisp preprocessing only when *really* necessary.
Reviewers: buda, mferencevic, msantl, dgleich, ipaljak, mculinovic, mtomic
Reviewed By: mtomic
Subscribers: pullbot
Differential Revision: https://phabricator.memgraph.io/D1361
2018-04-27 21:48:30 +08:00
|
|
|
add_dependencies(memgraph_lib generate_lcp)
|
2018-05-02 15:54:28 +08:00
|
|
|
add_dependencies(memgraph_lib generate_capnp)
|
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-04-30 19:34:41 +08:00
|
|
|
# TODO: Create a utils lib to link with, and remove utils/file.cpp.
|
|
|
|
add_library(kvstore_lib STATIC storage/kvstore.cpp utils/file.cpp)
|
2018-04-30 21:05:14 +08:00
|
|
|
target_link_libraries(kvstore_lib stdc++fs fmt gflags glog rocksdb bzip2 zlib)
|
2018-04-27 17:23:40 +08:00
|
|
|
|
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
|
2017-12-11 22:51:53 +08:00
|
|
|
add_executable(memgraph memgraph_bolt.cpp)
|
|
|
|
target_link_libraries(memgraph memgraph_lib)
|
|
|
|
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)
|
|
|
|
# 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)
|