Commit 27643b64 authored by zhujiashun's avatar zhujiashun

add example support

parent b92c4981
......@@ -59,6 +59,11 @@ include_directories(
${PROTOBUF_HEADER}
${LEVELDB_HEADER}
)
# for *.so
set(CMAKE_LIBRARY_OUTPUT_DIRECTORY ${CMAKE_BINARY_DIR}/lib)
# for *.a
set(CMAKE_ARCHIVE_OUTPUT_DIRECTORY ${CMAKE_BINARY_DIR}/lib)
ADD_SUBDIRECTORY(src)
#ADD_SUBDIRECTORY(example)
ADD_SUBDIRECTORY(example)
set(EchoClient_SOURCES
${CMAKE_SOURCE_DIR}/example/echo/echo.pb.cc
${CMAKE_SOURCE_DIR}/example/echo/client.cpp
)
add_executable(EchoClient ${EchoClient_SOURCES})
target_link_libraries(EchoClient brpc)
set(EchoServer_SOURCES
${CMAKE_SOURCE_DIR}/example/echo/echo.pb.cc
${CMAKE_SOURCE_DIR}/example/echo/server.cpp
)
add_executable(EchoServer ${EchoServer_SOURCES})
target_link_libraries(EchoServer brpc)
add_subdirectory(http_c++)
add_subdirectory(asynchronous_echo_c++)
add_subdirectory(backup_request_c++)
add_subdirectory(cancel_c++)
add_subdirectory(cascade_echo_c++)
add_subdirectory(dynamic_partition_echo_c++)
add_subdirectory(echo_c++)
add_subdirectory(echo_c++_hulu_pbrpc)
add_subdirectory(echo_c++_sofa_pbrpc)
add_subdirectory(echo_c++_ubrpc_compack)
add_subdirectory(memcache_c++)
add_subdirectory(multi_threaded_echo_c++)
add_subdirectory(multi_threaded_echo_fns_c++)
add_subdirectory(multi_threaded_mcpack_c++)
add_subdirectory(nshead_extension_c++)
add_subdirectory(nshead_pb_extension_c++)
add_subdirectory(parallel_echo_c++)
add_subdirectory(partition_echo_c++)
# need readline library
#add_subdirectory(redis_c++)
add_subdirectory(selective_echo_c++)
add_subdirectory(session_data_and_thread_local)
add_subdirectory(streaming_echo_c++)
include(FindProtobuf)
find_package(Protobuf REQUIRED)
include_directories(${PROTOBUF_INCLUDE_DIR})
protobuf_generate_cpp(PROTO_SRC PROTO_HEADER echo.proto)
add_executable(asynchronous_echo_client client.cpp ${PROTO_SRC} ${PROTO_HEADER})
target_link_libraries(asynchronous_echo_client brpc)
add_executable(asynchronous_echo_server server.cpp ${PROTO_SRC} ${PROTO_HEADER})
target_link_libraries(asynchronous_echo_server brpc)
include(FindProtobuf)
find_package(Protobuf REQUIRED)
include_directories(${PROTOBUF_INCLUDE_DIR})
protobuf_generate_cpp(PROTO_SRC PROTO_HEADER echo.proto)
add_executable(backup_request_client client.cpp ${PROTO_SRC} ${PROTO_HEADER})
target_link_libraries(backup_request_client brpc)
add_executable(backup_request_server server.cpp ${PROTO_SRC} ${PROTO_HEADER})
target_link_libraries(backup_request_server brpc)
include(FindProtobuf)
find_package(Protobuf REQUIRED)
include_directories(${PROTOBUF_INCLUDE_DIR})
protobuf_generate_cpp(PROTO_SRC PROTO_HEADER echo.proto)
add_executable(cancel_client client.cpp ${PROTO_SRC} ${PROTO_HEADER})
target_link_libraries(cancel_client brpc)
add_executable(cancel_server server.cpp ${PROTO_SRC} ${PROTO_HEADER})
target_link_libraries(cancel_server brpc)
include(FindProtobuf)
find_package(Protobuf REQUIRED)
include_directories(${PROTOBUF_INCLUDE_DIR})
protobuf_generate_cpp(PROTO_SRC PROTO_HEADER echo.proto)
add_executable(cascade_echo_client client.cpp ${PROTO_SRC} ${PROTO_HEADER})
target_link_libraries(cascade_echo_client brpc)
add_executable(cascade_echo_server server.cpp ${PROTO_SRC} ${PROTO_HEADER})
target_link_libraries(cascade_echo_server brpc)
include(FindProtobuf)
find_package(Protobuf REQUIRED)
include_directories(${PROTOBUF_INCLUDE_DIR})
protobuf_generate_cpp(PROTO_SRC PROTO_HEADER echo.proto)
add_executable(dynamic_partition_echo_client client.cpp ${PROTO_SRC} ${PROTO_HEADER})
target_link_libraries(dynamic_partition_echo_client brpc)
add_executable(dynamic_partition_echo_server server.cpp ${PROTO_SRC} ${PROTO_HEADER})
target_link_libraries(dynamic_partition_echo_server brpc)
include(FindProtobuf)
find_package(Protobuf REQUIRED)
include_directories(${PROTOBUF_INCLUDE_DIR})
protobuf_generate_cpp(PROTO_SRC PROTO_HEADER echo.proto)
add_executable(echo_client client.cpp ${PROTO_SRC} ${PROTO_HEADER})
target_link_libraries(echo_client brpc)
add_executable(echo_server server.cpp ${PROTO_SRC} ${PROTO_HEADER})
target_link_libraries(echo_server brpc)
include(FindProtobuf)
find_package(Protobuf REQUIRED)
include_directories(${PROTOBUF_INCLUDE_DIR})
protobuf_generate_cpp(PROTO_SRC PROTO_HEADER echo.proto)
add_executable(echo_hulu_pbrpc_client client.cpp ${PROTO_SRC} ${PROTO_HEADER})
target_link_libraries(echo_hulu_pbrpc_client brpc)
add_executable(echo_hulu_pbrpc_server server.cpp ${PROTO_SRC} ${PROTO_HEADER})
target_link_libraries(echo_hulu_pbrpc_server brpc)
include(FindProtobuf)
find_package(Protobuf REQUIRED)
include_directories(${PROTOBUF_INCLUDE_DIR})
protobuf_generate_cpp(PROTO_SRC PROTO_HEADER echo.proto)
add_executable(echo_sofa_pbrpc_client client.cpp ${PROTO_SRC} ${PROTO_HEADER})
target_link_libraries(echo_sofa_pbrpc_client brpc)
add_executable(echo_sofa_pbrpc_server server.cpp ${PROTO_SRC} ${PROTO_HEADER})
target_link_libraries(echo_sofa_pbrpc_server brpc)
include(FindProtobuf)
find_package(Protobuf REQUIRED)
include_directories(${PROTOBUF_INCLUDE_DIR})
include_directories(${CMAKE_CURRENT_BINARY_DIR})
execute_process(
COMMAND ${PROTOBUF_PROTOC_EXECUTABLE} ${PROTO_FLAGS} --cpp_out=${CMAKE_CURRENT_BINARY_DIR} --proto_path=${PROTOBUF_INCLUDE_DIR} --proto_path=${CMAKE_CURRENT_BINARY_DIR}/../../src/ --proto_path=${CMAKE_CURRENT_BINARY_DIR} ${CMAKE_CURRENT_BINARY_DIR}/echo.proto
WORKING_DIRECTORY ${CMAKE_CURRENT_BINARY_DIR}
)
add_executable(echo_ubrpc_compack_client client.cpp echo.pb.cc)
target_link_libraries(echo_ubrpc_compack_client brpc)
add_executable(echo_ubrpc_compack_server server.cpp echo.pb.cc)
target_link_libraries(echo_ubrpc_compack_server brpc)
include(FindProtobuf)
find_package(Protobuf REQUIRED)
include_directories(${PROTOBUF_INCLUDE_DIR})
protobuf_generate_cpp(PROTO_SRC PROTO_HEADER http.proto)
add_executable(http_client http_client.cpp)
target_link_libraries(http_client brpc)
add_executable(http_server http_server.cpp ${PROTO_SRC} ${PROTO_HEADER})
target_link_libraries(http_server brpc)
add_executable(benchmark_http benchmark_http.cpp)
target_link_libraries(benchmark_http brpc)
add_executable(memcache_client client.cpp)
target_link_libraries(memcache_client brpc)
include(FindProtobuf)
find_package(Protobuf REQUIRED)
include_directories(${PROTOBUF_INCLUDE_DIR})
protobuf_generate_cpp(PROTO_SRC PROTO_HEADER echo.proto)
add_executable(multi_threaded_echo_client client.cpp ${PROTO_SRC} ${PROTO_HEADER})
target_link_libraries(multi_threaded_echo_client brpc)
add_executable(multi_threaded_echo_server server.cpp ${PROTO_SRC} ${PROTO_HEADER})
target_link_libraries(multi_threaded_echo_server brpc)
include(FindProtobuf)
find_package(Protobuf REQUIRED)
include_directories(${PROTOBUF_INCLUDE_DIR})
protobuf_generate_cpp(PROTO_SRC PROTO_HEADER echo.proto)
add_executable(multi_threaded_echo_fns_client client.cpp ${PROTO_SRC} ${PROTO_HEADER})
target_link_libraries(multi_threaded_echo_fns_client brpc)
add_executable(multi_threaded_echo_fns_server server.cpp ${PROTO_SRC} ${PROTO_HEADER})
target_link_libraries(multi_threaded_echo_fns_server brpc)
include(FindProtobuf)
find_package(Protobuf REQUIRED)
include_directories(${PROTOBUF_INCLUDE_DIR})
include_directories(${CMAKE_CURRENT_BINARY_DIR})
execute_process(
COMMAND ${PROTOBUF_PROTOC_EXECUTABLE} ${PROTO_FLAGS} --cpp_out=${CMAKE_CURRENT_BINARY_DIR} --proto_path=${PROTOBUF_INCLUDE_DIR} --proto_path=${CMAKE_CURRENT_BINARY_DIR}/../../src/ --proto_path=${CMAKE_CURRENT_BINARY_DIR} ${CMAKE_CURRENT_BINARY_DIR}/echo.proto
WORKING_DIRECTORY ${CMAKE_CURRENT_BINARY_DIR}
)
add_executable(multi_threaded_mcpack_client client.cpp echo.pb.cc)
target_link_libraries(multi_threaded_mcpack_client brpc)
add_executable(multi_threaded_mcpack_server server.cpp echo.pb.cc)
target_link_libraries(multi_threaded_mcpack_server brpc)
add_executable(nshead_extension_client client.cpp)
target_link_libraries(nshead_extension_client brpc)
add_executable(nshead_extension_server server.cpp)
target_link_libraries(nshead_extension_server brpc)
include(FindProtobuf)
find_package(Protobuf REQUIRED)
include_directories(${PROTOBUF_INCLUDE_DIR})
protobuf_generate_cpp(PROTO_SRC PROTO_HEADER echo.proto)
add_executable(nshead_pb_extension_client client.cpp ${PROTO_SRC} ${PROTO_HEADER})
target_link_libraries(nshead_pb_extension_client brpc)
add_executable(nshead_pb_extension_server server.cpp ${PROTO_SRC} ${PROTO_HEADER})
target_link_libraries(nshead_pb_extension_server brpc)
include(FindProtobuf)
find_package(Protobuf REQUIRED)
include_directories(${PROTOBUF_INCLUDE_DIR})
protobuf_generate_cpp(PROTO_SRC PROTO_HEADER echo.proto)
add_executable(parallel_echo_client client.cpp ${PROTO_SRC} ${PROTO_HEADER})
target_link_libraries(parallel_echo_client brpc)
add_executable(parallel_echo_server server.cpp ${PROTO_SRC} ${PROTO_HEADER})
target_link_libraries(parallel_echo_server brpc)
include(FindProtobuf)
find_package(Protobuf REQUIRED)
include_directories(${PROTOBUF_INCLUDE_DIR})
protobuf_generate_cpp(PROTO_SRC PROTO_HEADER echo.proto)
add_executable(client client.cpp ${PROTO_SRC} ${PROTO_HEADER})
target_link_libraries(client brpc)
add_executable(server server.cpp ${PROTO_SRC} ${PROTO_HEADER})
target_link_libraries(server brpc)
add_executable(redis_cli redis_cli.cpp)
target_link_libraries(redis_cli brpc)
add_executable(redis_press redis_press.cpp)
target_link_libraries(redis_press brpc)
include(FindProtobuf)
find_package(Protobuf REQUIRED)
include_directories(${PROTOBUF_INCLUDE_DIR})
protobuf_generate_cpp(PROTO_SRC PROTO_HEADER echo.proto)
add_executable(selective_echo_client client.cpp ${PROTO_SRC} ${PROTO_HEADER})
target_link_libraries(selective_echo_client brpc)
add_executable(selective_echo_server server.cpp ${PROTO_SRC} ${PROTO_HEADER})
target_link_libraries(selective_echo_server brpc)
include(FindProtobuf)
find_package(Protobuf REQUIRED)
include_directories(${PROTOBUF_INCLUDE_DIR})
protobuf_generate_cpp(PROTO_SRC PROTO_HEADER echo.proto)
add_executable(session_data_and_thread_local_client client.cpp ${PROTO_SRC} ${PROTO_HEADER})
target_link_libraries(session_data_and_thread_local_client brpc)
add_executable(session_data_and_thread_local_server server.cpp ${PROTO_SRC} ${PROTO_HEADER})
target_link_libraries(session_data_and_thread_local_server brpc)
include(FindProtobuf)
find_package(Protobuf REQUIRED)
include_directories(${PROTOBUF_INCLUDE_DIR})
protobuf_generate_cpp(PROTO_SRC PROTO_HEADER echo.proto)
add_executable(streaming_echo_client client.cpp ${PROTO_SRC} ${PROTO_HEADER})
target_link_libraries(streaming_echo_client brpc)
add_executable(streaming_echo_server server.cpp ${PROTO_SRC} ${PROTO_HEADER})
target_link_libraries(streaming_echo_server brpc)
......@@ -5,17 +5,13 @@ find_package(Protobuf REQUIRED)
include_directories(${PROTOBUF_INCLUDE_DIR})
include_directories(${CMAKE_CURRENT_BINARY_DIR})
file(GLOB PROTOS "*.proto" "brpc/*.proto" "brpc/policy/*.proto")
message("PROTOBUF_INCLUDE_DIR=${PROTOBUF_INCLUDE_DIR}")
message("PROTOBUF_PROTOC_EXECUTABLE=${PROTOBUF_PROTOC_EXECUTABLE}")
message("proto=${PROTOS}")
message("CMAKE_CURRENT_BINARY_DIR=${CMAKE_CURRENT_BINARY_DIR}")
list(APPEND PROTO_FLAGS -I${CMAKE_CURRENT_BINARY_DIR})
foreach(PROTO ${PROTOS})
get_filename_component(PROTO_WE ${PROTO} NAME_WE)
list(APPEND PROTO_SRCS "${CMAKE_CURRENT_BINARY_DIR}/${PROTO_WE}.pb.cc")
list(APPEND PROTO_HDRS "${CMAKE_CURRENT_BINARY_DIR}/${PROTO_WE}.pb.h")
#list(APPEND PROTO_SRCS "${CMAKE_CURRENT_BINARY_DIR}/${PROTO_WE}.pb.cc")
#list(APPEND PROTO_HDRS "${CMAKE_CURRENT_BINARY_DIR}/${PROTO_WE}.pb.h")
execute_process(
COMMAND ${PROTOBUF_PROTOC_EXECUTABLE} ${PROTO_FLAGS} --cpp_out=${CMAKE_CURRENT_BINARY_DIR} --proto_path=${PROTOBUF_INCLUDE_DIR} ${PROTO}
......
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment