2017-09-22 19:46:06 +08:00
|
|
|
# MemGraph Tools CMake configuration
|
|
|
|
|
|
|
|
cmake_minimum_required(VERSION 3.1)
|
|
|
|
|
|
|
|
if (NOT UNIX)
|
|
|
|
message(FATAL, "Unsupported operating system.")
|
|
|
|
endif()
|
|
|
|
|
|
|
|
# ccache setup
|
|
|
|
# ccache isn't enabled all the time because it makes some problem
|
|
|
|
# during the code coverage process
|
|
|
|
find_program(CCACHE_FOUND ccache)
|
|
|
|
option(USE_CCACHE "ccache:" ON)
|
|
|
|
message(STATUS "CCache: ${USE_CCACHE}")
|
|
|
|
if(CCACHE_FOUND AND USE_CCACHE)
|
|
|
|
set_property(GLOBAL PROPERTY RULE_LAUNCH_COMPILE ccache)
|
|
|
|
set_property(GLOBAL PROPERTY RULE_LAUNCH_LINK ccache)
|
|
|
|
endif(CCACHE_FOUND AND USE_CCACHE)
|
|
|
|
|
|
|
|
# choose a compiler
|
|
|
|
# NOTE: must be choosen before use of project() or enable_language()
|
|
|
|
set(CMAKE_C_COMPILER "clang")
|
|
|
|
set(CMAKE_CXX_COMPILER "clang++")
|
|
|
|
|
2017-10-13 21:30:06 +08:00
|
|
|
project(memgraph_tools)
|
2017-09-22 19:46:06 +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)
|
|
|
|
# custom function definitions
|
|
|
|
include(functions)
|
|
|
|
|
|
|
|
disallow_in_source_build()
|
|
|
|
|
|
|
|
# threading
|
|
|
|
find_package(Threads REQUIRED)
|
|
|
|
|
|
|
|
# optional readline
|
2017-10-04 20:46:57 +08:00
|
|
|
find_package(Readline)
|
2017-09-22 19:46:06 +08:00
|
|
|
if (READLINE_FOUND)
|
|
|
|
add_definitions(-DHAS_READLINE)
|
|
|
|
endif()
|
|
|
|
|
2017-10-13 21:30:06 +08:00
|
|
|
# Explicitly set -std= flag for C++17.
|
|
|
|
set(CMAKE_CXX_FLAGS "${CMAKE_CXX_FLAGS} -std=c++1z -Wall")
|
2017-09-22 19:46:06 +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")
|
|
|
|
|
|
|
|
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()
|
|
|
|
|
|
|
|
# Setup external dependencies. Use EXCLUDE_FROM_ALL to prevent *installing* libs.
|
|
|
|
add_subdirectory(${PROJECT_SOURCE_DIR}/../libs libs EXCLUDE_FROM_ALL)
|
2017-09-27 19:03:44 +08:00
|
|
|
include_directories(SYSTEM ${GFLAGS_INCLUDE_DIR})
|
|
|
|
include_directories(SYSTEM ${GLOG_INCLUDE_DIR})
|
|
|
|
include_directories(SYSTEM ${FMT_INCLUDE_DIR})
|
2017-09-22 19:46:06 +08:00
|
|
|
|
|
|
|
# Include memgraph headers
|
|
|
|
set(memgraph_src_dir ${PROJECT_SOURCE_DIR}/../src)
|
|
|
|
include_directories(${memgraph_src_dir})
|
|
|
|
|
|
|
|
add_subdirectory(src)
|