2016-12-18 04:00:32 +08:00
|
|
|
# MemGraph CMake configuration
|
|
|
|
|
2016-06-05 20:30:40 +08:00
|
|
|
cmake_minimum_required(VERSION 3.1)
|
2016-05-16 04:43:42 +08:00
|
|
|
|
2016-12-18 04:00:32 +08:00
|
|
|
# !! IMPORTANT !! run ./project_root/init.sh before cmake command
|
|
|
|
# to download dependencies
|
|
|
|
|
2017-02-17 23:11:57 +08:00
|
|
|
if(NOT UNIX)
|
2018-01-15 19:19:55 +08:00
|
|
|
message(FATAL_ERROR "Unsupported operating system.")
|
2017-02-17 23:11:57 +08:00
|
|
|
endif()
|
|
|
|
|
2017-03-08 15:59:37 +08:00
|
|
|
# Set `make clean` to ignore outputs of add_custom_command. If generated files
|
|
|
|
# need to be cleaned, set ADDITIONAL_MAKE_CLEAN_FILES property.
|
|
|
|
set_directory_properties(PROPERTIES CLEAN_NO_CUSTOM TRUE)
|
|
|
|
|
2017-03-08 01:25:49 +08:00
|
|
|
# ccache setup
|
|
|
|
# ccache isn't enabled all the time because it makes some problem
|
|
|
|
# during the code coverage process
|
2017-03-08 15:59:37 +08:00
|
|
|
find_program(CCACHE_FOUND ccache)
|
2017-03-08 01:25:49 +08:00
|
|
|
option(USE_CCACHE "ccache:" ON)
|
|
|
|
message(STATUS "CCache: ${USE_CCACHE}")
|
|
|
|
if(CCACHE_FOUND AND USE_CCACHE)
|
2017-02-23 22:34:04 +08:00
|
|
|
set_property(GLOBAL PROPERTY RULE_LAUNCH_COMPILE ccache)
|
|
|
|
set_property(GLOBAL PROPERTY RULE_LAUNCH_LINK ccache)
|
2017-03-08 01:25:49 +08:00
|
|
|
endif(CCACHE_FOUND AND USE_CCACHE)
|
2017-02-23 22:34:04 +08:00
|
|
|
|
2017-03-17 23:57:43 +08:00
|
|
|
# choose a compiler
|
2017-12-04 20:56:17 +08:00
|
|
|
# NOTE: must be choosen before use of project() or enable_language()
|
|
|
|
find_program(CLANG_FOUND clang)
|
|
|
|
find_program(CLANGXX_FOUND clang++)
|
|
|
|
if (CLANG_FOUND AND CLANGXX_FOUND)
|
|
|
|
set(CMAKE_C_COMPILER ${CLANG_FOUND})
|
|
|
|
set(CMAKE_CXX_COMPILER ${CLANGXX_FOUND})
|
2019-04-19 16:44:25 +08:00
|
|
|
else()
|
|
|
|
message(FATAL_ERROR "Couldn't find clang and/or clang++!")
|
2017-12-04 20:56:17 +08:00
|
|
|
endif()
|
|
|
|
|
|
|
|
# Get current commit hash.
|
|
|
|
execute_process(
|
|
|
|
OUTPUT_VARIABLE COMMIT_HASH
|
|
|
|
COMMAND git rev-parse --short HEAD
|
|
|
|
)
|
|
|
|
string(STRIP ${COMMIT_HASH} COMMIT_HASH)
|
|
|
|
|
2016-12-18 04:00:32 +08:00
|
|
|
# -----------------------------------------------------------------------------
|
|
|
|
|
2018-10-29 17:03:46 +08:00
|
|
|
project(memgraph VERSION 0.14.0)
|
2016-12-18 04:00:32 +08:00
|
|
|
# -----------------------------------------------------------------------------
|
2016-05-16 04:43:42 +08:00
|
|
|
|
2016-11-19 00:35:29 +08:00
|
|
|
# setup CMake module path, defines path for include() and find_package()
|
|
|
|
# https://cmake.org/cmake/help/latest/variable/CMAKE_MODULE_PATH.html
|
|
|
|
set(CMAKE_MODULE_PATH ${CMAKE_MODULE_PATH} ${PROJECT_SOURCE_DIR}/cmake)
|
2016-12-18 04:00:32 +08:00
|
|
|
# custom function definitions
|
|
|
|
include(functions)
|
|
|
|
# -----------------------------------------------------------------------------
|
2016-06-26 00:26:26 +08:00
|
|
|
|
2017-03-06 23:15:20 +08:00
|
|
|
# We want out of source builds, so that cmake generated files don't get mixed
|
|
|
|
# with source files. This allows for easier clean up.
|
|
|
|
disallow_in_source_build()
|
|
|
|
add_custom_target(clean_all
|
|
|
|
COMMAND ${CMAKE_COMMAND} -P ${PROJECT_SOURCE_DIR}/cmake/clean_all.cmake
|
|
|
|
COMMENT "Removing all files in ${CMAKE_BINARY_DIR}")
|
2016-12-18 04:00:32 +08:00
|
|
|
# -----------------------------------------------------------------------------
|
2016-08-08 16:32:34 +08:00
|
|
|
|
2017-12-04 20:56:17 +08:00
|
|
|
# build flags -----------------------------------------------------------------
|
|
|
|
|
2017-02-22 18:08:17 +08:00
|
|
|
# TODO: set here 17 once it will be available in the cmake version (3.8)
|
2017-10-13 21:30:06 +08:00
|
|
|
# set(CMAKE_CXX_STANDARD 17)
|
|
|
|
# set(CMAKE_CXX_STANDARD_REQUIRED ON)
|
|
|
|
# For now, explicitly set -std= flag for C++17.
|
2018-03-12 22:50:17 +08:00
|
|
|
set(CMAKE_CXX_FLAGS "${CMAKE_CXX_FLAGS} -std=c++1z -Wall \
|
|
|
|
-Werror=switch -Werror=switch-bool -Werror=return-type")
|
2017-10-20 22:53:24 +08:00
|
|
|
|
2017-08-30 21:37:00 +08:00
|
|
|
# Don't omit frame pointer in RelWithDebInfo, for additional callchain debug.
|
|
|
|
set(CMAKE_CXX_FLAGS_RELWITHDEBINFO
|
|
|
|
"${CMAKE_CXX_FLAGS_RELWITHDEBINFO} -fno-omit-frame-pointer")
|
Change to gold linker.
Summary:
Benchmark conducted showed positive performance change, a gain of ~20%.
Setup:
ccache disabled (export CCACHE_DISABLE=1)
cd build
rm -rf *
cmake ..
time make -j8
without gold linker
real 3m25,384s
user 11m58,337s
sys 0m37,747s
real 3m48,087s
user 12m57,600s
sys 0m36,837s
real 3m20,116s
user 12m9,570s
sys 0m33,643s
with gold linker
real 2m48,073s
user 10m2,257s
sys 0m27,480s
real 2m55,673s
user 10m13,420s
sys 0m27,233s
real 2m47,866s
user 10m2,377s
sys 0m27,323s
Reviewers: teon.banek, mislav.bradac, florijan, mferencevic
Reviewed By: mferencevic
Subscribers: pullbot
Differential Revision: https://phabricator.memgraph.io/D903
2017-10-17 17:24:22 +08:00
|
|
|
|
2018-03-20 18:12:20 +08:00
|
|
|
# Statically link libgcc and libstdc++, the GCC allows this according to:
|
2019-04-19 16:44:25 +08:00
|
|
|
# https://gcc.gnu.org/onlinedocs/gcc-8.3.0/libstdc++/manual/manual/license.html
|
2018-03-20 18:12:20 +08:00
|
|
|
# https://www.gnu.org/licenses/gcc-exception-faq.html
|
2019-04-19 16:44:25 +08:00
|
|
|
# Last checked for gcc-8.3 which we are using on the build machines.
|
2018-03-20 18:12:20 +08:00
|
|
|
# ** If we change versions, recheck this! **
|
|
|
|
# ** Static linking is allowed only for executables! **
|
|
|
|
set(CMAKE_EXE_LINKER_FLAGS "${CMAKE_EXE_LINKER_FLAGS} -static-libgcc -static-libstdc++")
|
|
|
|
|
Change to gold linker.
Summary:
Benchmark conducted showed positive performance change, a gain of ~20%.
Setup:
ccache disabled (export CCACHE_DISABLE=1)
cd build
rm -rf *
cmake ..
time make -j8
without gold linker
real 3m25,384s
user 11m58,337s
sys 0m37,747s
real 3m48,087s
user 12m57,600s
sys 0m36,837s
real 3m20,116s
user 12m9,570s
sys 0m33,643s
with gold linker
real 2m48,073s
user 10m2,257s
sys 0m27,480s
real 2m55,673s
user 10m13,420s
sys 0m27,233s
real 2m47,866s
user 10m2,377s
sys 0m27,323s
Reviewers: teon.banek, mislav.bradac, florijan, mferencevic
Reviewed By: mferencevic
Subscribers: pullbot
Differential Revision: https://phabricator.memgraph.io/D903
2017-10-17 17:24:22 +08:00
|
|
|
# Use gold linker to speedup build
|
|
|
|
set(CMAKE_EXE_LINKER_FLAGS "${CMAKE_EXE_LINKER_FLAGS} -fuse-ld=gold")
|
2016-06-27 06:43:28 +08:00
|
|
|
|
2017-02-17 23:11:57 +08:00
|
|
|
# release flags
|
2017-06-05 22:48:47 +08:00
|
|
|
set(CMAKE_CXX_FLAGS_RELEASE "-O2 -DNDEBUG")
|
2017-12-04 20:56:17 +08:00
|
|
|
|
2017-02-17 23:11:57 +08:00
|
|
|
#debug flags
|
2017-06-05 22:48:47 +08:00
|
|
|
set(PREFERRED_DEBUGGER "gdb" CACHE STRING
|
|
|
|
"Tunes the debug output for your preferred debugger (gdb or lldb).")
|
|
|
|
if ("${PREFERRED_DEBUGGER}" STREQUAL "gdb" AND
|
|
|
|
"${CMAKE_CXX_COMPILER_ID}" MATCHES "Clang|GNU")
|
|
|
|
set(CMAKE_CXX_FLAGS_DEBUG "-ggdb")
|
|
|
|
elseif ("${PREFERRED_DEBUGGER}" STREQUAL "lldb" AND
|
|
|
|
"${CMAKE_CXX_COMPILER_ID}" STREQUAL "Clang")
|
|
|
|
set(CMAKE_CXX_FLAGS_DEBUG "-glldb")
|
|
|
|
else()
|
|
|
|
message(WARNING "Unable to tune for PREFERRED_DEBUGGER: "
|
|
|
|
"'${PREFERRED_DEBUGGER}' with compiler: '${CMAKE_CXX_COMPILER_ID}'")
|
|
|
|
set(CMAKE_CXX_FLAGS_DEBUG "-g")
|
|
|
|
endif()
|
2017-02-17 23:11:57 +08:00
|
|
|
|
2017-12-04 20:56:17 +08:00
|
|
|
# ndebug
|
|
|
|
option(NDEBUG "No debug" OFF)
|
|
|
|
message(STATUS "NDEBUG: ${NDEBUG} (be careful CMAKE_BUILD_TYPE can also \
|
|
|
|
append this flag)")
|
|
|
|
if(NDEBUG)
|
|
|
|
add_definitions( -DNDEBUG )
|
|
|
|
endif()
|
|
|
|
# -----------------------------------------------------------------------------
|
|
|
|
|
2017-02-17 23:11:57 +08:00
|
|
|
# default build type is debug
|
2017-10-03 19:56:41 +08:00
|
|
|
if (NOT CMAKE_BUILD_TYPE)
|
2017-08-30 21:37:00 +08:00
|
|
|
set(CMAKE_BUILD_TYPE "Debug")
|
2017-02-17 23:11:57 +08:00
|
|
|
endif()
|
|
|
|
message(STATUS "CMake build type: ${CMAKE_BUILD_TYPE}")
|
|
|
|
# -----------------------------------------------------------------------------
|
|
|
|
|
|
|
|
# setup external dependencies -------------------------------------------------
|
2016-05-23 13:51:36 +08:00
|
|
|
|
2017-12-04 20:56:17 +08:00
|
|
|
# threading
|
|
|
|
find_package(Threads REQUIRED)
|
|
|
|
|
|
|
|
# optional Ltalloc
|
2018-02-23 21:46:36 +08:00
|
|
|
option(USE_LTALLOC "Use Ltalloc instead of default allocator (default OFF). \
|
|
|
|
Set this to ON to link with Ltalloc." OFF)
|
2017-12-04 20:56:17 +08:00
|
|
|
|
|
|
|
# optional readline
|
|
|
|
option(USE_READLINE "Use GNU Readline library if available (default ON). \
|
|
|
|
Set this to OFF to prevent linking with Readline even if it is available." ON)
|
|
|
|
if (USE_READLINE)
|
|
|
|
find_package(Readline)
|
|
|
|
if (READLINE_FOUND)
|
|
|
|
add_definitions(-DHAS_READLINE)
|
|
|
|
endif()
|
2016-06-15 06:06:21 +08:00
|
|
|
endif()
|
2016-12-18 04:00:32 +08:00
|
|
|
|
2018-06-20 23:44:47 +08:00
|
|
|
# OpenSSL
|
|
|
|
find_package(OpenSSL REQUIRED)
|
|
|
|
|
2017-12-04 20:56:17 +08:00
|
|
|
set(libs_dir ${CMAKE_SOURCE_DIR}/libs)
|
|
|
|
add_subdirectory(libs EXCLUDE_FROM_ALL)
|
2016-12-18 04:00:32 +08:00
|
|
|
|
2017-09-27 19:03:44 +08:00
|
|
|
include_directories(SYSTEM ${GFLAGS_INCLUDE_DIR})
|
2017-08-01 18:42:50 +08:00
|
|
|
include_directories(SYSTEM ${GLOG_INCLUDE_DIR})
|
2017-09-27 19:03:44 +08:00
|
|
|
include_directories(SYSTEM ${FMT_INCLUDE_DIR})
|
2017-12-04 20:56:17 +08:00
|
|
|
include_directories(SYSTEM ${ANTLR4_INCLUDE_DIR})
|
2018-04-27 17:23:40 +08:00
|
|
|
include_directories(SYSTEM ${BZIP2_INCLUDE_DIR})
|
|
|
|
include_directories(SYSTEM ${ZLIB_INCLUDE_DIR})
|
|
|
|
include_directories(SYSTEM ${ROCKSDB_INCLUDE_DIR})
|
2018-05-02 15:54:28 +08:00
|
|
|
include_directories(SYSTEM ${CAPNP_INCLUDE_DIR})
|
2018-06-19 20:37:02 +08:00
|
|
|
include_directories(SYSTEM ${LIBRDKAFKA_INCLUDE_DIR})
|
2016-08-10 16:39:02 +08:00
|
|
|
# -----------------------------------------------------------------------------
|
2016-05-25 06:37:14 +08:00
|
|
|
|
2017-02-17 23:11:57 +08:00
|
|
|
# openCypher parser -----------------------------------------------------------
|
|
|
|
set(opencypher_frontend ${CMAKE_SOURCE_DIR}/src/query/frontend/opencypher)
|
|
|
|
set(opencypher_generated ${opencypher_frontend}/generated)
|
2018-07-27 19:29:16 +08:00
|
|
|
set(opencypher_lexer_grammar ${opencypher_frontend}/grammar/MemgraphCypherLexer.g4)
|
|
|
|
set(opencypher_parser_grammar ${opencypher_frontend}/grammar/MemgraphCypher.g4)
|
2017-02-17 23:11:57 +08:00
|
|
|
|
|
|
|
# enumerate all files that are generated from antlr
|
|
|
|
set(antlr_opencypher_generated_src
|
2018-07-27 19:29:16 +08:00
|
|
|
${opencypher_generated}/MemgraphCypherLexer.cpp
|
|
|
|
${opencypher_generated}/MemgraphCypher.cpp
|
|
|
|
${opencypher_generated}/MemgraphCypherBaseVisitor.cpp
|
|
|
|
${opencypher_generated}/MemgraphCypherVisitor.cpp
|
2017-02-17 23:11:57 +08:00
|
|
|
)
|
2016-05-25 06:37:14 +08:00
|
|
|
|
2017-03-08 15:59:37 +08:00
|
|
|
# Provide a command to generate sources if missing. If this were a
|
|
|
|
# custom_target, it would always run and we don't want that.
|
|
|
|
add_custom_command(OUTPUT ${antlr_opencypher_generated_src}
|
|
|
|
COMMAND
|
|
|
|
${CMAKE_COMMAND} -E make_directory ${opencypher_generated}
|
|
|
|
COMMAND
|
2018-07-26 16:33:15 +08:00
|
|
|
java -jar ${CMAKE_SOURCE_DIR}/libs/antlr-4.6-complete.jar -Dlanguage=Cpp -visitor -o ${opencypher_generated} -package antlropencypher ${opencypher_lexer_grammar} ${opencypher_parser_grammar}
|
2017-03-08 15:59:37 +08:00
|
|
|
WORKING_DIRECTORY "${CMAKE_BINARY_DIR}"
|
2018-10-12 17:20:53 +08:00
|
|
|
DEPENDS ${opencypher_lexer_grammar} ${opencypher_parser_grammar}
|
|
|
|
${opencypher_frontend}/grammar/CypherLexer.g4
|
|
|
|
${opencypher_frontend}/grammar/Cypher.g4)
|
2017-03-08 15:59:37 +08:00
|
|
|
|
2017-02-17 23:11:57 +08:00
|
|
|
# add custom target for generation
|
|
|
|
add_custom_target(generate_opencypher_parser
|
2017-03-08 15:59:37 +08:00
|
|
|
DEPENDS ${antlr_opencypher_generated_src})
|
2017-02-17 23:11:57 +08:00
|
|
|
|
|
|
|
add_library(antlr_opencypher_parser_lib STATIC ${antlr_opencypher_generated_src})
|
2017-10-03 19:56:41 +08:00
|
|
|
target_link_libraries(antlr_opencypher_parser_lib antlr4)
|
2017-02-17 23:11:57 +08:00
|
|
|
# -----------------------------------------------------------------------------
|
2016-06-26 00:26:26 +08:00
|
|
|
|
2017-12-04 20:56:17 +08:00
|
|
|
# Optional subproject configuration -------------------------------------------
|
2018-03-27 04:35:55 +08:00
|
|
|
option(POC "Build proof of concept binaries" OFF)
|
2017-12-04 20:56:17 +08:00
|
|
|
option(EXPERIMENTAL "Build experimental binaries" OFF)
|
2018-03-27 04:35:55 +08:00
|
|
|
option(CUSTOMERS "Build customer binaries" OFF)
|
2018-01-15 19:19:55 +08:00
|
|
|
option(TEST_COVERAGE "Generate coverage reports from running memgraph" OFF)
|
2018-03-27 04:35:55 +08:00
|
|
|
option(TOOLS "Build tools binaries" ON)
|
2018-04-20 20:58:49 +08:00
|
|
|
option(MG_COMMUNITY "Build Memgraph Community Edition" OFF)
|
2018-05-28 17:04:09 +08:00
|
|
|
option(ASAN "Build with Address Sanitizer. To get a reasonable performance option should be used only in Release or RelWithDebInfo build " OFF)
|
|
|
|
option(TSAN "Build with Thread Sanitizer. To get a reasonable performance option should be used only in Release or RelWithDebInfo build " OFF)
|
|
|
|
option(UBSAN "Build with Undefined Behaviour Sanitizer" OFF)
|
|
|
|
option(THIN_LTO "Build with link time optimization" OFF)
|
2017-12-04 20:56:17 +08:00
|
|
|
|
2018-01-15 19:19:55 +08:00
|
|
|
if (TEST_COVERAGE)
|
|
|
|
string(TOLOWER ${CMAKE_BUILD_TYPE} lower_build_type)
|
|
|
|
if (NOT lower_build_type STREQUAL "debug")
|
|
|
|
message(FATAL_ERROR "Generating test coverage unsupported in non Debug builds. Current build type is '${CMAKE_BUILD_TYPE}'")
|
|
|
|
endif()
|
|
|
|
set(CMAKE_CXX_FLAGS "${CMAKE_CXX_FLAGS} -fprofile-instr-generate -fcoverage-mapping")
|
|
|
|
set(CMAKE_EXE_LINKER_FLAGS "${CMAKE_EXE_LINKER_FLAGS} -fprofile-instr-generate -fcoverage-mapping")
|
|
|
|
endif()
|
|
|
|
|
2018-04-20 20:58:49 +08:00
|
|
|
if (MG_COMMUNITY)
|
|
|
|
add_definitions(-DMG_COMMUNITY)
|
|
|
|
endif()
|
|
|
|
|
2018-05-28 17:04:09 +08:00
|
|
|
if (ASAN)
|
|
|
|
# Enable Addres sanitizer and get nicer stack traces in error messages.
|
|
|
|
# NOTE: AddressSanitizer uses llvm-symbolizer binary from the Clang
|
|
|
|
# distribution to symbolize the stack traces (note that ideally the
|
|
|
|
# llvm-symbolizer version must match the version of ASan runtime library).
|
|
|
|
# Just make sure llvm-symbolizer is in PATH before running the binary or
|
|
|
|
# provide it in separate ASAN_SYMBOLIZER_PATH environment variable.
|
|
|
|
set(CMAKE_CXX_FLAGS "${CMAKE_CXX_FLAGS} -fsanitize=address -fno-omit-frame-pointer")
|
|
|
|
set(CMAKE_EXE_LINKER_FLAGS "${CMAKE_EXE_LINKER_FLAGS} -fsanitize=address")
|
|
|
|
# To detect Stack-use-after-return bugs set run-time flag:
|
|
|
|
# ASAN_OPTIONS=detect_stack_use_after_return=1
|
|
|
|
# To check initialization order bugs set run-time flag:
|
|
|
|
# ASAN_OPTIONS=check_initialization_order=true
|
|
|
|
# This mode reports an error if initializer for a global variable accesses
|
|
|
|
# dynamically initialized global from another translation unit, which is
|
|
|
|
# not yet initialized
|
|
|
|
# ASAN_OPTIONS=strict_init_order=true
|
|
|
|
# This mode reports an error if initializer for a global variable accesses
|
|
|
|
# any dynamically initialized global from another translation unit.
|
|
|
|
endif()
|
|
|
|
|
|
|
|
if (TSAN)
|
|
|
|
# ThreadSanitizer generally requires all code to be compiled with -fsanitize=thread.
|
|
|
|
# If some code (e.g. dynamic libraries) is not compiled with the flag, it can
|
|
|
|
# lead to false positive race reports, false negative race reports and/or
|
|
|
|
# missed stack frames in reports depending on the nature of non-instrumented
|
|
|
|
# code. To not produce false positive reports ThreadSanitizer has to see all
|
|
|
|
# synchronization in the program, some synchronization operations (namely,
|
|
|
|
# atomic operations and thread-safe static initialization) are intercepted
|
|
|
|
# during compilation (and can only be intercepted during compilation).
|
|
|
|
# ThreadSanitizer stack trace collection also relies on compiler instrumentation
|
|
|
|
# (unwinding stack on each memory access is too expensive).
|
|
|
|
set(CMAKE_CXX_FLAGS "${CMAKE_CXX_FLAGS} -fsanitize=thread")
|
|
|
|
set(CMAKE_EXE_LINKER_FLAGS "${CMAKE_EXE_LINKER_FLAGS} -fsanitize=thread")
|
|
|
|
# By default ThreadSanitizer uses addr2line utility to symbolize reports.
|
|
|
|
# llvm-symbolizer is faster, consumes less memory and produces much better
|
|
|
|
# reports. To use it set runtime flag:
|
|
|
|
# TSAN_OPTIONS="extern-symbolizer-path=~/llvm-symbolizer"
|
|
|
|
# For more runtime flags see: https://github.com/google/sanitizers/wiki/ThreadSanitizerFlags
|
|
|
|
endif()
|
|
|
|
|
|
|
|
if (UBSAN)
|
|
|
|
# Compile with UBSAN but disable vptr check. This is disabled because it
|
|
|
|
# requires linking with clang++ to make sure C++ specific parts of the
|
|
|
|
# runtime library and c++ standard libraries are present.
|
|
|
|
set(CMAKE_CXX_FLAGS "${CMAKE_CXX_FLAGS} -fsanitize=undefined -fno-omit-frame-pointer -fno-sanitize=vptr")
|
|
|
|
set(CMAKE_EXE_LINKER_FLAGS "${CMAKE_EXE_LINKER_FLAGS} -fsanitize=undefined -fno-sanitize=vptr")
|
|
|
|
# Run program with environment variable UBSAN_OPTIONS=print_stacktrace=1
|
|
|
|
# Make sure llvm-symbolizer binary is in path
|
|
|
|
endif()
|
|
|
|
|
|
|
|
if (THIN_LTO)
|
|
|
|
set(CMAKE_CXX_FLAGS"${CMAKE_CXX_FLAGS} -flto=thin")
|
|
|
|
set(CMAKE_EXE_LINKER_FLAGS "${CMAKE_EXE_LINKER_FLAGS} -flto=thin")
|
|
|
|
endif()
|
|
|
|
|
2018-01-15 19:19:55 +08:00
|
|
|
# Add subprojects
|
|
|
|
include_directories(src)
|
|
|
|
add_subdirectory(src)
|
|
|
|
|
2017-12-04 20:56:17 +08:00
|
|
|
if(POC)
|
|
|
|
add_subdirectory(poc)
|
2016-08-10 16:39:02 +08:00
|
|
|
endif()
|
2017-08-03 18:08:39 +08:00
|
|
|
|
2017-12-04 20:56:17 +08:00
|
|
|
if(EXPERIMENTAL)
|
|
|
|
add_subdirectory(experimental)
|
2017-08-03 18:08:39 +08:00
|
|
|
endif()
|
2016-08-08 16:32:34 +08:00
|
|
|
|
2017-12-04 20:56:17 +08:00
|
|
|
if(CUSTOMERS)
|
|
|
|
add_subdirectory(customers)
|
Add parallel customers/Otto test
Summary:
Looking for connected components in a random graph. This test performs the following:
- Generates a random graph that is NOT sequential in memory (otherwise itertion over edges is 2 or more times faster).
- Connectivity by iterating over all the edges.
- Ditto over vertices.
- Ditto over vertices in parallel.
Not done:
- Edge filtering based on XY. I could/should add that to see how it affects perf.
- Getting component info out from union-find.
Local results are encouraging. Iterating over the graph is the bottleneck. Still, I get connectivity of 10M vertices/edges in <7sec (parallel over vertices). Will test on 250M remote now.
Locally obtained results (20M/20M, 2 threads)
```
I1115 14:57:55.136875 357 otto_parallel.cpp:50] Generating 2000000 vertices...
I1115 14:58:19.057734 357 otto_parallel.cpp:74] Generated 2000000 vertices in 23.9208 seconds.
I1115 14:58:19.919221 357 otto_parallel.cpp:82] Generating 2000000 edges...
I1115 14:58:39.519951 357 otto_parallel.cpp:93] Generated 2000000 edges in 19.3398 seconds.
I1115 14:58:39.520349 357 otto_parallel.cpp:196] Running Edge iteration...
I1115 14:58:43.857264 357 otto_parallel.cpp:199] Done in 4.33691 seconds, result: 3999860270398
I1115 14:58:43.857316 357 otto_parallel.cpp:196] Running Vertex iteration...
I1115 14:58:49.498181 357 otto_parallel.cpp:199] Done in 5.64087 seconds, result: 4000090070787
I1115 14:58:49.498208 357 otto_parallel.cpp:196] Running Connected components - Edges...
I1115 14:58:54.232530 357 otto_parallel.cpp:199] Done in 4.73433 seconds, result: 323935
I1115 14:58:54.232570 357 otto_parallel.cpp:196] Running Connected components - Vertices...
I1115 14:59:00.412395 357 otto_parallel.cpp:199] Done in 6.17983 seconds, result: 323935
I1115 14:59:00.412422 357 otto_parallel.cpp:196] Running Parallel connected components - Vertices...
I1115 14:59:04.662087 357 otto_parallel.cpp:199] Done in 4.24967 seconds, result: 323935
I1115 14:59:04.662116 357 otto_parallel.cpp:196] Running Expansion...
I1115 14:59:13.913015 357 otto_parallel.cpp:199] Done in 9.25091 seconds, result: 323935
```
Reviewers: buda, mislav.bradac, dgleich, teon.banek
Reviewed By: buda, teon.banek
Subscribers: teon.banek, pullbot
Differential Revision: https://phabricator.memgraph.io/D982
2017-11-22 17:04:12 +08:00
|
|
|
endif()
|
|
|
|
|
2017-10-13 21:30:06 +08:00
|
|
|
enable_testing()
|
2017-07-10 21:22:43 +08:00
|
|
|
add_subdirectory(tests)
|
2016-10-13 21:42:19 +08:00
|
|
|
|
2017-12-04 20:56:17 +08:00
|
|
|
if(TOOLS)
|
|
|
|
add_subdirectory(tools)
|
2016-08-10 16:39:02 +08:00
|
|
|
endif()
|
2017-12-04 20:56:17 +08:00
|
|
|
|
|
|
|
# -----------------------------------------------------------------------------
|
2017-09-26 20:25:01 +08:00
|
|
|
|
|
|
|
# ---- Setup CPack --------
|
|
|
|
# General setup
|
|
|
|
set(CPACK_PACKAGE_NAME memgraph)
|
|
|
|
set(CPACK_PACKAGE_VENDOR "Memgraph Ltd.")
|
|
|
|
set(CPACK_PACKAGE_DESCRIPTION_SUMMARY
|
|
|
|
"High performance, in-memory, transactional graph database")
|
2017-10-06 19:10:31 +08:00
|
|
|
set(CPACK_PACKAGE_VERSION_MAJOR ${memgraph_VERSION_MAJOR})
|
|
|
|
set(CPACK_PACKAGE_VERSION_MINOR ${memgraph_VERSION_MINOR})
|
|
|
|
set(CPACK_PACKAGE_VERSION_PATCH ${memgraph_VERSION_PATCH})
|
|
|
|
set(CPACK_PACKAGE_VERSION_TWEAK ${memgraph_VERSION_TWEAK})
|
|
|
|
set(CPACK_PACKAGE_FILE_NAME ${CPACK_PACKAGE_NAME}-${memgraph_VERSION}-${COMMIT_HASH}${CPACK_SYSTEM_NAME})
|
2018-03-27 21:14:47 +08:00
|
|
|
|
2017-09-26 20:25:01 +08:00
|
|
|
# DEB specific
|
2017-11-22 23:40:39 +08:00
|
|
|
# Instead of using "name <email>" format, we use "email (name)" to prevent
|
|
|
|
# errors due to full stop, '.' at the end of "Ltd". (See: RFC 822)
|
|
|
|
set(CPACK_DEBIAN_PACKAGE_MAINTAINER "tech@memgraph.com (Memgraph Ltd.)")
|
|
|
|
set(CPACK_DEBIAN_PACKAGE_SECTION non-free/database)
|
2017-09-26 20:25:01 +08:00
|
|
|
set(CPACK_DEBIAN_PACKAGE_HOMEPAGE https://memgraph.com)
|
2017-11-22 23:40:39 +08:00
|
|
|
set(CPACK_DEBIAN_PACKAGE_CONTROL_EXTRA
|
2018-01-12 22:21:45 +08:00
|
|
|
"${CMAKE_SOURCE_DIR}/release/debian/conffiles;"
|
|
|
|
"${CMAKE_SOURCE_DIR}/release/debian/copyright;"
|
|
|
|
"${CMAKE_SOURCE_DIR}/release/debian/prerm;"
|
|
|
|
"${CMAKE_SOURCE_DIR}/release/debian/postrm;"
|
|
|
|
"${CMAKE_SOURCE_DIR}/release/debian/postinst;")
|
2017-09-26 20:25:01 +08:00
|
|
|
set(CPACK_DEBIAN_PACKAGE_SHLIBDEPS ON)
|
2017-11-22 23:40:39 +08:00
|
|
|
# Description formatting is important, summary must be followed with a newline and 1 space.
|
|
|
|
set(CPACK_DEBIAN_PACKAGE_DESCRIPTION "${CPACK_PACKAGE_DESCRIPTION_SUMMARY}
|
|
|
|
Contains Memgraph, the graph database. It aims to deliver developers the
|
|
|
|
speed, simplicity and scale required to build the next generation of
|
|
|
|
applications driver by real-time connected data.")
|
2018-06-20 23:44:47 +08:00
|
|
|
# Add `openssl` package to dependencies list. Used to generate SSL certificates.
|
2018-06-22 01:03:45 +08:00
|
|
|
set(CPACK_DEBIAN_PACKAGE_DEPENDS "openssl (>= 1.1.0)")
|
2018-03-27 21:14:47 +08:00
|
|
|
|
|
|
|
# RPM specific
|
2018-04-10 16:40:03 +08:00
|
|
|
set(CPACK_RPM_PACKAGE_URL https://memgraph.com)
|
|
|
|
set(CPACK_RPM_EXCLUDE_FROM_AUTO_FILELIST_ADDITION
|
|
|
|
/var /var/lib /var/log /etc/logrotate.d
|
|
|
|
/lib /lib/systemd /lib/systemd/system /lib/systemd/system/memgraph.service)
|
|
|
|
set(CPACK_RPM_PACKAGE_REQUIRES_PRE "shadow-utils")
|
|
|
|
# NOTE: user specfile has a bug in cmake 3.7.2, this needs to be patched
|
|
|
|
# manually in: ~/cmake/share/cmake-3.7/Modules/CPackRPM.cmake line 2273
|
|
|
|
# Or newer cmake version used
|
|
|
|
set(CPACK_RPM_USER_BINARY_SPECFILE "${CMAKE_SOURCE_DIR}/release/rpm/memgraph.spec.in")
|
2018-03-27 21:14:47 +08:00
|
|
|
# Description formatting is important, no line must be greater than 80 characters.
|
|
|
|
set(CPACK_RPM_PACKAGE_DESCRIPTION "Contains Memgraph, the graph database.
|
2018-04-10 16:40:03 +08:00
|
|
|
It aims to deliver developers the speed, simplicity and scale required to build
|
|
|
|
the next generation of applications driver by real-time connected data.")
|
2018-06-20 23:44:47 +08:00
|
|
|
# Add `openssl` package to dependencies list. Used to generate SSL certificates.
|
2018-12-17 20:50:36 +08:00
|
|
|
set(CPACK_RPM_PACKAGE_REQUIRES "openssl >= 1.0.0, curl >= 7.29.0")
|
2018-03-27 21:14:47 +08:00
|
|
|
|
2017-09-26 20:25:01 +08:00
|
|
|
# All variables must be set before including.
|
|
|
|
include(CPack)
|
|
|
|
# ---- End Setup CPack ----
|