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++")
|
|
|
|
# -----------------------------------------------------------------------------
|
|
|
|
|
2017-10-06 19:10:31 +08:00
|
|
|
project(memgraph VERSION 0.7.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
|
|
|
# -----------------------------------------------------------------------------
|
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
|
2017-10-04 20:46:57 +08:00
|
|
|
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()
|
2017-03-24 16:50:52 +08:00
|
|
|
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")
|
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")
|
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-09-26 15:43:43 +08:00
|
|
|
# Generate a version.hpp file
|
2017-10-06 19:10:31 +08:00
|
|
|
set(VERSION_STRING ${memgraph_VERSION})
|
2017-09-26 15:43:43 +08:00
|
|
|
configure_file(${src_dir}/version.hpp.in include/version.hpp @ONLY)
|
|
|
|
include_directories(${CMAKE_CURRENT_BINARY_DIR}/include)
|
|
|
|
|
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
|
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 -------------------------------------------------
|
|
|
|
add_subdirectory(libs)
|
2016-05-23 13:51:36 +08:00
|
|
|
|
2017-09-27 19:03:44 +08:00
|
|
|
# TODO: is this clang-tidy target needed anymore?
|
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)
|
2017-09-27 19:03:44 +08:00
|
|
|
add_custom_target(
|
|
|
|
clang-tidy
|
|
|
|
COMMAND /usr/bin/clang-tidy
|
|
|
|
${LINTER_SRC_FILES}
|
|
|
|
-config=''
|
|
|
|
--
|
|
|
|
-std=c++1y
|
|
|
|
-I${CMAKE_SOURCE_DIR}/include -I${FMT_INCLUDE_DIR}
|
|
|
|
DEPENDS fmt)
|
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
|
|
|
|
|
|
|
|
# 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}")
|
2017-08-03 18:08:39 +08:00
|
|
|
# experimental
|
|
|
|
option(EXPERIMENTAL "Build experimental binaries" OFF)
|
|
|
|
message(STATUS "POC binaries: ${POC}")
|
2016-12-18 04:00:32 +08:00
|
|
|
# tests
|
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-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})
|
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)
|
|
|
|
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
|
2017-09-21 15:40:56 +08:00
|
|
|
include_directories(${ANTLR4_INCLUDE_DIR})
|
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
|
|
|
|
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-08-24 21:23:33 +08:00
|
|
|
${src_dir}/communication/bolt/v1/decoder/decoded_value.cpp
|
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-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
|
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-10-03 19:56:41 +08:00
|
|
|
set(MEMGRAPH_ALL_LIBS stdc++fs Threads::Threads fmt cppitertools
|
|
|
|
antlr_opencypher_parser_lib dl glog gflags)
|
2017-06-08 18:23:23 +08:00
|
|
|
if (READLINE_FOUND)
|
2017-10-04 20:46:57 +08:00
|
|
|
list(APPEND MEMGRAPH_ALL_LIBS readline)
|
2017-06-08 18:23:23 +08:00
|
|
|
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-10-03 19:56:41 +08:00
|
|
|
add_dependencies(memgraph_lib generate_opencypher_parser)
|
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()
|
2017-08-03 18:08:39 +08:00
|
|
|
|
|
|
|
# experimental
|
|
|
|
if (EXPERIMENTAL)
|
|
|
|
add_subdirectory(experimental)
|
|
|
|
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
|
|
|
|
2016-08-01 01:58:12 +08:00
|
|
|
# memgraph build name
|
|
|
|
execute_process(
|
|
|
|
OUTPUT_VARIABLE COMMIT_HASH
|
|
|
|
COMMAND git rev-parse --short HEAD
|
|
|
|
)
|
2016-08-15 01:49:56 +08:00
|
|
|
string(STRIP ${COMMIT_HASH} COMMIT_HASH)
|
2017-10-06 19:10:31 +08:00
|
|
|
set(MEMGRAPH_BUILD_NAME "memgraph-${memgraph_VERSION}-${COMMIT_HASH}_${CMAKE_BUILD_TYPE}")
|
2017-07-11 00:17:18 +08:00
|
|
|
add_custom_target(memgraph_link_target ALL
|
2017-08-30 21:37:00 +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)
|
2017-09-26 20:25:01 +08:00
|
|
|
# Strip the executable in release build.
|
|
|
|
string(TOLOWER ${CMAKE_BUILD_TYPE} lower_build_type)
|
|
|
|
if (lower_build_type STREQUAL "release")
|
|
|
|
add_custom_command(TARGET ${MEMGRAPH_BUILD_NAME} POST_BUILD
|
|
|
|
COMMAND strip -s ${MEMGRAPH_BUILD_NAME}
|
|
|
|
COMMENT Stripping symbols and sections from
|
|
|
|
${MEMGRAPH_BUILD_NAME})
|
|
|
|
endif()
|
|
|
|
# Install and rename executable to just 'memgraph' Since we have to rename,
|
|
|
|
# we cannot use the recommended `install(TARGETS ...)`.
|
|
|
|
install(PROGRAMS ${CMAKE_BINARY_DIR}/${MEMGRAPH_BUILD_NAME}
|
|
|
|
DESTINATION bin RENAME memgraph)
|
|
|
|
# Install the config file.
|
2017-10-06 20:27:25 +08:00
|
|
|
install(FILES ${CMAKE_SOURCE_DIR}/config/community.conf
|
|
|
|
DESTINATION /etc/memgraph RENAME memgraph.conf)
|
2017-09-26 20:25:01 +08:00
|
|
|
# Create empty directories for default location of snapshots and logs.
|
|
|
|
install(CODE "file(MAKE_DIRECTORY \$ENV{DESTDIR}/var/log/memgraph
|
|
|
|
\$ENV{DESTDIR}/var/lib/memgraph/snapshots)")
|
2016-08-10 16:39:02 +08:00
|
|
|
endif()
|
2017-02-28 01:23:38 +08:00
|
|
|
|
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
|
|
|
|
2017-03-09 18:42:16 +08:00
|
|
|
get_target_cxx_flags(memgraph_lib compile_flags)
|
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})
|
2017-09-26 20:25:01 +08:00
|
|
|
# TODO: Longer description, readme and license files.
|
|
|
|
# DEB specific
|
|
|
|
set(CPACK_DEBIAN_PACKAGE_MAINTAINER "Memgraph Ltd.")
|
|
|
|
set(CPACK_DEBIAN_PACKAGE_SECTION database)
|
|
|
|
set(CPACK_DEBIAN_PACKAGE_HOMEPAGE https://memgraph.com)
|
|
|
|
# We may need conffiles, postinst, postrm or prerm scripts.
|
|
|
|
# set(CPACK_DEBIAN_PACKAGE_CONTROL_EXTRA ...)
|
|
|
|
set(CPACK_DEBIAN_PACKAGE_SHLIBDEPS ON)
|
|
|
|
# All variables must be set before including.
|
|
|
|
include(CPack)
|
|
|
|
# ---- End Setup CPack ----
|