CMakeLists.txt 2.7 KB
Newer Older
1 2 3 4 5 6 7 8 9
if(NOT WITH_DISTRIBUTE)
    return()
endif()

if(WITH_GRPC)
    set(cc_generic_services "false")
else()
    set(cc_generic_services "true")
endif()
W
Wu Yi 已提交
10
configure_file(send_recv.proto.in ${CMAKE_CURRENT_BINARY_DIR}/send_recv.proto @ONLY)
11

W
Wu Yi 已提交
12
# FIXME(typhoonzero): use add_subdirectory once we clean the dependency of these files
Q
Qiao Longfei 已提交
13
set(DISTRIBUTE_COMPILE_FLAGS "-Wno-non-virtual-dtor -Wno-error=non-virtual-dtor -Wno-error=delete-non-virtual-dtor")
G
gongweibao 已提交
14
if(WITH_GRPC)
Y
Yiqun Liu 已提交
15
  set(GRPC_DEPS grpc++_unsecure grpc_unsecure gpr cares zlib protobuf)
W
Wu Yi 已提交
16 17 18 19 20 21 22
  set(GRPC_SRCS grpc/grpc_client.cc grpc/grpc_server.cc grpc/grpc_serde.cc grpc/grpc_bytebuffer_stream.cc grpc/grpc_variable_response.cc)
  grpc_library(sendrecvop_rpc SRCS sendrecvop_utils.cc
        request_handler_impl.cc rpc_client.cc rpc_server.cc
        variable_response.cc
        collective_client.cc collective_server.cc
        ${GRPC_SRCS}
      PROTO ${CMAKE_CURRENT_BINARY_DIR}/send_recv.proto 
Y
Yiqun Liu 已提交
23
      DEPS lod_tensor selected_rows_functor memory ${GRPC_DEPS})
Q
Qiao Longfei 已提交
24

G
gongweibao 已提交
25
  set_source_files_properties(grpc_serde_test.cc rpc_server_test.cc PROPERTIES COMPILE_FLAGS ${DISTRIBUTE_COMPILE_FLAGS})
Y
Yiqun Liu 已提交
26
  set(RPC_DEPS sendrecvop_rpc ${GRPC_DEPS})
27

W
Wu Yi 已提交
28 29
  cc_test(grpc_serde_test SRCS grpc/grpc_serde_test.cc 
    DEPS ${RPC_DEPS} scope profiler math_function SERIAL)
30

Q
Qiao Longfei 已提交
31
else()
32 33 34
  set_source_files_properties(brpc_server.cc parameter_prefetch.cc brpc_client.cc rpc_server_test.cc brpc_serde_test.cc
      brpc_variable_response.cc brpc_sendrecvop_utils.cc brpc_rdma_pool.cc collective_server.cc collective_server_test.cc
      collective_client.cc PROPERTIES COMPILE_FLAGS ${DISTRIBUTE_COMPILE_FLAGS})
35

W
Wu Yi 已提交
36 37 38 39 40 41 42
  set(BRPC_SRCS brpc/brpc_client.cc brpc/brpc/server.cc brpc/brpc_sendrecvop_utils.cc brpc/brpc_variable_response.cc brpc/brpc_rdma_pool.cc)
  brpc_library(sendrecvop_rpc SRCS sendrecvop_utils.cc
      request_handler_impl.cc rpc_client.cc rpc_server.cc
      variable_response.cc
      collective_client.cc collective_server.cc
      ${BRPC_SRCS}
    PROTO ${CMAKE_CURRENT_BINARY_DIR}/send_recv.proto
Q
Qiao Longfei 已提交
43
    DEPS lod_tensor selected_rows memory)
44

W
Wu Yi 已提交
45 46 47 48
  set(RPC_DEPS sendrecvop_rpc brpc ssl crypto protobuf leveldb snappystream snappy zlib)
  cc_test(brpc_serde_test SRCS brpc/brpc_serde_test.cc
      DEPS ${RPC_DEPS} gflags glog executor proto_desc lookup_sparse_table_op SERIAL)
endif()
G
gongweibao 已提交
49

50

W
Wu Yi 已提交
51 52 53 54 55 56 57 58
cc_test(rpc_server_test SRCS rpc_server_test.cc
    DEPS ${RPC_DEPS} executor proto_desc lookup_sparse_table_op SERIAL)
cc_test(varhandle_test SRCS varhandle_test.cc DEPS profiler)
cc_library(parameter_prefetch SRCS parameter_prefetch.cc DEPS sendrecvop_rpc memory)
if(WITH_GPU)
    cc_test(collective_server_test SRCS collective_server_test.cc 
        DEPS sendrecvop_rpc grpc++_unsecure grpc_unsecure gpr cares zlib protobuf executor
        selected_rows_functor  scope math_function SERIAL)
Q
Qiao Longfei 已提交
59
endif()