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)
|
|
|
|
message(FATAL "Unsupported operating system.")
|
|
|
|
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-02-17 23:11:57 +08:00
|
|
|
# NOTE: must be choosen before use of project() or enable_language() ----------
|
2016-12-18 04:00:32 +08:00
|
|
|
set(CMAKE_C_COMPILER "clang")
|
|
|
|
set(CMAKE_CXX_COMPILER "clang++")
|
|
|
|
# -----------------------------------------------------------------------------
|
|
|
|
|
|
|
|
# set project name
|
2016-05-16 04:43:42 +08:00
|
|
|
# get directory name
|
2016-12-16 21:05:04 +08:00
|
|
|
get_filename_component(project_name ${CMAKE_SOURCE_DIR} NAME)
|
2016-05-16 04:43:42 +08:00
|
|
|
# replace whitespaces with underscores
|
2016-12-16 21:05:04 +08:00
|
|
|
string(REPLACE " " "_" project_name ${project_name})
|
2016-05-16 04:43:42 +08:00
|
|
|
# set project name
|
2016-12-16 21:05:04 +08:00
|
|
|
project(${project_name})
|
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
|
|
|
# -----------------------------------------------------------------------------
|
2016-11-19 00:35:29 +08:00
|
|
|
|
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
|
|
|
# threading
|
|
|
|
find_package(Threads REQUIRED)
|
2017-06-07 16:15:08 +08:00
|
|
|
|
2017-03-24 16:50:52 +08:00
|
|
|
# optional readline
|
|
|
|
find_package(Readline REQUIRED)
|
|
|
|
if (READLINE_FOUND)
|
|
|
|
include_directories(SYSTEM ${READLINE_INCLUDE_DIR})
|
|
|
|
add_definitions(-DHAS_READLINE)
|
|
|
|
endif()
|
|
|
|
|
2016-12-18 04:00:32 +08:00
|
|
|
# -----------------------------------------------------------------------------
|
2016-08-08 16:32:34 +08:00
|
|
|
|
2016-05-25 06:37:14 +08:00
|
|
|
# c++14
|
2017-02-22 18:08:17 +08:00
|
|
|
# TODO: set here 17 once it will be available in the cmake version (3.8)
|
2016-12-16 21:05:04 +08:00
|
|
|
set(cxx_standard 14)
|
2017-06-05 22:48:47 +08:00
|
|
|
set(CMAKE_CXX_FLAGS "${CMAKE_CXX_FLAGS} -std=c++1z -Wall -Wno-c++1z-extensions")
|
2016-12-18 04:00:32 +08:00
|
|
|
# -----------------------------------------------------------------------------
|
2016-06-27 06:43:28 +08:00
|
|
|
|
2016-12-18 04:00:32 +08:00
|
|
|
# dir variables
|
2016-05-29 03:18:26 +08:00
|
|
|
set(src_dir ${CMAKE_SOURCE_DIR}/src)
|
|
|
|
set(libs_dir ${CMAKE_SOURCE_DIR}/libs)
|
2017-02-14 16:37:32 +08:00
|
|
|
set(tests_dir ${CMAKE_SOURCE_DIR}/tests)
|
2016-12-18 04:00:32 +08:00
|
|
|
# -----------------------------------------------------------------------------
|
2016-05-23 13:51:36 +08:00
|
|
|
|
2017-02-17 23:11:57 +08:00
|
|
|
# build flags -----------------------------------------------------------------
|
|
|
|
# release flags
|
2017-06-05 22:48:47 +08:00
|
|
|
set(CMAKE_CXX_FLAGS_RELEASE "-O2 -DNDEBUG")
|
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
|
|
|
|
|
|
|
# default build type is debug
|
|
|
|
if ("${CMAKE_BUILD_TYPE}" STREQUAL "")
|
|
|
|
set(CMAKE_BUILD_TYPE "debug")
|
|
|
|
endif()
|
|
|
|
message(STATUS "CMake build type: ${CMAKE_BUILD_TYPE}")
|
|
|
|
# -----------------------------------------------------------------------------
|
|
|
|
|
|
|
|
# setup external dependencies -------------------------------------------------
|
|
|
|
add_subdirectory(libs)
|
2016-06-26 00:26:26 +08:00
|
|
|
# fmt
|
|
|
|
set(fmt_source_dir ${libs_dir}/fmt)
|
|
|
|
set(fmt_static_lib ${fmt_source_dir}/fmt/libfmt.a)
|
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
|
2017-02-19 01:03:48 +08:00
|
|
|
# copy query_engine template file
|
|
|
|
set(query_engine_template_file ${src_dir}/query/plan_template_cpp)
|
2017-07-10 21:22:43 +08:00
|
|
|
configure_file(${query_engine_template_file}
|
|
|
|
${CMAKE_BINARY_DIR}/tests/template/plan_template_cpp COPYONLY)
|
|
|
|
configure_file(${query_engine_template_file}
|
|
|
|
${CMAKE_BINARY_DIR}/tests/integration/template/plan_template_cpp COPYONLY)
|
|
|
|
configure_file(${query_engine_template_file}
|
|
|
|
${CMAKE_BINARY_DIR}/tests/manual/template/plan_template_cpp COPYONLY)
|
|
|
|
configure_file(${query_engine_template_file}
|
|
|
|
${CMAKE_BINARY_DIR}/template/plan_template_cpp COPYONLY)
|
2016-06-27 06:43:28 +08:00
|
|
|
# create destination folder for compiled queries
|
2017-02-14 16:37:32 +08:00
|
|
|
FILE(MAKE_DIRECTORY ${CMAKE_BINARY_DIR}/tests/integration/compiled)
|
|
|
|
FILE(MAKE_DIRECTORY ${CMAKE_BINARY_DIR}/tests/manual/compiled)
|
|
|
|
FILE(MAKE_DIRECTORY ${CMAKE_BINARY_DIR}/tests/compiled)
|
|
|
|
FILE(MAKE_DIRECTORY ${CMAKE_BINARY_DIR}/compiled)
|
|
|
|
# copy hardcoded queries
|
2017-07-10 21:22:43 +08:00
|
|
|
file(GLOB __HARDCODED_FILES
|
|
|
|
${CMAKE_SOURCE_DIR}/tests/integration/hardcoded_query/*)
|
|
|
|
foreach(file_path ${__HARDCODED_FILES})
|
|
|
|
get_filename_component(file_name ${file_path} NAME)
|
|
|
|
configure_file(${file_path} ${CMAKE_BINARY_DIR}/tests/integration/hardcoded_query/${file_name} COPYONLY)
|
|
|
|
endforeach()
|
2017-07-18 21:29:11 +08:00
|
|
|
set(print_record_stream_path ${CMAKE_SOURCE_DIR}/tests/integration/print_record_stream.hpp)
|
|
|
|
get_filename_component(print_record_stream_file_name ${print_record_stream_path} NAME)
|
|
|
|
configure_file(${print_record_stream_path} ${CMAKE_BINARY_DIR}/tests/integration/${print_record_stream_file_name} COPYONLY)
|
2016-12-18 04:00:32 +08:00
|
|
|
# -----------------------------------------------------------------------------
|
2016-06-27 06:43:28 +08:00
|
|
|
|
2016-12-02 20:48:14 +08:00
|
|
|
# linter setup (clang-tidy)
|
|
|
|
# all source files for linting
|
|
|
|
FILE(GLOB_RECURSE LINTER_SRC_FILES
|
|
|
|
${src_dir}/*.cpp
|
|
|
|
${CMAKE_SOURCE_DIR}/tests/.cpp
|
|
|
|
${CMAKE_SOURCE_DIR}/poc/.cpp
|
|
|
|
)
|
|
|
|
MESSAGE(STATUS "All cpp files for linting are: ${LINTER_SRC_FILES}")
|
|
|
|
# linter target clang-tidy
|
|
|
|
find_program(CLANG_TIDY "clang-tidy")
|
|
|
|
if(CLANG_TIDY)
|
|
|
|
add_custom_target(
|
|
|
|
clang-tidy
|
|
|
|
COMMAND /usr/bin/clang-tidy
|
|
|
|
${LINTER_SRC_FILES}
|
|
|
|
-config=''
|
|
|
|
--
|
|
|
|
-std=c++1y
|
2017-06-13 22:25:08 +08:00
|
|
|
-I${CMAKE_SOURCE_DIR}/include -I${fmt_source_dir}
|
2016-12-02 20:48:14 +08:00
|
|
|
)
|
|
|
|
endif()
|
2016-12-18 04:00:32 +08:00
|
|
|
# -----------------------------------------------------------------------------
|
|
|
|
|
2017-01-08 08:03:12 +08:00
|
|
|
# custom assert control parameters
|
|
|
|
|
2017-02-24 17:15:18 +08:00
|
|
|
# Debug assert, if value is OFF debug asserts will be inactive.
|
|
|
|
# Default value is ON.
|
|
|
|
option(DEBUG_ASSERT "Enable debug assertions" ON)
|
|
|
|
message(STATUS "DEBUG_ASSERT: ${DEBUG_ASSERT}")
|
|
|
|
if(DEBUG_ASSERT)
|
|
|
|
add_definitions(-DDEBUG_ASSERT_ON)
|
2016-06-15 06:06:21 +08:00
|
|
|
endif()
|
|
|
|
|
2017-01-08 08:03:12 +08:00
|
|
|
# by default on custom assert only the message, filename and line number will be
|
|
|
|
# printed on stderr, if STACKTRACE_ASSERT is ON the whole stacktrace is going to
|
|
|
|
# be printed on stderr
|
|
|
|
option(STACKTRACE_ASSERT "Dump stacktrace on custom assert" OFF)
|
|
|
|
message(STATUS "STACKTRACE_ASSERT: ${STACKTRACE_ASSERT}")
|
|
|
|
if(STACKTRACE_ASSERT)
|
|
|
|
add_definitions(-DSTACKTRACE_ASSERT_ON)
|
2016-06-15 06:06:21 +08:00
|
|
|
endif()
|
2016-12-18 04:00:32 +08:00
|
|
|
# -----------------------------------------------------------------------------
|
|
|
|
|
|
|
|
# ndebug
|
2016-06-15 06:06:21 +08:00
|
|
|
option(NDEBUG "No debug" OFF)
|
2016-12-18 04:00:32 +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-12-18 04:00:32 +08:00
|
|
|
# -----------------------------------------------------------------------------
|
|
|
|
|
2016-10-13 21:42:19 +08:00
|
|
|
# -- GLIBCXX_DEBUG ------------------------------------------------------------
|
|
|
|
# glibcxx debug (useful for gdb)
|
|
|
|
# the problem is that the query engine doesn't work as it should work if
|
2016-12-18 04:00:32 +08:00
|
|
|
# this flag is present (TODO: figure out why)
|
2016-10-13 21:42:19 +08:00
|
|
|
option(GLIBCXX_DEBUG "glibc debug" OFF)
|
2016-12-18 04:00:32 +08:00
|
|
|
message(STATUS "GLIBCXX_DEBUG: ${GLIBCXX_DEBUG} (solves problem with \
|
|
|
|
_M_dataplus member during a debugging process)")
|
2016-10-13 21:42:19 +08:00
|
|
|
if(GLIBCXX_DEBUG)
|
|
|
|
set(CMAKE_CXX_FLAGS_DEBUG "-D_GLIBCXX_DEBUG ${CMAKE_CXX_FLAGS_DEBUG}")
|
|
|
|
endif()
|
|
|
|
# -----------------------------------------------------------------------------
|
2016-12-18 04:00:32 +08:00
|
|
|
|
|
|
|
# option binaries
|
|
|
|
# memgraph
|
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-12-18 04:00:32 +08:00
|
|
|
# proof of concept
|
2017-03-24 00:08:38 +08:00
|
|
|
option(POC "Build proof of concept binaries" ON)
|
2016-08-11 11:47:30 +08:00
|
|
|
message(STATUS "POC binaries: ${POC}")
|
2016-12-18 04:00:32 +08:00
|
|
|
# tests
|
2017-03-22 22:53:30 +08:00
|
|
|
option(HARDCODED_TARGETS "Make hardcoded query targets" ON)
|
|
|
|
message(STATUS "Make hardcoded query targets: ${HARDCODED_TARGETS}")
|
2017-03-09 20:52:21 +08:00
|
|
|
option(TEST_COVERAGE "Generate coverage reports from unit tests" OFF)
|
|
|
|
message(STATUS "Generate coverage from unit tests: ${TEST_COVERAGE}")
|
2016-12-18 04:00:32 +08:00
|
|
|
# -----------------------------------------------------------------------------
|
|
|
|
|
|
|
|
# includes
|
2016-05-25 06:37:14 +08:00
|
|
|
include_directories(${src_dir})
|
2017-03-17 23:57:43 +08:00
|
|
|
include_directories(SYSTEM ${GTEST_INCLUDE_DIRS} ${GMOCK_INCLUDE_DIRS})
|
|
|
|
include_directories(SYSTEM ${CMAKE_SOURCE_DIR}/libs)
|
2017-06-16 21:03:59 +08:00
|
|
|
# needed to include configured files (plan_compiler_flags.hpp)
|
|
|
|
set(generated_headers_dir ${CMAKE_BINARY_DIR}/generated_headers)
|
|
|
|
include_directories(${generated_headers_dir})
|
2017-06-16 18:04:26 +08:00
|
|
|
include_directories(SYSTEM ${CMAKE_SOURCE_DIR}/libs/glog/include)
|
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(antlr_src ${CMAKE_SOURCE_DIR}/libs/antlr4/runtime/Cpp/runtime/src)
|
|
|
|
set(opencypher_frontend ${CMAKE_SOURCE_DIR}/src/query/frontend/opencypher)
|
|
|
|
set(opencypher_generated ${opencypher_frontend}/generated)
|
|
|
|
set(opencypher_grammar ${opencypher_frontend}/grammar/Cypher.g4)
|
|
|
|
|
|
|
|
# enumerate all files that are generated from antlr
|
|
|
|
set(antlr_opencypher_generated_src
|
2017-03-17 23:57:43 +08:00
|
|
|
${opencypher_generated}/CypherLexer.cpp
|
2017-03-08 15:59:37 +08:00
|
|
|
${opencypher_generated}/CypherParser.cpp
|
|
|
|
${opencypher_generated}/CypherBaseVisitor.cpp
|
|
|
|
${opencypher_generated}/CypherVisitor.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
|
|
|
|
java -jar ${CMAKE_SOURCE_DIR}/libs/antlr-4.6-complete.jar -Dlanguage=Cpp -visitor -o ${opencypher_generated} -package antlropencypher ${opencypher_grammar}
|
|
|
|
WORKING_DIRECTORY "${CMAKE_BINARY_DIR}"
|
|
|
|
DEPENDS ${opencypher_grammar})
|
|
|
|
|
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
|
|
|
|
|
|
|
# include antlr header files
|
|
|
|
include_directories(
|
|
|
|
${antlr_src}
|
|
|
|
${antlr_src}/misc
|
|
|
|
${antlr_src}/atn
|
|
|
|
${antlr_src}/dfa
|
|
|
|
${antlr_src}/tree
|
|
|
|
${antlr_src}/support
|
|
|
|
)
|
|
|
|
|
|
|
|
add_library(antlr_opencypher_parser_lib STATIC ${antlr_opencypher_generated_src})
|
2017-02-20 16:37:48 +08:00
|
|
|
target_link_libraries(antlr_opencypher_parser_lib antlr4_static)
|
2017-02-17 23:11:57 +08:00
|
|
|
# -----------------------------------------------------------------------------
|
2016-06-26 00:26:26 +08:00
|
|
|
|
2016-12-18 04:00:32 +08:00
|
|
|
# all memgraph src files
|
2016-07-07 08:58:26 +08:00
|
|
|
set(memgraph_src_files
|
2017-06-15 00:53:02 +08:00
|
|
|
${src_dir}/data_structures/concurrent/skiplist_gc.cpp
|
|
|
|
${src_dir}/database/graph_db.cpp
|
|
|
|
${src_dir}/database/graph_db_accessor.cpp
|
2017-07-12 18:17:15 +08:00
|
|
|
${src_dir}/database/dbms.cpp
|
2017-06-15 00:53:02 +08:00
|
|
|
${src_dir}/durability/recovery.cpp
|
|
|
|
${src_dir}/durability/snapshooter.cpp
|
2017-03-06 20:37:51 +08:00
|
|
|
${src_dir}/io/network/addrinfo.cpp
|
|
|
|
${src_dir}/io/network/network_endpoint.cpp
|
|
|
|
${src_dir}/io/network/socket.cpp
|
2017-06-08 00:28:31 +08:00
|
|
|
${src_dir}/query/common.cpp
|
2017-03-23 21:45:51 +08:00
|
|
|
${src_dir}/query/console.cpp
|
2017-06-15 00:53:02 +08:00
|
|
|
${src_dir}/query/engine.cpp
|
2017-06-13 17:17:12 +08:00
|
|
|
${src_dir}/query/frontend/ast/ast.cpp
|
2017-03-12 00:57:10 +08:00
|
|
|
${src_dir}/query/frontend/ast/cypher_main_visitor.cpp
|
2017-06-15 00:53:02 +08:00
|
|
|
${src_dir}/query/frontend/semantic/symbol_generator.cpp
|
|
|
|
${src_dir}/query/frontend/stripped.cpp
|
2017-04-13 16:01:16 +08:00
|
|
|
${src_dir}/query/interpret/awesome_memgraph_functions.cpp
|
2017-06-15 00:53:02 +08:00
|
|
|
${src_dir}/query/interpreter.cpp
|
|
|
|
${src_dir}/query/plan/cost_estimator.cpp
|
2017-04-13 16:01:16 +08:00
|
|
|
${src_dir}/query/plan/operator.cpp
|
2017-06-01 20:23:01 +08:00
|
|
|
${src_dir}/query/plan/rule_based_planner.cpp
|
|
|
|
${src_dir}/query/plan/variable_start_planner.cpp
|
2017-06-15 00:53:02 +08:00
|
|
|
${src_dir}/query/typed_value.cpp
|
|
|
|
${src_dir}/storage/edge_accessor.cpp
|
|
|
|
${src_dir}/storage/locking/record_lock.cpp
|
|
|
|
${src_dir}/storage/property_value.cpp
|
|
|
|
${src_dir}/storage/record_accessor.cpp
|
|
|
|
${src_dir}/storage/vertex_accessor.cpp
|
|
|
|
${src_dir}/threading/thread.cpp
|
|
|
|
${src_dir}/transactions/transaction.cpp
|
2016-07-07 08:58:26 +08:00
|
|
|
)
|
2016-12-18 04:00:32 +08:00
|
|
|
# -----------------------------------------------------------------------------
|
2016-08-08 16:32:34 +08:00
|
|
|
|
2017-06-08 18:23:23 +08:00
|
|
|
# memgraph_lib and memgraph_pic depend on these libraries
|
2017-06-21 17:29:13 +08:00
|
|
|
set(MEMGRAPH_ALL_LIBS stdc++fs Threads::Threads fmt
|
|
|
|
antlr_opencypher_parser_lib dl ${CMAKE_SOURCE_DIR}/libs/glog/lib/libglog.a gflags)
|
2017-06-08 18:23:23 +08:00
|
|
|
if (READLINE_FOUND)
|
|
|
|
list(APPEND MEMGRAPH_ALL_LIBS ${READLINE_LIBRARY})
|
|
|
|
endif()
|
|
|
|
|
2016-08-08 16:32:34 +08:00
|
|
|
# STATIC library used by memgraph executables
|
2016-12-18 04:00:32 +08:00
|
|
|
add_library(memgraph_lib STATIC ${memgraph_src_files})
|
2017-06-08 18:23:23 +08:00
|
|
|
target_link_libraries(memgraph_lib ${MEMGRAPH_ALL_LIBS})
|
2017-06-16 18:04:26 +08:00
|
|
|
add_dependencies(memgraph_lib generate_opencypher_parser
|
|
|
|
glog)
|
2016-12-18 04:00:32 +08:00
|
|
|
# -----------------------------------------------------------------------------
|
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-12-18 04:00:32 +08:00
|
|
|
# -----------------------------------------------------------------------------
|
2016-08-08 16:32:34 +08:00
|
|
|
|
2016-12-18 04:00:32 +08:00
|
|
|
# tests
|
2017-07-10 21:22:43 +08:00
|
|
|
add_subdirectory(tests)
|
2016-12-18 04:00:32 +08:00
|
|
|
# -----------------------------------------------------------------------------
|
2016-12-16 21:05:04 +08:00
|
|
|
|
2017-06-27 17:01:44 +08:00
|
|
|
add_custom_target(recursive_include_plan_template
|
2017-06-21 17:29:13 +08:00
|
|
|
COMMAND ./recursive_include --roots ${src_dir} ${libs_dir} ${CMAKE_BINARY_DIR}/libs/gflags/include ${libs_dir}/glog/include --start ${src_dir}/query/plan_template_cpp --copy ${CMAKE_BINARY_DIR}/include
|
2017-06-27 17:01:44 +08:00
|
|
|
DEPENDS ${src_dir}/query/plan_template_cpp
|
|
|
|
SOURCES ${src_dir}/query/plan_template_cpp
|
2017-02-17 23:11:57 +08:00
|
|
|
WORKING_DIRECTORY ${CMAKE_SOURCE_DIR}/cmake
|
|
|
|
)
|
2017-06-27 17:01:44 +08:00
|
|
|
add_dependencies(recursive_include_plan_template fmt gflags glog)
|
|
|
|
add_dependencies(memgraph_lib recursive_include_plan_template)
|
2017-02-17 23:11:57 +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-09-05 08:35:52 +08:00
|
|
|
"memgraph_${COMMIT_NO}_${COMMIT_HASH}_${COMMIT_BRANCH}_${CMAKE_BUILD_TYPE}")
|
2017-07-11 00:17:18 +08:00
|
|
|
add_custom_target(memgraph_link_target ALL
|
2017-07-30 04:20:32 +08:00
|
|
|
COMMAND ${CMAKE_COMMAND} -E create_symlink ${CMAKE_BINARY_DIR}/${MEMGRAPH_BUILD_NAME} ${CMAKE_BINARY_DIR}/memgraph DEPENDS ${MEMGRAPH_BUILD_NAME})
|
2016-12-18 04:00:32 +08:00
|
|
|
# -----------------------------------------------------------------------------
|
2016-10-13 21:42:19 +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)
|
2017-02-28 23:50:50 +08:00
|
|
|
set_property(TARGET ${MEMGRAPH_BUILD_NAME}
|
|
|
|
PROPERTY CXX_STANDARD ${cxx_standard})
|
2017-06-08 18:23:23 +08:00
|
|
|
target_link_libraries(${MEMGRAPH_BUILD_NAME} memgraph_lib)
|
2016-08-10 16:39:02 +08:00
|
|
|
endif()
|
2017-02-28 01:23:38 +08:00
|
|
|
|
|
|
|
# utility target to copy hardcoded queries
|
|
|
|
# FROM: tests/integration/hardcoded_query TO: build/compiled/hardcode
|
|
|
|
add_executable(__copy_hardcoded_queries ${src_dir}/copy_hardcoded_queries.cpp)
|
|
|
|
set_property(TARGET __copy_hardcoded_queries PROPERTY CXX_STANDARD
|
|
|
|
${cxx_standard})
|
2017-06-08 18:23:23 +08:00
|
|
|
target_link_libraries(__copy_hardcoded_queries memgraph_lib)
|
2017-02-28 01:23:38 +08:00
|
|
|
add_custom_target(copy_hardcoded_queries ./__copy_hardcoded_queries --src
|
|
|
|
${CMAKE_SOURCE_DIR}/tests/integration/hardcoded_query --dst
|
|
|
|
${CMAKE_BINARY_DIR}/compiled/hardcode
|
|
|
|
WORKING_DIR ${CMAKE_BINARY_DIR})
|
2017-02-17 23:11:57 +08:00
|
|
|
|
|
|
|
# make CLion aware of all source files so we get refactoring etc
|
2017-02-20 08:24:18 +08:00
|
|
|
# this target won't be built
|
|
|
|
file(GLOB_RECURSE __SOURCES ${CMAKE_SOURCE_DIR}/src/*.hpp
|
|
|
|
${CMAKE_SOURCE_DIR}/src/*.cpp)
|
2017-02-20 06:47:09 +08:00
|
|
|
add_executable(__refactor_target ${__SOURCES})
|
2017-02-20 08:24:18 +08:00
|
|
|
set_target_properties(__refactor_target PROPERTIES EXCLUDE_FROM_ALL 1)
|
2017-02-28 23:50:50 +08:00
|
|
|
|
|
|
|
# targets to check compilability of all hardcoded query plans
|
|
|
|
# that is a first step in integration testing
|
|
|
|
# integration testing phases should be
|
|
|
|
# 1. compilation of all hardcoded query plans
|
|
|
|
# 2. query plan execution agains empty database and injected OutputStream
|
|
|
|
# 3. integration tests for all pilot/clients written in cucumber
|
|
|
|
# the following targets address only the first phase
|
2017-03-22 22:53:30 +08:00
|
|
|
if(HARDCODED_TARGETS)
|
2017-07-10 21:22:43 +08:00
|
|
|
file(GLOB __HARDCODED_SOURCES
|
|
|
|
${CMAKE_SOURCE_DIR}/tests/integration/hardcoded_query/*.cpp)
|
|
|
|
foreach(file_path ${__HARDCODED_SOURCES})
|
|
|
|
get_filename_component(file_name ${file_path} NAME_WE)
|
|
|
|
set(target_name __${file_name}_hardcoded_target)
|
|
|
|
add_executable(${target_name} ${CMAKE_SOURCE_DIR}/libs/__main.cpp
|
|
|
|
${file_path})
|
|
|
|
target_link_libraries(${target_name} memgraph_lib)
|
|
|
|
set_property(TARGET ${target_name} PROPERTY CXX_STANDARD ${cxx_standard})
|
|
|
|
set_target_properties(${target_name}
|
|
|
|
PROPERTIES RUNTIME_OUTPUT_DIRECTORY
|
|
|
|
"${CMAKE_BINARY_DIR}/__hardcoded_targets")
|
|
|
|
endforeach()
|
2017-03-22 22:53:30 +08:00
|
|
|
endif()
|
2017-03-09 18:42:16 +08:00
|
|
|
|
|
|
|
get_target_cxx_flags(memgraph_lib compile_flags)
|
2017-06-16 21:03:59 +08:00
|
|
|
configure_file(${src_dir}/query/plan_compiler_flags.hpp.in ${generated_headers_dir}/query/plan_compiler_flags.hpp)
|