From 53d8f725c5d9b164f47ec1a37981ddd427905c4f Mon Sep 17 00:00:00 2001 From: Teon Banek Date: Wed, 6 Feb 2019 12:29:04 +0100 Subject: [PATCH] Build mg-comm-rpc library Summary: This change splits mg-communication into mg-communication and mg-comm-rpc. The main reason for doing this, is to make separation of enterprise features from community Memgraph more clear. Reviewers: mferencevic, msantl Reviewed By: msantl Subscribers: pullbot Differential Revision: https://phabricator.memgraph.io/D1844 --- src/CMakeLists.txt | 11 ++++++---- src/communication/CMakeLists.txt | 30 +++++++++++++++++----------- src/stats/CMakeLists.txt | 2 +- tests/benchmark/CMakeLists.txt | 2 +- tests/macro_benchmark/CMakeLists.txt | 4 ++-- tests/unit/CMakeLists.txt | 2 +- 6 files changed, 30 insertions(+), 21 deletions(-) diff --git a/src/CMakeLists.txt b/src/CMakeLists.txt index 241b36b7c..ddeedcd01 100644 --- a/src/CMakeLists.txt +++ b/src/CMakeLists.txt @@ -63,8 +63,10 @@ add_lcp_single_node(query/plan/operator.lcp) add_custom_target(generate_lcp_single_node DEPENDS ${generated_lcp_single_node_files}) set(MG_SINGLE_NODE_LIBS stdc++fs Threads::Threads fmt cppitertools - antlr_opencypher_parser_lib dl glog gflags capnp kj - mg-utils mg-io mg-integrations-kafka mg-requests mg-communication mg-auth mg-stats) + antlr_opencypher_parser_lib dl glog gflags + mg-utils mg-io mg-requests mg-communication) +# These are enterprise subsystems +set(MG_SINGLE_NODE_LIBS ${MG_SINGLE_NODE_LIBS} mg-integrations-kafka mg-auth mg-stats) if (USE_LTALLOC) list(APPEND MG_SINGLE_NODE_LIBS ltalloc) @@ -234,7 +236,7 @@ add_custom_target(generate_capnp DEPENDS generate_lcp_distributed ${generated_ca set(MG_DISTRIBUTED_LIBS stdc++fs Threads::Threads fmt cppitertools antlr_opencypher_parser_lib dl glog gflags capnp kj mg-utils mg-io mg-io-serialization mg-integrations-kafka mg-requests - mg-communication mg-auth mg-stats) + mg-communication mg-comm-rpc mg-auth mg-stats) # STATIC library used by memgraph executables add_library(mg-distributed STATIC ${mg_distributed_sources}) @@ -322,7 +324,8 @@ add_custom_target(generate_capnp_single_node_ha DEPENDS generate_lcp_single_node set(MG_SINGLE_NODE_HA_LIBS stdc++fs Threads::Threads fmt cppitertools antlr_opencypher_parser_lib dl glog gflags capnp kj - mg-utils mg-io mg-integrations-kafka mg-requests mg-communication mg-auth mg-stats) + mg-utils mg-io mg-integrations-kafka mg-requests mg-communication mg-comm-rpc + mg-auth mg-stats) if (USE_LTALLOC) list(APPEND MG_SINGLE_NODE_HA_LIBS ltalloc) diff --git a/src/communication/CMakeLists.txt b/src/communication/CMakeLists.txt index c87219504..24bc9cd59 100644 --- a/src/communication/CMakeLists.txt +++ b/src/communication/CMakeLists.txt @@ -4,20 +4,26 @@ set(communication_src_files client.cpp context.cpp helpers.cpp - init.cpp - rpc/client.cpp - rpc/protocol.cpp - rpc/server.cpp) - -define_add_capnp(add_capnp communication_src_files communication_capnp_files) - -add_capnp(rpc/messages.capnp) - -add_custom_target(generate_communication_capnp DEPENDS ${communication_capnp_files}) + init.cpp) add_library(mg-communication STATIC ${communication_src_files}) target_link_libraries(mg-communication Threads::Threads mg-utils mg-io fmt glog gflags) target_link_libraries(mg-communication ${OPENSSL_LIBRARIES}) target_include_directories(mg-communication SYSTEM PUBLIC ${OPENSSL_INCLUDE_DIR}) -target_link_libraries(mg-communication capnp kj) -add_dependencies(mg-communication generate_communication_capnp) + +set(communication_rpc_src_files + rpc/client.cpp + rpc/protocol.cpp + rpc/server.cpp) + +define_add_capnp(add_capnp communication_rpc_src_files communication_rpc_capnp_files) + +add_capnp(rpc/messages.capnp) + +add_custom_target(generate_communication_rpc_capnp DEPENDS ${communication_rpc_capnp_files}) + +add_library(mg-comm-rpc STATIC ${communication_rpc_src_files}) +target_link_libraries(mg-comm-rpc Threads::Threads mg-communication mg-utils mg-io fmt glog gflags) +target_link_libraries(mg-comm-rpc capnp kj) + +add_dependencies(mg-comm-rpc generate_communication_rpc_capnp) diff --git a/src/stats/CMakeLists.txt b/src/stats/CMakeLists.txt index 5f49c7b56..f3808f78f 100644 --- a/src/stats/CMakeLists.txt +++ b/src/stats/CMakeLists.txt @@ -12,7 +12,7 @@ add_custom_target(generate_stats_lcp DEPENDS ${stats_lcp_files}) add_custom_target(generate_stats_capnp DEPENDS generate_stats_lcp ${stats_capnp_files}) add_library(mg-stats STATIC ${stats_src_files}) -target_link_libraries(mg-stats Threads::Threads mg-utils mg-io mg-communication fmt glog gflags) +target_link_libraries(mg-stats Threads::Threads mg-utils mg-io mg-comm-rpc fmt glog gflags) target_link_libraries(mg-stats capnp kj) add_dependencies(mg-stats generate_stats_lcp) add_dependencies(mg-stats generate_stats_capnp) diff --git a/tests/benchmark/CMakeLists.txt b/tests/benchmark/CMakeLists.txt index 776874a03..cf49dd617 100644 --- a/tests/benchmark/CMakeLists.txt +++ b/tests/benchmark/CMakeLists.txt @@ -52,7 +52,7 @@ add_benchmark(mvcc.cpp) target_link_libraries(${test_prefix}mvcc mg-single-node kvstore_dummy_lib) add_benchmark(rpc.cpp) -target_link_libraries(${test_prefix}rpc mg-communication) +target_link_libraries(${test_prefix}rpc mg-comm-rpc) add_benchmark(serialization.cpp) target_link_libraries(${test_prefix}serialization mg-distributed kvstore_dummy_lib) diff --git a/tests/macro_benchmark/CMakeLists.txt b/tests/macro_benchmark/CMakeLists.txt index 593d0f2ec..3b6233f53 100644 --- a/tests/macro_benchmark/CMakeLists.txt +++ b/tests/macro_benchmark/CMakeLists.txt @@ -18,7 +18,7 @@ add_macro_benchmark(clients/pokec_client.cpp) target_link_libraries(${test_prefix}pokec_client mg-communication mg-io mg-utils mg-stats json) add_macro_benchmark(clients/graph_500_bfs.cpp) -target_link_libraries(${test_prefix}graph_500_bfs mg-communication mg-io mg-utils mg-stats json) +target_link_libraries(${test_prefix}graph_500_bfs mg-communication mg-comm-rpc mg-io mg-utils mg-stats json) add_macro_benchmark(clients/bfs_pokec_client.cpp) target_link_libraries(${test_prefix}bfs_pokec_client mg-communication mg-io mg-utils mg-stats json) @@ -27,4 +27,4 @@ add_macro_benchmark(clients/query_client.cpp) target_link_libraries(${test_prefix}query_client mg-communication mg-io mg-utils) add_macro_benchmark(clients/card_fraud_client.cpp) -target_link_libraries(${test_prefix}card_fraud_client mg-communication mg-io mg-utils mg-stats json) +target_link_libraries(${test_prefix}card_fraud_client mg-communication mg-comm-rpc mg-io mg-utils mg-stats json) diff --git a/tests/unit/CMakeLists.txt b/tests/unit/CMakeLists.txt index a4852421b..07026c20e 100644 --- a/tests/unit/CMakeLists.txt +++ b/tests/unit/CMakeLists.txt @@ -297,7 +297,7 @@ add_unit_test(network_timeouts.cpp) target_link_libraries(${test_prefix}network_timeouts mg-communication) add_unit_test(rpc.cpp) -target_link_libraries(${test_prefix}rpc mg-communication) +target_link_libraries(${test_prefix}rpc mg-comm-rpc) # Test data structures