Remove unused stuff from CMakeLists

Summary: In the process, make experimental/distributed compilable.

Reviewers: mislav.bradac, buda, mferencevic

Reviewed By: mislav.bradac

Subscribers: pullbot

Differential Revision: https://phabricator.memgraph.io/D906
This commit is contained in:
Teon Banek 2017-10-13 15:30:06 +02:00
parent 8da3839a1d
commit 06b0111ddc
19 changed files with 54 additions and 154 deletions

View File

@ -64,10 +64,11 @@ endif()
# -----------------------------------------------------------------------------
# c++14
# TODO: set here 17 once it will be available in the cmake version (3.8)
set(cxx_standard 14)
set(CMAKE_CXX_FLAGS "${CMAKE_CXX_FLAGS} -std=c++1z -Wall -Wno-c++1z-extensions")
# set(CMAKE_CXX_STANDARD 17)
# set(CMAKE_CXX_STANDARD_REQUIRED ON)
# For now, explicitly set -std= flag for C++17.
set(CMAKE_CXX_FLAGS "${CMAKE_CXX_FLAGS} -std=c++1z -Wall")
# Don't omit frame pointer in RelWithDebInfo, for additional callchain debug.
set(CMAKE_CXX_FLAGS_RELWITHDEBINFO
"${CMAKE_CXX_FLAGS_RELWITHDEBINFO} -fno-omit-frame-pointer")
@ -112,30 +113,6 @@ message(STATUS "CMake build type: ${CMAKE_BUILD_TYPE}")
# setup external dependencies -------------------------------------------------
add_subdirectory(libs)
# TODO: is this clang-tidy target needed anymore?
# 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
-I${CMAKE_SOURCE_DIR}/include -I${FMT_INCLUDE_DIR}
DEPENDS fmt)
endif()
# -----------------------------------------------------------------------------
# ndebug
option(NDEBUG "No debug" OFF)
message(STATUS "NDEBUG: ${NDEBUG} (be careful CMAKE_BUILD_TYPE can also \
@ -145,22 +122,6 @@ if(NDEBUG)
endif()
# -----------------------------------------------------------------------------
# -- GLIBCXX_DEBUG ------------------------------------------------------------
# glibcxx debug (useful for gdb)
# the problem is that the query engine doesn't work as it should work if
# this flag is present (TODO: figure out why)
option(GLIBCXX_DEBUG "glibc debug" OFF)
message(STATUS "GLIBCXX_DEBUG: ${GLIBCXX_DEBUG} (solves problem with \
_M_dataplus member during a debugging process)")
if(GLIBCXX_DEBUG)
set(CMAKE_CXX_FLAGS_DEBUG "-D_GLIBCXX_DEBUG ${CMAKE_CXX_FLAGS_DEBUG}")
endif()
# -----------------------------------------------------------------------------
# option binaries
# memgraph
option(MEMGRAPH "Build memgraph binary" ON)
message(STATUS "MEMGRAPH binary: ${MEMGRAPH}")
# proof of concept
option(POC "Build proof of concept binaries" ON)
message(STATUS "POC binaries: ${POC}")
@ -247,7 +208,7 @@ set(memgraph_src_files
)
# -----------------------------------------------------------------------------
# memgraph_lib and memgraph_pic depend on these libraries
# memgraph_lib depend on these libraries
set(MEMGRAPH_ALL_LIBS stdc++fs Threads::Threads fmt cppitertools
antlr_opencypher_parser_lib dl glog gflags)
if (READLINE_FOUND)
@ -272,6 +233,7 @@ endif()
# -----------------------------------------------------------------------------
# tests
enable_testing()
add_subdirectory(tests)
# -----------------------------------------------------------------------------
@ -287,39 +249,26 @@ add_custom_target(memgraph_link_target ALL
# -----------------------------------------------------------------------------
# memgraph main executable
if (MEMGRAPH)
add_executable(${MEMGRAPH_BUILD_NAME} ${src_dir}/memgraph_bolt.cpp)
set_property(TARGET ${MEMGRAPH_BUILD_NAME}
PROPERTY CXX_STANDARD ${cxx_standard})
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})
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.
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)")
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})
endif()
# make CLion aware of all source files so we get refactoring etc
# this target won't be built
file(GLOB_RECURSE __SOURCES ${CMAKE_SOURCE_DIR}/src/*.hpp
${CMAKE_SOURCE_DIR}/src/*.cpp)
add_executable(__refactor_target ${__SOURCES})
set_target_properties(__refactor_target PROPERTIES EXCLUDE_FROM_ALL 1)
get_target_cxx_flags(memgraph_lib compile_flags)
# 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)")
# ---- Setup CPack --------
# General setup

View File

@ -1,2 +1,2 @@
# distributed
add_subdirectory(${CMAKE_CURRENT_SOURCE_DIR}/distributed)
add_subdirectory(distributed)

View File

@ -1,26 +1,13 @@
project(distributed)
# threading
find_package(Threads REQUIRED)
# set directory variables
set(src_dir ${PROJECT_SOURCE_DIR}/src)
set(libs_dir ${PROJECT_SOURCE_DIR}/libs)
# includes
include_directories(${libs_dir}/cereal/include)
include_directories(SYSTEM ${libs_dir}/cereal/include)
include_directories(${src_dir})
# totally hacked, no idea why I need to include these again
# TODO: ask teon
include_directories(${CMAKE_SOURCE_DIR}/src)
include_directories(SYSTEM ${CMAKE_SOURCE_DIR}/libs)
# needed to include configured files (plan_compiler_flags.hpp)
set(generated_headers_dir ${CMAKE_BINARY_DIR}/generated_headers)
include_directories(${generated_headers_dir})
include_directories(SYSTEM ${CMAKE_SOURCE_DIR}/libs/glog/include)
include_directories(SYSTEM ${CMAKE_BINARY_DIR}/libs/gflags/include)
# library from distributed sources
file(GLOB_RECURSE src_files ${src_dir}/*.cpp)
add_library(distributed_lib STATIC ${src_files})
@ -28,19 +15,16 @@ add_library(distributed_lib STATIC ${src_files})
## distributed Memgraph executable
set(executable_name main)
add_executable(${executable_name} ${PROJECT_SOURCE_DIR}/main.cpp)
target_link_libraries(${executable_name} distributed_lib)
target_link_libraries(${executable_name} memgraph_lib)
target_link_libraries(${executable_name} ${MEMGRAPH_ALL_LIBS})
target_link_libraries(${executable_name} distributed_lib memgraph_lib)
## dummy distributed Memgraph client
set(executable_name main-client)
add_executable(${executable_name} ${PROJECT_SOURCE_DIR}/main-client.cpp)
target_link_libraries(${executable_name} distributed_lib)
target_link_libraries(${executable_name} memgraph_lib)
target_link_libraries(${executable_name} ${MEMGRAPH_ALL_LIBS})
target_link_libraries(${executable_name} distributed_lib memgraph_lib)
# tests
add_subdirectory(${PROJECT_SOURCE_DIR}/tests)
enable_testing()
add_subdirectory(tests)
# copy test scripts into the build/ directory (for distributed tests)
configure_file(${PROJECT_SOURCE_DIR}/tests/start_distributed.py

View File

@ -1,5 +1,6 @@
#include <iostream>
#include <fstream>
#include <iostream>
#include <random>
#include <gflags/gflags.h>
#include <glog/logging.h>

View File

@ -70,6 +70,8 @@ class Session {
public:
Session(Socket &&socket, Data &data);
int Id() const { return socket_.fd(); }
/**
* Returns the protocol alive state
*/

View File

@ -1,9 +1,3 @@
cmake_minimum_required(VERSION 3.1)
project(memgraph_tests)
enable_testing()
# set current directory name as a test type
get_filename_component(test_type ${CMAKE_CURRENT_SOURCE_DIR} NAME)
@ -23,7 +17,6 @@ foreach(test_cpp ${test_type_cpps})
# build exec file
add_executable(${target_name} ${test_cpp})
set_property(TARGET ${target_name} PROPERTY CXX_STANDARD ${cxx_standard})
if(${TEST_COVERAGE})
set_target_properties(${target_name} PROPERTIES COMPILE_FLAGS "-g -O0 -Wall -fprofile-arcs -ftest-coverage")
set_target_properties(${target_name} PROPERTIES LINK_FLAGS "--coverage -fprofile-arcs -ftest-coverage")
@ -35,9 +28,7 @@ foreach(test_cpp ${test_type_cpps})
set_target_properties(${target_name} PROPERTIES OUTPUT_NAME ${exec_name})
# link libraries
target_link_libraries(${target_name} distributed_lib)
target_link_libraries(${target_name} memgraph_lib)
target_link_libraries(${target_name} ${MEMGRAPH_ALL_LIBS})
target_link_libraries(${target_name} distributed_lib memgraph_lib)
# gtest
target_link_libraries(${target_name} gtest gtest_main)
if(${TEST_COVERAGE})

View File

@ -1,12 +1,12 @@
#include "reactors_distributed.hpp"
#include <iostream>
#include <fstream>
#include <glog/logging.h>
#include "memgraph_config.hpp"
#include "reactors_distributed.hpp"
DEFINE_int64(my_mnid, 0, "Memgraph node id"); // TODO(zuza): this should be assigned by the leader once in the future
DEFINE_string(config_filename, "", "File containing list of all processes");
class MemgraphDistributed {
private:

View File

@ -375,7 +375,7 @@
// }
// }
int main(int, char **) { return 0; }
// int main(int argc, char *argv[]) {
// //google::InitGoogleLogging(argv[0]);
// gflags::ParseCommandLineFlags(&argc, &argv, true);

View File

@ -1,4 +1,3 @@
cmake_minimum_required(VERSION 3.1)
include(ExternalProject)
include(ProcessorCount)

View File

@ -18,7 +18,6 @@ foreach(poc_cpp ${poc_cpps})
# build exe file
add_executable(${target_name} ${poc_cpp})
set_property(TARGET ${target_name} PROPERTY CXX_STANDARD ${cxx_standard})
# OUTPUT_NAME sets the real name of a target when it is built and can be
# used to help create two targets of the same name even though CMake

View File

@ -1,9 +1,3 @@
cmake_minimum_required(VERSION 3.1)
project(memgraph_tests)
enable_testing()
file(MAKE_DIRECTORY ${CMAKE_BINARY_DIR}/test_results/unit)
file(MAKE_DIRECTORY ${CMAKE_BINARY_DIR}/test_results/benchmark)
file(MAKE_DIRECTORY ${CMAKE_BINARY_DIR}/test_results/property_based)
@ -24,22 +18,22 @@ add_custom_target(test_data
include_directories(${GTEST_INCLUDE_DIR})
# benchmark test binaries
add_subdirectory(${PROJECT_SOURCE_DIR}/benchmark)
add_subdirectory(benchmark)
# macro_benchmark test binaries
add_subdirectory(${PROJECT_SOURCE_DIR}/macro_benchmark)
add_subdirectory(macro_benchmark)
# stress test binaries
add_subdirectory(${PROJECT_SOURCE_DIR}/stress)
add_subdirectory(stress)
# concurrent test binaries
add_subdirectory(${PROJECT_SOURCE_DIR}/concurrent)
add_subdirectory(concurrent)
# manual test binaries
add_subdirectory(${PROJECT_SOURCE_DIR}/manual)
add_subdirectory(manual)
# unit test binaries
add_subdirectory(${PROJECT_SOURCE_DIR}/unit)
add_subdirectory(unit)
# property based test binaries
add_subdirectory(${PROJECT_SOURCE_DIR}/property_based)
add_subdirectory(property_based)

View File

@ -1,4 +1,3 @@
find_package(Threads REQUIRED)
include_directories(${BENCHMARK_INCLUDE_DIR})
# set current directory name as a test type
@ -18,7 +17,6 @@ foreach(test_cpp ${test_type_cpps})
# build exec file
add_executable(${target_name} ${test_cpp})
set_property(TARGET ${target_name} PROPERTY CXX_STANDARD ${cxx_standard})
# OUTPUT_NAME sets the real name of a target when it is built and can be
# used to help create two targets of the same name even though CMake

View File

@ -1,5 +1,3 @@
find_package(Threads REQUIRED)
# set current directory name as a test type
get_filename_component(test_type ${CMAKE_CURRENT_SOURCE_DIR} NAME)
@ -17,7 +15,6 @@ foreach(test_cpp ${test_type_cpps})
# build exec file
add_executable(${target_name} ${test_cpp})
set_property(TARGET ${target_name} PROPERTY CXX_STANDARD ${cxx_standard})
# OUTPUT_NAME sets the real name of a target when it is built and can be
# used to help create two targets of the same name even though CMake

View File

@ -1,5 +1,3 @@
find_package(Threads REQUIRED)
# set current directory name as a test type
get_filename_component(test_type ${CMAKE_CURRENT_SOURCE_DIR} NAME)
@ -7,8 +5,9 @@ get_filename_component(test_type ${CMAKE_CURRENT_SOURCE_DIR} NAME)
file(GLOB_RECURSE test_type_cpps *.cpp)
message(STATUS "Available ${test_type} cpp files are: ${test_type_cpps}")
# postgres directory
set(postgres_dir ${libs_dir}/postgresql)
add_library(postgres SHARED IMPORTED)
set_property(TARGET postgres PROPERTY INTERFACE_INCLUDE_DIRECTORIES ${libs_dir}/postgresql/include)
set_property(TARGET postgres PROPERTY IMPORTED_LOCATION ${libs_dir}/postgresql/lib/libpq.so)
# add target that depends on all other targets
set(all_targets_target memgraph__${test_type})
@ -24,7 +23,6 @@ foreach(test_cpp ${test_type_cpps})
# build exec file
add_executable(${target_name} ${test_cpp})
set_property(TARGET ${target_name} PROPERTY CXX_STANDARD ${cxx_standard})
# OUTPUT_NAME sets the real name of a target when it is built and can be
# used to help create two targets of the same name even though CMake
@ -32,11 +30,7 @@ foreach(test_cpp ${test_type_cpps})
set_target_properties(${target_name} PROPERTIES OUTPUT_NAME ${exec_name})
# link libraries
target_link_libraries(${target_name} memgraph_lib)
# libpq includes
target_link_libraries(${target_name} "${postgres_dir}/lib/libpq.so")
target_include_directories(${target_name} PUBLIC "${postgres_dir}/include")
target_link_libraries(${target_name} memgraph_lib postgres)
# add target to dependencies
add_dependencies(${all_targets_target} ${target_name})

View File

@ -15,7 +15,6 @@ foreach(test_cpp ${test_type_cpps})
# build exec file
add_executable(${target_name} ${test_cpp})
set_property(TARGET ${target_name} PROPERTY CXX_STANDARD ${cxx_standard})
# OUTPUT_NAME sets the real name of a target when it is built and can be
# used to help create two targets of the same name even though CMake

View File

@ -15,7 +15,6 @@ foreach(test_cpp ${test_type_cpps})
# build exec file
add_executable(${target_name} ${test_cpp})
set_property(TARGET ${target_name} PROPERTY CXX_STANDARD ${cxx_standard})
# OUTPUT_NAME sets the real name of a target when it is built and can be
# used to help create two targets of the same name even though CMake

View File

@ -1,5 +1,3 @@
find_package(Threads REQUIRED)
# set current directory name as a test type
get_filename_component(test_type ${CMAKE_CURRENT_SOURCE_DIR} NAME)
@ -21,7 +19,6 @@ foreach(test_cpp ${test_type_cpps})
# build exec file
add_executable(${target_name} ${test_cpp})
set_property(TARGET ${target_name} PROPERTY CXX_STANDARD ${cxx_standard})
# OUTPUT_NAME sets the real name of a target when it is built and can be
# used to help create two targets of the same name even though CMake

View File

@ -15,7 +15,6 @@ foreach(test_cpp ${test_type_cpps})
# build exec file
add_executable(${target_name} ${test_cpp})
set_property(TARGET ${target_name} PROPERTY CXX_STANDARD ${cxx_standard})
if(TEST_COVERAGE)
set_target_properties(${target_name} PROPERTIES COMPILE_FLAGS "-g -O0 -Wall -fprofile-arcs -ftest-coverage")
set_target_properties(${target_name} PROPERTIES LINK_FLAGS "--coverage -fprofile-arcs -ftest-coverage")

View File

@ -22,7 +22,7 @@ endif(CCACHE_FOUND AND USE_CCACHE)
set(CMAKE_C_COMPILER "clang")
set(CMAKE_CXX_COMPILER "clang++")
project("memgraph_tools")
project(memgraph_tools)
# setup CMake module path, defines path for include() and find_package()
# https://cmake.org/cmake/help/latest/variable/CMAKE_MODULE_PATH.html
@ -41,10 +41,8 @@ if (READLINE_FOUND)
add_definitions(-DHAS_READLINE)
endif()
# c++14
# TODO: set here 17 once it will be available in the cmake version (3.8)
set(cxx_standard 14)
set(CMAKE_CXX_FLAGS "${CMAKE_CXX_FLAGS} -std=c++1z -Wall -Wno-c++1z-extensions")
# Explicitly set -std= flag for C++17.
set(CMAKE_CXX_FLAGS "${CMAKE_CXX_FLAGS} -std=c++1z -Wall")
# Don't omit frame pointer in RelWithDebInfo, for additional callchain debug.
set(CMAKE_CXX_FLAGS_RELWITHDEBINFO
"${CMAKE_CXX_FLAGS_RELWITHDEBINFO} -fno-omit-frame-pointer")