Commit d71fb5e3 authored by zhujiashun's avatar zhujiashun

Improve compatibility & set flags for test

parent 9ede407b
......@@ -18,8 +18,8 @@ endif()
option(WITH_GLOG "With glog" OFF)
option(DEBUG "Print debug logs" OFF)
option(WITH_DEBUG_SYMBOLS "With debug symbols" OFF)
option(BUILD_EXAMPLE "Whether building examples" OFF)
option(BUILD_UNIT_TESTS "Whether building unit tests" OFF)
option(BUILD_EXAMPLE "Whether to build examples" OFF)
option(BUILD_UNIT_TESTS "Whether to build unit tests" OFF)
option(EXAMPLE_LINK_SO "Whether examples are linked dynamically" OFF)
set(WITH_GLOG_VAL "0")
......@@ -113,7 +113,7 @@ set(CMAKE_LIBRARY_OUTPUT_DIRECTORY ${CMAKE_BINARY_DIR}/lib)
# for *.a
set(CMAKE_ARCHIVE_OUTPUT_DIRECTORY ${CMAKE_BINARY_DIR}/lib)
file(GLOB PROTOS "src/*.proto")
file(GLOB PROTOS "${CMAKE_SOURCE_DIR}/src/*.proto")
list(APPEND PROTO_FLAGS -I${CMAKE_CURRENT_BINARY_DIR})
foreach(PROTO ${PROTOS})
get_filename_component(PROTO_WE ${PROTO} NAME_WE)
......@@ -124,25 +124,8 @@ foreach(PROTO ${PROTOS})
)
endforeach()
file(GLOB brpc_PROTOS "src/brpc/*.proto")
foreach(PROTO ${brpc_PROTOS})
get_filename_component(PROTO_WE ${PROTO} NAME_WE)
list(APPEND PROTO_SRCS "${CMAKE_CURRENT_BINARY_DIR}/brpc/${PROTO_WE}.pb.cc")
execute_process(
COMMAND ${PROTOBUF_PROTOC_EXECUTABLE} ${PROTO_FLAGS} --cpp_out=${CMAKE_CURRENT_BINARY_DIR} --proto_path=${PROTOBUF_INCLUDE_DIR} --proto_path=${CMAKE_SOURCE_DIR}/src --proto_path=${CMAKE_SOURCE_DIR}/src/brpc/ ${PROTO}
WORKING_DIRECTORY ${CMAKE_CURRENT_BINARY_DIR}
)
endforeach()
file(GLOB brpc_policy_PROTOS "src/brpc/policy/*.proto")
foreach(PROTO ${brpc_policy_PROTOS})
get_filename_component(PROTO_WE ${PROTO} NAME_WE)
list(APPEND PROTO_SRCS "${CMAKE_CURRENT_BINARY_DIR}/brpc/policy/${PROTO_WE}.pb.cc")
execute_process(
COMMAND ${PROTOBUF_PROTOC_EXECUTABLE} ${PROTO_FLAGS} --cpp_out=${CMAKE_CURRENT_BINARY_DIR} --proto_path=${PROTOBUF_INCLUDE_DIR} --proto_path=${CMAKE_SOURCE_DIR}/src --proto_path=${CMAKE_SOURCE_DIR}/src/brpc/policy ${PROTO}
WORKING_DIRECTORY ${CMAKE_CURRENT_BINARY_DIR}
)
endforeach()
file(GLOB BRPC_PROTOS "${CMAKE_SOURCE_DIR}/src/brpc/*.proto")
file(GLOB BRPC_POLICY_PROTOS "${CMAKE_SOURCE_DIR}/src/brpc/policy/*.proto")
# list all source files
set(BUTIL_SOURCES
......@@ -262,17 +245,17 @@ set(BUTIL_SOURCES
${CMAKE_SOURCE_DIR}/src/butil/popen.cpp
)
aux_source_directory(${CMAKE_SOURCE_DIR}/src/bvar BVAR_SOURCES1)
aux_source_directory(${CMAKE_SOURCE_DIR}/src/bvar/detail BVAR_SOURCES2)
aux_source_directory(${CMAKE_SOURCE_DIR}/src/bvar BVAR_SOURCES)
aux_source_directory(${CMAKE_SOURCE_DIR}/src/bvar/detail BVAR_DETAIL_SOURCES)
aux_source_directory(${CMAKE_SOURCE_DIR}/src/bthread BTHREAD_SOURCES)
aux_source_directory(${CMAKE_SOURCE_DIR}/src/json2pb JSON2PB_SOURCES)
aux_source_directory(${CMAKE_SOURCE_DIR}/src/brpc BRPC_SOURCES1)
aux_source_directory(${CMAKE_SOURCE_DIR}/src/brpc/details BRPC_SOURCES2)
aux_source_directory(${CMAKE_SOURCE_DIR}/src/brpc/builtin BRPC_SOURCES3)
aux_source_directory(${CMAKE_SOURCE_DIR}/src/brpc/policy BRPC_SOURCES4)
aux_source_directory(${CMAKE_SOURCE_DIR}/src/brpc BRPC_SOURCES)
aux_source_directory(${CMAKE_SOURCE_DIR}/src/brpc/details BRPC_DETAILS_SOURCES)
aux_source_directory(${CMAKE_SOURCE_DIR}/src/brpc/builtin BRPC_BUILTIN_SOURCES)
aux_source_directory(${CMAKE_SOURCE_DIR}/src/brpc/policy BRPC_POLICY_SOURCES)
set(MCPACK2PB_SOURCES
${CMAKE_SOURCE_DIR}/src/mcpack2pb/field_type.cpp
......@@ -282,16 +265,18 @@ set(MCPACK2PB_SOURCES
)
set(SOURCES
${BVAR_SOURCES1}
${BVAR_SOURCES2}
${BVAR_SOURCES}
${BVAR_DETAIL_SOURCES}
${BTHREAD_SOURCES}
${JSON2PB_SOURCES}
${MCPACK2PB_SOURCES}
${BRPC_SOURCES1}
${BRPC_SOURCES2}
${BRPC_SOURCES3}
${BRPC_SOURCES4}
${BRPC_SOURCES}
${BRPC_DETAILS_SOURCES}
${BRPC_BUILTIN_SOURCES}
${BRPC_POLICY_SOURCES}
${PROTO_SRCS}
${BRPC_PROTOS}
${BRPC_POLICY_PROTOS}
)
add_subdirectory(src)
......@@ -308,10 +293,3 @@ install(DIRECTORY ${CMAKE_SOURCE_DIR}/src/
PATTERN "*.h"
PATTERN "*.hpp"
)
install(DIRECTORY ${CMAKE_CURRENT_BINARY_DIR}/
DESTINATION include
FILES_MATCHING
PATTERN "*.h"
PATTERN "*.hpp"
)
......@@ -2,6 +2,9 @@ if(BUILD_UNIT_TESTS)
return()
endif()
find_package(Gperftools)
include_directories(${GPERFTOOLS_INCLUDE_DIR})
add_subdirectory(http_c++)
add_subdirectory(asynchronous_echo_c++)
add_subdirectory(backup_request_c++)
......@@ -21,7 +24,7 @@ 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(redis_c++)
add_subdirectory(selective_echo_c++)
add_subdirectory(session_data_and_thread_local)
add_subdirectory(streaming_echo_c++)
......@@ -2,6 +2,9 @@ protobuf_generate_cpp(PROTO_SRC PROTO_HEADER echo.proto)
get_filename_component(HEADER_DIR ${PROTO_HEADER} DIRECTORY)
include_directories(${HEADER_DIR})
set(CMAKE_CPP_FLAGS "-DBRPC_WITH_GLOG=${WITH_GLOG_VAL} -DGFLAGS_NS=${GFLAGS_NS}")
set(CMAKE_CXX_FLAGS "${CMAKE_CPP_FLAGS} -DNDEBUG -O2 -D__const__= -pipe -W -Wall -Wno-unused-parameter -fPIC -fno-omit-frame-pointer")
add_executable(asynchronous_echo_client client.cpp ${PROTO_SRC})
add_executable(asynchronous_echo_server server.cpp ${PROTO_SRC})
......
......@@ -2,6 +2,9 @@ protobuf_generate_cpp(PROTO_SRC PROTO_HEADER echo.proto)
get_filename_component(HEADER_DIR ${PROTO_HEADER} DIRECTORY)
include_directories(${HEADER_DIR})
set(CMAKE_CPP_FLAGS "-DBRPC_WITH_GLOG=${WITH_GLOG_VAL} -DGFLAGS_NS=${GFLAGS_NS}")
set(CMAKE_CXX_FLAGS "${CMAKE_CPP_FLAGS} -DNDEBUG -O2 -D__const__= -pipe -W -Wall -Wno-unused-parameter -fPIC -fno-omit-frame-pointer")
add_executable(backup_request_client client.cpp ${PROTO_SRC} ${PROTO_HEADER})
add_executable(backup_request_server server.cpp ${PROTO_SRC} ${PROTO_HEADER})
......
......@@ -2,6 +2,9 @@ protobuf_generate_cpp(PROTO_SRC PROTO_HEADER echo.proto)
get_filename_component(HEADER_DIR ${PROTO_HEADER} DIRECTORY)
include_directories(${HEADER_DIR})
set(CMAKE_CPP_FLAGS "-DBRPC_WITH_GLOG=${WITH_GLOG_VAL} -DGFLAGS_NS=${GFLAGS_NS}")
set(CMAKE_CXX_FLAGS "${CMAKE_CPP_FLAGS} -DNDEBUG -O2 -D__const__= -pipe -W -Wall -Wno-unused-parameter -fPIC -fno-omit-frame-pointer")
add_executable(cancel_client client.cpp ${PROTO_SRC} ${PROTO_HEADER})
add_executable(cancel_server server.cpp ${PROTO_SRC} ${PROTO_HEADER})
......
......@@ -2,6 +2,9 @@ protobuf_generate_cpp(PROTO_SRC PROTO_HEADER echo.proto)
get_filename_component(HEADER_DIR ${PROTO_HEADER} DIRECTORY)
include_directories(${HEADER_DIR})
set(CMAKE_CPP_FLAGS "-DBRPC_WITH_GLOG=${WITH_GLOG_VAL} -DGFLAGS_NS=${GFLAGS_NS}")
set(CMAKE_CXX_FLAGS "${CMAKE_CPP_FLAGS} -DNDEBUG -O2 -D__const__= -pipe -W -Wall -Wno-unused-parameter -fPIC -fno-omit-frame-pointer")
add_executable(cascade_echo_client client.cpp ${PROTO_SRC} ${PROTO_HEADER})
add_executable(cascade_echo_server server.cpp ${PROTO_SRC} ${PROTO_HEADER})
......
......@@ -2,13 +2,17 @@ protobuf_generate_cpp(PROTO_SRC PROTO_HEADER echo.proto)
get_filename_component(HEADER_DIR ${PROTO_HEADER} DIRECTORY)
include_directories(${HEADER_DIR})
set(CMAKE_CPP_FLAGS "-DBRPC_WITH_GLOG=${WITH_GLOG_VAL} -DGFLAGS_NS=${GFLAGS_NS}")
set(CMAKE_CXX_FLAGS "${CMAKE_CPP_FLAGS} -DNDEBUG -O2 -D__const__= -pipe -W -Wall -Wno-unused-parameter -fPIC -fno-omit-frame-pointer")
set(CMAKE_CXX_FLAGS "${CMAKE_CXX_FLAGS} -DBRPC_ENABLE_CPU_PROFILER")
add_executable(dynamic_partition_echo_client client.cpp ${PROTO_SRC} ${PROTO_HEADER})
add_executable(dynamic_partition_echo_server server.cpp ${PROTO_SRC} ${PROTO_HEADER})
if(EXAMPLE_LINK_SO)
target_link_libraries(dynamic_partition_echo_client brpc)
target_link_libraries(dynamic_partition_echo_server brpc)
target_link_libraries(dynamic_partition_echo_client brpc ${GPERFTOOLS_LIBRARIES})
target_link_libraries(dynamic_partition_echo_server brpc ${GPERFTOOLS_LIBRARIES})
else()
target_link_libraries(dynamic_partition_echo_client brpc_static ${DYNAMIC_LIB})
target_link_libraries(dynamic_partition_echo_server brpc_static ${DYNAMIC_LIB})
target_link_libraries(dynamic_partition_echo_client brpc_static ${DYNAMIC_LIB} ${GPERFTOOLS_LIBRARIES})
target_link_libraries(dynamic_partition_echo_server brpc_static ${DYNAMIC_LIB} ${GPERFTOOLS_LIBRARIES})
endif()
......@@ -2,11 +2,13 @@ protobuf_generate_cpp(PROTO_SRC PROTO_HEADER echo.proto)
get_filename_component(HEADER_DIR ${PROTO_HEADER} DIRECTORY)
include_directories(${HEADER_DIR})
set(CMAKE_CPP_FLAGS "-DBRPC_WITH_GLOG=${WITH_GLOG_VAL} -DGFLAGS_NS=${GFLAGS_NS}")
set(CMAKE_CXX_FLAGS "${CMAKE_CPP_FLAGS} -DNDEBUG -O2 -D__const__= -pipe -W -Wall -Wno-unused-parameter -fPIC -fno-omit-frame-pointer")
add_executable(echo_client client.cpp ${PROTO_SRC} ${PROTO_HEADER})
add_executable(echo_server server.cpp ${PROTO_SRC} ${PROTO_HEADER})
if(EXAMPLE_LINK_SO)
message("EXAMPLE_LINK_SO")
target_link_libraries(echo_client brpc)
target_link_libraries(echo_server brpc)
else()
......
......@@ -2,6 +2,9 @@ protobuf_generate_cpp(PROTO_SRC PROTO_HEADER echo.proto)
get_filename_component(HEADER_DIR ${PROTO_HEADER} DIRECTORY)
include_directories(${HEADER_DIR})
set(CMAKE_CPP_FLAGS "-DBRPC_WITH_GLOG=${WITH_GLOG_VAL} -DGFLAGS_NS=${GFLAGS_NS}")
set(CMAKE_CXX_FLAGS "${CMAKE_CPP_FLAGS} -DNDEBUG -O2 -D__const__= -pipe -W -Wall -Wno-unused-parameter -fPIC -fno-omit-frame-pointer")
add_executable(echo_hulu_pbrpc_client client.cpp ${PROTO_SRC} ${PROTO_HEADER})
add_executable(echo_hulu_pbrpc_server server.cpp ${PROTO_SRC} ${PROTO_HEADER})
......
......@@ -2,6 +2,9 @@ protobuf_generate_cpp(PROTO_SRC PROTO_HEADER echo.proto)
get_filename_component(HEADER_DIR ${PROTO_HEADER} DIRECTORY)
include_directories(${HEADER_DIR})
set(CMAKE_CPP_FLAGS "-DBRPC_WITH_GLOG=${WITH_GLOG_VAL} -DGFLAGS_NS=${GFLAGS_NS}")
set(CMAKE_CXX_FLAGS "${CMAKE_CPP_FLAGS} -DNDEBUG -O2 -D__const__= -pipe -W -Wall -Wno-unused-parameter -fPIC -fno-omit-frame-pointer")
add_executable(echo_sofa_pbrpc_client client.cpp ${PROTO_SRC} ${PROTO_HEADER})
add_executable(echo_sofa_pbrpc_server server.cpp ${PROTO_SRC} ${PROTO_HEADER})
......
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_SOURCE_DIR}/src --proto_path=${CMAKE_SOURCE_DIR}/example/echo_c++_ubrpc_compack/ ${CMAKE_SOURCE_DIR}/example/echo_c++_ubrpc_compack/echo.proto
add_custom_target(
CUSTOM_PROTO ALL
COMMAND ${PROTOBUF_PROTOC_EXECUTABLE} ${PROTO_FLAGS} --cpp_out=${CMAKE_CURRENT_BINARY_DIR} --proto_path=${PROTOBUF_INCLUDE_DIR} --proto_path=${CMAKE_SOURCE_DIR}/src --proto_path=${CMAKE_SOURCE_DIR}/example/echo_c++_ubrpc_compack/ --plugin=protoc-gen-mcpack=${CMAKE_CURRENT_BINARY_DIR}/../../src/protoc-gen-mcpack --mcpack_out=${CMAKE_CURRENT_BINARY_DIR} ${CMAKE_SOURCE_DIR}/example/echo_c++_ubrpc_compack/echo.proto
DEPENDS protoc-gen-mcpack
WORKING_DIRECTORY ${CMAKE_CURRENT_BINARY_DIR}
)
set(CMAKE_CPP_FLAGS "-DBRPC_WITH_GLOG=${WITH_GLOG_VAL} -DGFLAGS_NS=${GFLAGS_NS}")
set(CMAKE_CXX_FLAGS "${CMAKE_CPP_FLAGS} -DNDEBUG -O2 -D__const__= -pipe -W -Wall -Wno-unused-parameter -fPIC -fno-omit-frame-pointer")
set_source_files_properties(${CMAKE_CURRENT_BINARY_DIR}/echo.pb.cc PROPERTIES GENERATED TRUE)
add_executable(echo_ubrpc_compack_client client.cpp ${CMAKE_CURRENT_BINARY_DIR}/echo.pb.cc)
add_executable(echo_ubrpc_compack_server server.cpp ${CMAKE_CURRENT_BINARY_DIR}/echo.pb.cc)
add_dependencies(echo_ubrpc_compack_client CUSTOM_PROTO)
add_dependencies(echo_ubrpc_compack_server CUSTOM_PROTO)
if(EXAMPLE_LINK_SO)
target_link_libraries(echo_ubrpc_compack_client brpc)
target_link_libraries(echo_ubrpc_compack_server brpc)
......
......@@ -2,16 +2,20 @@ protobuf_generate_cpp(PROTO_SRC PROTO_HEADER http.proto)
get_filename_component(HEADER_DIR ${PROTO_HEADER} DIRECTORY)
include_directories(${HEADER_DIR})
set(CMAKE_CPP_FLAGS "-DBRPC_WITH_GLOG=${WITH_GLOG_VAL} -DGFLAGS_NS=${GFLAGS_NS}")
set(CMAKE_CXX_FLAGS "${CMAKE_CPP_FLAGS} -DNDEBUG -O2 -D__const__= -pipe -W -Wall -Wno-unused-parameter -fPIC -fno-omit-frame-pointer")
set(CMAKE_CXX_FLAGS "${CMAKE_CXX_FLAGS} -DBRPC_ENABLE_CPU_PROFILER")
add_executable(http_client http_client.cpp)
add_executable(http_server http_server.cpp ${PROTO_SRC} ${PROTO_HEADER})
add_executable(benchmark_http benchmark_http.cpp)
if(EXAMPLE_LINK_SO)
target_link_libraries(http_server brpc)
target_link_libraries(http_client brpc)
target_link_libraries(benchmark_http brpc)
target_link_libraries(http_server brpc ${GPERFTOOLS_LIBRARIES})
target_link_libraries(http_client brpc ${GPERFTOOLS_LIBRARIES})
target_link_libraries(benchmark_http brpc ${GPERFTOOLS_LIBRARIES})
else()
target_link_libraries(http_server brpc_static ${DYNAMIC_LIB})
target_link_libraries(http_client brpc_static ${DYNAMIC_LIB})
target_link_libraries(benchmark_http brpc_static ${DYNAMIC_LIB})
target_link_libraries(http_server brpc_static ${DYNAMIC_LIB} ${GPERFTOOLS_LIBRARIES})
target_link_libraries(http_client brpc_static ${DYNAMIC_LIB} ${GPERFTOOLS_LIBRARIES})
target_link_libraries(benchmark_http brpc_static ${DYNAMIC_LIB} ${GPERFTOOLS_LIBRARIES})
endif()
add_executable(memcache_client client.cpp)
set(CMAKE_CPP_FLAGS "-DBRPC_WITH_GLOG=${WITH_GLOG_VAL} -DGFLAGS_NS=${GFLAGS_NS}")
set(CMAKE_CXX_FLAGS "${CMAKE_CPP_FLAGS} -DNDEBUG -O2 -D__const__= -pipe -W -Wall -Wno-unused-parameter -fPIC -fno-omit-frame-pointer")
if(EXAMPLE_LINK_SO)
target_link_libraries(memcache_client brpc)
else()
......
......@@ -2,13 +2,17 @@ protobuf_generate_cpp(PROTO_SRC PROTO_HEADER echo.proto)
get_filename_component(HEADER_DIR ${PROTO_HEADER} DIRECTORY)
include_directories(${HEADER_DIR})
set(CMAKE_CPP_FLAGS "-DBRPC_WITH_GLOG=${WITH_GLOG_VAL} -DGFLAGS_NS=${GFLAGS_NS}")
set(CMAKE_CXX_FLAGS "${CMAKE_CPP_FLAGS} -DNDEBUG -O2 -D__const__= -pipe -W -Wall -Wno-unused-parameter -fPIC -fno-omit-frame-pointer")
set(CMAKE_CXX_FLAGS "${CMAKE_CXX_FLAGS} -DBRPC_ENABLE_CPU_PROFILER")
add_executable(multi_threaded_echo_client client.cpp ${PROTO_SRC} ${PROTO_HEADER})
add_executable(multi_threaded_echo_server server.cpp ${PROTO_SRC} ${PROTO_HEADER})
if(EXAMPLE_LINK_SO)
target_link_libraries(multi_threaded_echo_client brpc)
target_link_libraries(multi_threaded_echo_server brpc)
target_link_libraries(multi_threaded_echo_client brpc ${GPERFTOOLS_LIBRARIES})
target_link_libraries(multi_threaded_echo_server brpc ${GPERFTOOLS_LIBRARIES})
else()
target_link_libraries(multi_threaded_echo_client brpc_static ${DYNAMIC_LIB})
target_link_libraries(multi_threaded_echo_server brpc_static ${DYNAMIC_LIB})
target_link_libraries(multi_threaded_echo_client brpc_static ${DYNAMIC_LIB} ${GPERFTOOLS_LIBRARIES})
target_link_libraries(multi_threaded_echo_server brpc_static ${DYNAMIC_LIB} ${GPERFTOOLS_LIBRARIES})
endif()
......@@ -2,13 +2,17 @@ protobuf_generate_cpp(PROTO_SRC PROTO_HEADER echo.proto)
get_filename_component(HEADER_DIR ${PROTO_HEADER} DIRECTORY)
include_directories(${HEADER_DIR})
set(CMAKE_CPP_FLAGS "-DBRPC_WITH_GLOG=${WITH_GLOG_VAL} -DGFLAGS_NS=${GFLAGS_NS}")
set(CMAKE_CXX_FLAGS "${CMAKE_CPP_FLAGS} -DNDEBUG -O2 -D__const__= -pipe -W -Wall -Wno-unused-parameter -fPIC -fno-omit-frame-pointer")
set(CMAKE_CXX_FLAGS "${CMAKE_CXX_FLAGS} -DBRPC_ENABLE_CPU_PROFILER")
add_executable(multi_threaded_echo_fns_client client.cpp ${PROTO_SRC} ${PROTO_HEADER})
add_executable(multi_threaded_echo_fns_server server.cpp ${PROTO_SRC} ${PROTO_HEADER})
if(EXAMPLE_LINK_SO)
target_link_libraries(multi_threaded_echo_fns_client brpc)
target_link_libraries(multi_threaded_echo_fns_server brpc)
target_link_libraries(multi_threaded_echo_fns_client brpc ${GPERFTOOLS_LIBRARIES})
target_link_libraries(multi_threaded_echo_fns_server brpc ${GPERFTOOLS_LIBRARIES})
else()
target_link_libraries(multi_threaded_echo_fns_client brpc_static ${DYNAMIC_LIB})
target_link_libraries(multi_threaded_echo_fns_server brpc_static ${DYNAMIC_LIB})
target_link_libraries(multi_threaded_echo_fns_client brpc_static ${DYNAMIC_LIB} ${GPERFTOOLS_LIBRARIES})
target_link_libraries(multi_threaded_echo_fns_server brpc_static ${DYNAMIC_LIB} ${GPERFTOOLS_LIBRARIES})
endif()
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_SOURCE_DIR}/src --proto_path=${CMAKE_SOURCE_DIR}/example/multi_threaded_mcpack_c++ ${CMAKE_SOURCE_DIR}/example/multi_threaded_mcpack_c++/echo.proto
add_custom_target(
CUSTOM_PROTO_MULTI_THREAD ALL
COMMAND ${PROTOBUF_PROTOC_EXECUTABLE} ${PROTO_FLAGS} --cpp_out=${CMAKE_CURRENT_BINARY_DIR} --proto_path=${PROTOBUF_INCLUDE_DIR} --proto_path=${CMAKE_SOURCE_DIR}/src --proto_path=${CMAKE_SOURCE_DIR}/example/multi_threaded_mcpack_c++ --plugin=protoc-gen-mcpack=${CMAKE_CURRENT_BINARY_DIR}/../../src/protoc-gen-mcpack --mcpack_out=${CMAKE_CURRENT_BINARY_DIR} ${CMAKE_SOURCE_DIR}/example/multi_threaded_mcpack_c++/echo.proto
DEPENDS protoc-gen-mcpack
WORKING_DIRECTORY ${CMAKE_CURRENT_BINARY_DIR}
)
set(CMAKE_CPP_FLAGS "-DBRPC_WITH_GLOG=${WITH_GLOG_VAL} -DGFLAGS_NS=${GFLAGS_NS}")
set(CMAKE_CXX_FLAGS "${CMAKE_CPP_FLAGS} -DNDEBUG -O2 -D__const__= -pipe -W -Wall -Wno-unused-parameter -fPIC -fno-omit-frame-pointer")
set(CMAKE_CXX_FLAGS "${CMAKE_CXX_FLAGS} -DBRPC_ENABLE_CPU_PROFILER")
set_source_files_properties(${CMAKE_CURRENT_BINARY_DIR}/echo.pb.cc PROPERTIES GENERATED TRUE)
add_executable(multi_threaded_mcpack_client client.cpp ${CMAKE_CURRENT_BINARY_DIR}/echo.pb.cc)
add_executable(multi_threaded_mcpack_server server.cpp ${CMAKE_CURRENT_BINARY_DIR}/echo.pb.cc)
add_dependencies(multi_threaded_mcpack_client CUSTOM_PROTO_MULTI_THREAD)
add_dependencies(multi_threaded_mcpack_server CUSTOM_PROTO_MULTI_THREAD)
if(EXAMPLE_LINK_SO)
target_link_libraries(multi_threaded_mcpack_client brpc)
target_link_libraries(multi_threaded_mcpack_server brpc)
target_link_libraries(multi_threaded_mcpack_client brpc ${GPERFTOOLS_LIBRARIES})
target_link_libraries(multi_threaded_mcpack_server brpc ${GPERFTOOLS_LIBRARIES})
else()
target_link_libraries(multi_threaded_mcpack_client brpc_static ${DYNAMIC_LIB})
target_link_libraries(multi_threaded_mcpack_server brpc_static ${DYNAMIC_LIB})
target_link_libraries(multi_threaded_mcpack_client brpc_static ${DYNAMIC_LIB} ${GPERFTOOLS_LIBRARIES})
target_link_libraries(multi_threaded_mcpack_server brpc_static ${DYNAMIC_LIB} ${GPERFTOOLS_LIBRARIES})
endif()
add_executable(nshead_extension_client client.cpp)
add_executable(nshead_extension_server server.cpp)
set(CMAKE_CPP_FLAGS "-DBRPC_WITH_GLOG=${WITH_GLOG_VAL} -DGFLAGS_NS=${GFLAGS_NS}")
set(CMAKE_CXX_FLAGS "${CMAKE_CPP_FLAGS} -DNDEBUG -O2 -D__const__= -pipe -W -Wall -Wno-unused-parameter -fPIC -fno-omit-frame-pointer")
if(EXAMPLE_LINK_SO)
target_link_libraries(nshead_extension_client brpc)
target_link_libraries(nshead_extension_server brpc)
......
......@@ -2,6 +2,9 @@ protobuf_generate_cpp(PROTO_SRC PROTO_HEADER echo.proto)
get_filename_component(HEADER_DIR ${PROTO_HEADER} DIRECTORY)
include_directories(${HEADER_DIR})
set(CMAKE_CPP_FLAGS "-DBRPC_WITH_GLOG=${WITH_GLOG_VAL} -DGFLAGS_NS=${GFLAGS_NS}")
set(CMAKE_CXX_FLAGS "${CMAKE_CPP_FLAGS} -DNDEBUG -O2 -D__const__= -pipe -W -Wall -Wno-unused-parameter -fPIC -fno-omit-frame-pointer")
add_executable(nshead_pb_extension_client client.cpp ${PROTO_SRC} ${PROTO_HEADER})
add_executable(nshead_pb_extension_server server.cpp ${PROTO_SRC} ${PROTO_HEADER})
......
......@@ -2,13 +2,17 @@ protobuf_generate_cpp(PROTO_SRC PROTO_HEADER echo.proto)
get_filename_component(HEADER_DIR ${PROTO_HEADER} DIRECTORY)
include_directories(${HEADER_DIR})
set(CMAKE_CPP_FLAGS "-DBRPC_WITH_GLOG=${WITH_GLOG_VAL} -DGFLAGS_NS=${GFLAGS_NS}")
set(CMAKE_CXX_FLAGS "${CMAKE_CPP_FLAGS} -DNDEBUG -O2 -D__const__= -pipe -W -Wall -Wno-unused-parameter -fPIC -fno-omit-frame-pointer")
set(CMAKE_CXX_FLAGS "${CMAKE_CXX_FLAGS} -DBRPC_ENABLE_CPU_PROFILER")
add_executable(parallel_echo_client client.cpp ${PROTO_SRC} ${PROTO_HEADER})
add_executable(parallel_echo_server server.cpp ${PROTO_SRC} ${PROTO_HEADER})
if(EXAMPLE_LINK_SO)
target_link_libraries(parallel_echo_client brpc)
target_link_libraries(parallel_echo_server brpc)
target_link_libraries(parallel_echo_client brpc ${GPERFTOOLS_LIBRARIES})
target_link_libraries(parallel_echo_server brpc ${GPERFTOOLS_LIBRARIES})
else()
target_link_libraries(parallel_echo_client brpc_static ${DYNAMIC_LIB})
target_link_libraries(parallel_echo_server brpc_static ${DYNAMIC_LIB})
target_link_libraries(parallel_echo_client brpc_static ${DYNAMIC_LIB} ${GPERFTOOLS_LIBRARIES})
target_link_libraries(parallel_echo_server brpc_static ${DYNAMIC_LIB} ${GPERFTOOLS_LIBRARIES})
endif()
......@@ -2,13 +2,17 @@ protobuf_generate_cpp(PROTO_SRC PROTO_HEADER echo.proto)
get_filename_component(HEADER_DIR ${PROTO_HEADER} DIRECTORY)
include_directories(${HEADER_DIR})
set(CMAKE_CPP_FLAGS "-DBRPC_WITH_GLOG=${WITH_GLOG_VAL} -DGFLAGS_NS=${GFLAGS_NS}")
set(CMAKE_CXX_FLAGS "${CMAKE_CPP_FLAGS} -DNDEBUG -O2 -D__const__= -pipe -W -Wall -Wno-unused-parameter -fPIC -fno-omit-frame-pointer")
set(CMAKE_CXX_FLAGS "${CMAKE_CXX_FLAGS} -DBRPC_ENABLE_CPU_PROFILER")
add_executable(client client.cpp ${PROTO_SRC} ${PROTO_HEADER})
add_executable(server server.cpp ${PROTO_SRC} ${PROTO_HEADER})
if (EXAMPLE_LINK_SO)
target_link_libraries(client brpc)
target_link_libraries(server brpc)
target_link_libraries(client brpc ${GPERFTOOLS_LIBRARIES})
target_link_libraries(server brpc ${GPERFTOOLS_LIBRARIES})
else()
target_link_libraries(client brpc_static ${DYNAMIC_LIB})
target_link_libraries(server brpc_static ${DYNAMIC_LIB})
target_link_libraries(client brpc_static ${DYNAMIC_LIB} ${GPERFTOOLS_LIBRARIES})
target_link_libraries(server brpc_static ${DYNAMIC_LIB} ${GPERFTOOLS_LIBRARIES})
endif()
add_executable(redis_cli redis_cli.cpp)
add_executable(redis_press redis_press.cpp)
set(CMAKE_CPP_FLAGS "-DBRPC_WITH_GLOG=${WITH_GLOG_VAL} -DGFLAGS_NS=${GFLAGS_NS}")
set(CMAKE_CXX_FLAGS "${CMAKE_CPP_FLAGS} -DNDEBUG -O2 -D__const__= -pipe -W -Wall -Wno-unused-parameter -fPIC -fno-omit-frame-pointer")
set(AUX_LIB readline ncurses)
if(EXAMPLE_LINK_SO)
target_link_libraries(redis_cli brpc)
target_link_libraries(redis_press brpc)
target_link_libraries(redis_cli brpc ${AUX_LIB})
target_link_libraries(redis_press brpc ${AUX_LIB})
else()
target_link_libraries(redis_cli brpc_static ${DYNAMIC_LIB})
target_link_libraries(redis_press brpc_static ${DYNAMIC_LIB})
target_link_libraries(redis_cli brpc_static ${DYNAMIC_LIB} ${AUX_LIB})
target_link_libraries(redis_press brpc_static ${DYNAMIC_LIB} ${AUX_LIB})
endif()
......@@ -2,13 +2,17 @@ protobuf_generate_cpp(PROTO_SRC PROTO_HEADER echo.proto)
get_filename_component(HEADER_DIR ${PROTO_HEADER} DIRECTORY)
include_directories(${HEADER_DIR})
set(CMAKE_CPP_FLAGS "-DBRPC_WITH_GLOG=${WITH_GLOG_VAL} -DGFLAGS_NS=${GFLAGS_NS}")
set(CMAKE_CXX_FLAGS "${CMAKE_CPP_FLAGS} -DNDEBUG -O2 -D__const__= -pipe -W -Wall -Wno-unused-parameter -fPIC -fno-omit-frame-pointer")
set(CMAKE_CXX_FLAGS "${CMAKE_CXX_FLAGS} -DBRPC_ENABLE_CPU_PROFILER")
add_executable(selective_echo_client client.cpp ${PROTO_SRC} ${PROTO_HEADER})
add_executable(selective_echo_server server.cpp ${PROTO_SRC} ${PROTO_HEADER})
if(EXAMPLE_LINK_SO)
target_link_libraries(selective_echo_client brpc)
target_link_libraries(selective_echo_server brpc)
target_link_libraries(selective_echo_client brpc ${GPERFTOOLS_LIBRARIES})
target_link_libraries(selective_echo_server brpc ${GPERFTOOLS_LIBRARIES})
else()
target_link_libraries(selective_echo_client brpc_static ${DYNAMIC_LIB})
target_link_libraries(selective_echo_server brpc_static ${DYNAMIC_LIB})
target_link_libraries(selective_echo_client brpc_static ${DYNAMIC_LIB} ${GPERFTOOLS_LIBRARIES})
target_link_libraries(selective_echo_server brpc_static ${DYNAMIC_LIB} ${GPERFTOOLS_LIBRARIES})
endif()
......@@ -2,13 +2,17 @@ protobuf_generate_cpp(PROTO_SRC PROTO_HEADER echo.proto)
get_filename_component(HEADER_DIR ${PROTO_HEADER} DIRECTORY)
include_directories(${HEADER_DIR})
set(CMAKE_CPP_FLAGS "-DBRPC_WITH_GLOG=${WITH_GLOG_VAL} -DGFLAGS_NS=${GFLAGS_NS}")
set(CMAKE_CXX_FLAGS "${CMAKE_CPP_FLAGS} -DNDEBUG -O2 -D__const__= -pipe -W -Wall -Wno-unused-parameter -fPIC -fno-omit-frame-pointer")
set(CMAKE_CXX_FLAGS "${CMAKE_CXX_FLAGS} -DBRPC_ENABLE_CPU_PROFILER")
add_executable(session_data_and_thread_local_client client.cpp ${PROTO_SRC} ${PROTO_HEADER})
add_executable(session_data_and_thread_local_server server.cpp ${PROTO_SRC} ${PROTO_HEADER})
if(EXAMPLE_LINK_SO)
target_link_libraries(session_data_and_thread_local_client brpc)
target_link_libraries(session_data_and_thread_local_server brpc)
target_link_libraries(session_data_and_thread_local_client brpc ${GPERFTOOLS_LIBRARIES})
target_link_libraries(session_data_and_thread_local_server brpc ${GPERFTOOLS_LIBRARIES})
else()
target_link_libraries(session_data_and_thread_local_client brpc_static ${DYNAMIC_LIB})
target_link_libraries(session_data_and_thread_local_server brpc_static ${DYNAMIC_LIB})
target_link_libraries(session_data_and_thread_local_client brpc_static ${DYNAMIC_LIB} ${GPERFTOOLS_LIBRARIES})
target_link_libraries(session_data_and_thread_local_server brpc_static ${DYNAMIC_LIB} ${GPERFTOOLS_LIBRARIES})
endif()
......@@ -2,6 +2,9 @@ protobuf_generate_cpp(PROTO_SRC PROTO_HEADER echo.proto)
get_filename_component(HEADER_DIR ${PROTO_HEADER} DIRECTORY)
include_directories(${HEADER_DIR})
set(CMAKE_CPP_FLAGS "-DBRPC_WITH_GLOG=${WITH_GLOG_VAL} -DGFLAGS_NS=${GFLAGS_NS}")
set(CMAKE_CXX_FLAGS "${CMAKE_CPP_FLAGS} -DNDEBUG -O2 -D__const__= -pipe -W -Wall -Wno-unused-parameter -fPIC -fno-omit-frame-pointer")
add_executable(streaming_echo_client client.cpp ${PROTO_SRC} ${PROTO_HEADER})
add_executable(streaming_echo_server server.cpp ${PROTO_SRC} ${PROTO_HEADER})
......
......@@ -139,7 +139,7 @@ SET(TEST_BUTIL_SOURCES
)
# -DBVAR_NOT_LINK_DEFAULT_VARIABLES not work for gcc >= 5.0, just remove the file to prevent linking into unit tests
set(BVAR_SOURCE ${BVAR_SOURCES1} ${BVAR_SOURCES2})
set(BVAR_SOURCE ${BVAR_SOURCES} ${BVAR_DETAIL_SOURCES})
list(REMOVE_ITEM BVAR_SOURCE ${CMAKE_SOURCE_DIR}/src/bvar/default_variables.cpp)
file(GLOB TEST_BVAR_SRCS "bvar_*_unittest.cpp")
......
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