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-09 15:49:14 +08:00
|
|
|
project(memgraph VERSION 0.8.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-10-20 22:53:24 +08:00
|
|
|
# optional Ltalloc
|
|
|
|
option(USE_LTALLOC "Use Ltalloc instead of default allocator (default ON). \
|
|
|
|
Set this to OFF to prevent linking with Ltalloc." ON)
|
|
|
|
|
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
|
|
|
|
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.
|
2017-11-10 18:31:19 +08:00
|
|
|
set(CMAKE_CXX_FLAGS "${CMAKE_CXX_FLAGS} -std=c++1z -Wall -Werror=switch -Werror=switch-bool")
|
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
|
|
|
|
|
|
|
# Use gold linker to speedup build
|
|
|
|
set(CMAKE_EXE_LINKER_FLAGS "${CMAKE_EXE_LINKER_FLAGS} -fuse-ld=gold")
|
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
|
|
|
|
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
|
|
|
# -----------------------------------------------------------------------------
|
|
|
|
|
|
|
|
# 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-10-17 20:05:08 +08:00
|
|
|
${src_dir}/communication/bolt/v1/session.cpp
|
2017-10-27 16:33:48 +08:00
|
|
|
${src_dir}/communication/reactor/protocol.cpp
|
2017-10-25 20:47:46 +08:00
|
|
|
${src_dir}/communication/reactor/reactor_local.cpp
|
2017-10-27 16:33:48 +08:00
|
|
|
${src_dir}/communication/reactor/reactor_distributed.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
|
|
|
|
${src_dir}/durability/recovery.cpp
|
|
|
|
${src_dir}/durability/snapshooter.cpp
|
2017-11-13 16:50:49 +08:00
|
|
|
${src_dir}/durability/wal.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-10-24 16:18:20 +08:00
|
|
|
${src_dir}/query/plan/preprocess.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
|
2017-11-02 16:59:15 +08:00
|
|
|
${src_dir}/utils/watchdog.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-10-13 21:30:06 +08:00
|
|
|
# memgraph_lib depend on these libraries
|
2017-10-25 20:47:46 +08:00
|
|
|
set(MEMGRAPH_ALL_LIBS stdc++fs Threads::Threads fmt cppitertools cereal
|
2017-10-03 19:56:41 +08:00
|
|
|
antlr_opencypher_parser_lib dl glog gflags)
|
2017-10-20 22:53:24 +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()
|
|
|
|
|
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-10-13 21:30:06 +08:00
|
|
|
enable_testing()
|
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
|
2017-10-13 21:30:06 +08:00
|
|
|
add_executable(${MEMGRAPH_BUILD_NAME} ${src_dir}/memgraph_bolt.cpp)
|
|
|
|
target_link_libraries(${MEMGRAPH_BUILD_NAME} memgraph_lib)
|
|
|
|
# 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})
|
2016-08-10 16:39:02 +08:00
|
|
|
endif()
|
2017-10-13 21:30:06 +08:00
|
|
|
# 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.
|
|
|
|
install(FILES ${CMAKE_SOURCE_DIR}/config/community.conf
|
|
|
|
DESTINATION /etc/memgraph RENAME memgraph.conf)
|
|
|
|
# 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)")
|
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 ----
|