Skip to content
Projects
Groups
Snippets
Help
Loading...
Sign in / Register
Toggle navigation
B
brpc
Project
Project
Details
Activity
Cycle Analytics
Repository
Repository
Files
Commits
Branches
Tags
Contributors
Graph
Compare
Charts
Issues
0
Issues
0
List
Board
Labels
Milestones
Merge Requests
0
Merge Requests
0
CI / CD
CI / CD
Pipelines
Jobs
Schedules
Charts
Packages
Packages
Wiki
Wiki
Snippets
Snippets
Members
Members
Collapse sidebar
Close sidebar
Activity
Graph
Charts
Create a new issue
Jobs
Commits
Issue Boards
Open sidebar
submodule
brpc
Commits
b87dfdbf
Commit
b87dfdbf
authored
Dec 07, 2017
by
zhujiashun
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
support all compilation features
parent
e859a21b
Show whitespace changes
Inline
Side-by-side
Showing
21 changed files
with
106 additions
and
24 deletions
+106
-24
CMakeLists.txt
CMakeLists.txt
+34
-7
CMakeLists.txt
example/asynchronous_echo_c++/CMakeLists.txt
+4
-2
CMakeLists.txt
example/backup_request_c++/CMakeLists.txt
+2
-0
CMakeLists.txt
example/cancel_c++/CMakeLists.txt
+2
-0
CMakeLists.txt
example/cascade_echo_c++/CMakeLists.txt
+2
-0
CMakeLists.txt
example/dynamic_partition_echo_c++/CMakeLists.txt
+2
-0
CMakeLists.txt
example/echo_c++/CMakeLists.txt
+2
-0
CMakeLists.txt
example/echo_c++_hulu_pbrpc/CMakeLists.txt
+2
-0
CMakeLists.txt
example/echo_c++_sofa_pbrpc/CMakeLists.txt
+2
-0
CMakeLists.txt
example/echo_c++_ubrpc_compack/CMakeLists.txt
+3
-3
CMakeLists.txt
example/http_c++/CMakeLists.txt
+2
-0
CMakeLists.txt
example/multi_threaded_echo_c++/CMakeLists.txt
+2
-0
CMakeLists.txt
example/multi_threaded_echo_fns_c++/CMakeLists.txt
+2
-0
CMakeLists.txt
example/multi_threaded_mcpack_c++/CMakeLists.txt
+3
-3
CMakeLists.txt
example/nshead_pb_extension_c++/CMakeLists.txt
+2
-0
CMakeLists.txt
example/parallel_echo_c++/CMakeLists.txt
+2
-0
CMakeLists.txt
example/partition_echo_c++/CMakeLists.txt
+2
-0
CMakeLists.txt
example/selective_echo_c++/CMakeLists.txt
+2
-0
CMakeLists.txt
example/session_data_and_thread_local/CMakeLists.txt
+2
-0
CMakeLists.txt
example/streaming_echo_c++/CMakeLists.txt
+2
-0
CMakeLists.txt
src/CMakeLists.txt
+30
-9
No files found.
CMakeLists.txt
View file @
b87dfdbf
cmake_minimum_required
(
VERSION 3.0
)
cmake_minimum_required
(
VERSION 3.0
)
project
(
brpc
)
project
(
brpc C CXX
)
if
(
CMAKE_CXX_COMPILER_VERSION VERSION_LESS 4.8
)
message
(
FATAL_ERROR
"GCC is too old, please install a newer version supporting C++11"
)
endif
()
option
(
WITH_GLOG
"With glog"
OFF
)
option
(
WITH_GLOG
"With glog"
OFF
)
if
(
WITH_GLOG
)
if
(
WITH_GLOG
)
...
@@ -7,20 +11,41 @@ if(WITH_GLOG)
...
@@ -7,20 +11,41 @@ if(WITH_GLOG)
else
()
else
()
set
(
WITH_GLOG_VAL
"0"
)
set
(
WITH_GLOG_VAL
"0"
)
endif
()
endif
()
configure_file
(
${
CMAKE_SOURCE_DIR
}
/config.h.in
${
CMAKE_SOURCE_DIR
}
/src/butil/config.h @ONLY
)
configure_file
(
${
CMAKE_SOURCE_DIR
}
/config.h.in
${
CMAKE_SOURCE_DIR
}
/src/butil/config.h @ONLY
)
set
(
CMAKE_MODULE_PATH
${
PROJECT_SOURCE_DIR
}
/cmake
)
find_package
(
Gflags REQUIRED
)
execute_process
(
COMMAND bash -c
"grep
\"
namespace [_A-Za-z0-9]
\\
+ {
\"
${
Gflags_INCLUDE_PATH
}
/gflags/gflags_declare.h | head -1 | awk '{print $2}'"
OUTPUT_VARIABLE GFLAGS_NS
)
# STREQUAL not works. Use MATCHES as workaround
if
(
${
GFLAGS_NS
}
MATCHES
".*GFLAGS_NAMESPACE.*"
)
execute_process
(
COMMAND bash -c
"grep
\"
#define GFLAGS_NAMESPACE [_A-Za-z0-9]
\\
+
\"
${
Gflags_INCLUDE_PATH
}
/gflags/gflags_declare.h | head -1 | awk '{print $3}' | tr -d
\"\\
n
\"
"
OUTPUT_VARIABLE GFLAGS_NS
)
endif
()
include_directories
(
include_directories
(
${
CMAKE_SOURCE_DIR
}
/src
${
CMAKE_SOURCE_DIR
}
/src
${
CMAKE_SOURCE_DIR
}
/example
${
CMAKE_SOURCE_DIR
}
/example
${
CMAKE_CURRENT_BINARY_DIR
}
/src
)
)
set
(
CMAKE_CPP_FLAGS
"-DBRPC_WITH_GLOG=0 -DGFLAGS_NS=google -g"
)
set
(
DEBUG_SYMBOLS
"-g"
)
set
(
CMAKE_CPP_FLAGS
"-DBRPC_WITH_GLOG=
${
WITH_GLOG_VAL
}
-DGFLAGS_NS=
${
GFLAGS_NS
}
"
)
set
(
CMAKE_CPP_FLAGS
"
${
CMAKE_CPP_FLAGS
}
-DBTHREAD_USE_FAST_PTHREAD_MUTEX -D__const__= -D_GNU_SOURCE -DUSE_SYMBOLIZE -DNO_TCMALLOC -D__STDC_FORMAT_MACROS -D__STDC_LIMIT_MACROS -D__STDC_CONSTANT_MACROS"
)
set
(
CMAKE_CPP_FLAGS
"
${
CMAKE_CPP_FLAGS
}
-DBTHREAD_USE_FAST_PTHREAD_MUTEX -D__const__= -D_GNU_SOURCE -DUSE_SYMBOLIZE -DNO_TCMALLOC -D__STDC_FORMAT_MACROS -D__STDC_LIMIT_MACROS -D__STDC_CONSTANT_MACROS"
)
set
(
CMAKE_CPP_FLAGS
"
${
CMAKE_CPP_FLAGS
}
${
DEBUG_SYMBOLS
}
"
)
set
(
CMAKE_CXX_FLAGS
"
${
CMAKE_CPP_FLAGS
}
-O2 -pipe -Wall -W -fPIC -fstrict-aliasing -Wno-invalid-offsetof -Wno-unused-parameter -fno-omit-frame-pointer -std=c++0x
-lpthread
"
)
set
(
CMAKE_CXX_FLAGS
"
${
CMAKE_CPP_FLAGS
}
-O2 -pipe -Wall -W -fPIC -fstrict-aliasing -Wno-invalid-offsetof -Wno-unused-parameter -fno-omit-frame-pointer -std=c++0x"
)
set
(
CMAKE_C_FLAGS
"
${
CMAKE_CPP_FLAGS
}
-O2 -pipe -Wall -W -fPIC -fstrict-aliasing -Wno-unused-parameter -fno-omit-frame-pointer"
)
set
(
CMAKE_C_FLAGS
"
${
CMAKE_CPP_FLAGS
}
-O2 -pipe -Wall -W -fPIC -fstrict-aliasing -Wno-unused-parameter -fno-omit-frame-pointer"
)
add_definitions
(
-DBTHREAD_USE_FAST_PTHREAD_MUTEX -D__const__= -D_GNU_SOURCE -DUSE_SYMBOLIZE -DNO_TCMALLOC -D__STDC_FORMAT_MACROS -D__STDC_LIMIT_MACROS -D__STDC_CONSTANT_MACROS
)
#
add_definitions(-DBTHREAD_USE_FAST_PTHREAD_MUTEX -D__const__= -D_GNU_SOURCE -DUSE_SYMBOLIZE -DNO_TCMALLOC -D__STDC_FORMAT_MACROS -D__STDC_LIMIT_MACROS -D__STDC_CONSTANT_MACROS)
#add_definitions(-DPROTOBUF_INLINE_NOT_IN_HEADERS=0)
#add_definitions(-DPROTOBUF_INLINE_NOT_IN_HEADERS=0)
#required by butil/crc32.cc to boost performance for 10x
#required by butil/crc32.cc to boost performance for 10x
...
@@ -32,6 +57,8 @@ if(CMAKE_CXX_COMPILER_VERSION VERSION_GREATER 7.0)
...
@@ -32,6 +57,8 @@ if(CMAKE_CXX_COMPILER_VERSION VERSION_GREATER 7.0)
set
(
CMAKE_CXX_FLAGS
"
${
CMAKE_CXX_FLAGS
}
-Wno-aligned-new"
)
set
(
CMAKE_CXX_FLAGS
"
${
CMAKE_CXX_FLAGS
}
-Wno-aligned-new"
)
endif
()
endif
()
find_package
(
Threads REQUIRED
)
find_path
(
GFLAGS_HEADER NAMES gflags/gflags.h PATHS $ENV{GFLAGS_HEADER_PATH}
)
find_path
(
GFLAGS_HEADER NAMES gflags/gflags.h PATHS $ENV{GFLAGS_HEADER_PATH}
)
find_library
(
GFLAGS_LIB NAMES gflags PATHS $ENV{GFLAGS_LIB_PATH}
)
find_library
(
GFLAGS_LIB NAMES gflags PATHS $ENV{GFLAGS_LIB_PATH}
)
#find_package(gflags REQUIRED)
#find_package(gflags REQUIRED)
...
@@ -44,12 +71,11 @@ find_path(LEVELDB_HEADER NAMES leveldb/db.h PATHS $ENV{LEVELDB_HEADER_PATH})
...
@@ -44,12 +71,11 @@ find_path(LEVELDB_HEADER NAMES leveldb/db.h PATHS $ENV{LEVELDB_HEADER_PATH})
find_library
(
LEVELDB_LIB NAMES leveldb PATHS $ENV{LEVELDB_LIB_PATH}
)
find_library
(
LEVELDB_LIB NAMES leveldb PATHS $ENV{LEVELDB_LIB_PATH}
)
if
(
WITH_GLOG
)
if
(
WITH_GLOG
)
find_path
(
GLOG_HEADER NAMES glog/logging.h
PATHS $ENV{GLOG_HEADER_PATH}
)
find_path
(
GLOG_HEADER NAMES glog/logging.h
)
find_library
(
GLOG_LIB NAMES glog
PATHS $ENV{GLOG_LIB_PATH}
)
find_library
(
GLOG_LIB NAMES glog
)
include_directories
(
${
GLOG_HEADER
}
)
include_directories
(
${
GLOG_HEADER
}
)
endif
()
endif
()
find_package
(
Threads
)
#protobuf 3.2
#protobuf 3.2
find_library
(
PROTOC_LIB NAMES protoc PATHS $ENV{PB_LIB_PATH}
)
find_library
(
PROTOC_LIB NAMES protoc PATHS $ENV{PB_LIB_PATH}
)
...
@@ -58,6 +84,7 @@ include_directories(
...
@@ -58,6 +84,7 @@ include_directories(
${
GFLAGS_HEADER
}
${
GFLAGS_HEADER
}
${
PROTOBUF_HEADER
}
${
PROTOBUF_HEADER
}
${
LEVELDB_HEADER
}
${
LEVELDB_HEADER
}
${
THREAD_HEADER
}
)
)
# for *.so
# for *.so
...
...
example/asynchronous_echo_c++/CMakeLists.txt
View file @
b87dfdbf
...
@@ -2,9 +2,11 @@ include(FindProtobuf)
...
@@ -2,9 +2,11 @@ include(FindProtobuf)
find_package
(
Protobuf REQUIRED
)
find_package
(
Protobuf REQUIRED
)
include_directories
(
${
PROTOBUF_INCLUDE_DIR
}
)
include_directories
(
${
PROTOBUF_INCLUDE_DIR
}
)
protobuf_generate_cpp
(
PROTO_SRC PROTO_HEADER echo.proto
)
protobuf_generate_cpp
(
PROTO_SRC PROTO_HEADER echo.proto
)
get_filename_component
(
HEADER_DIR
${
PROTO_HEADER
}
DIRECTORY
)
include_directories
(
${
HEADER_DIR
}
)
add_executable
(
asynchronous_echo_client client.cpp
${
PROTO_SRC
}
${
PROTO_HEADER
}
)
add_executable
(
asynchronous_echo_client client.cpp
${
PROTO_SRC
}
)
target_link_libraries
(
asynchronous_echo_client brpc
)
target_link_libraries
(
asynchronous_echo_client brpc
)
add_executable
(
asynchronous_echo_server server.cpp
${
PROTO_SRC
}
${
PROTO_HEADER
}
)
add_executable
(
asynchronous_echo_server server.cpp
${
PROTO_SRC
}
)
target_link_libraries
(
asynchronous_echo_server brpc
)
target_link_libraries
(
asynchronous_echo_server brpc
)
example/backup_request_c++/CMakeLists.txt
View file @
b87dfdbf
...
@@ -2,6 +2,8 @@ include(FindProtobuf)
...
@@ -2,6 +2,8 @@ include(FindProtobuf)
find_package
(
Protobuf REQUIRED
)
find_package
(
Protobuf REQUIRED
)
include_directories
(
${
PROTOBUF_INCLUDE_DIR
}
)
include_directories
(
${
PROTOBUF_INCLUDE_DIR
}
)
protobuf_generate_cpp
(
PROTO_SRC PROTO_HEADER echo.proto
)
protobuf_generate_cpp
(
PROTO_SRC PROTO_HEADER echo.proto
)
get_filename_component
(
HEADER_DIR
${
PROTO_HEADER
}
DIRECTORY
)
include_directories
(
${
HEADER_DIR
}
)
add_executable
(
backup_request_client client.cpp
${
PROTO_SRC
}
${
PROTO_HEADER
}
)
add_executable
(
backup_request_client client.cpp
${
PROTO_SRC
}
${
PROTO_HEADER
}
)
target_link_libraries
(
backup_request_client brpc
)
target_link_libraries
(
backup_request_client brpc
)
...
...
example/cancel_c++/CMakeLists.txt
View file @
b87dfdbf
...
@@ -2,6 +2,8 @@ include(FindProtobuf)
...
@@ -2,6 +2,8 @@ include(FindProtobuf)
find_package
(
Protobuf REQUIRED
)
find_package
(
Protobuf REQUIRED
)
include_directories
(
${
PROTOBUF_INCLUDE_DIR
}
)
include_directories
(
${
PROTOBUF_INCLUDE_DIR
}
)
protobuf_generate_cpp
(
PROTO_SRC PROTO_HEADER echo.proto
)
protobuf_generate_cpp
(
PROTO_SRC PROTO_HEADER echo.proto
)
get_filename_component
(
HEADER_DIR
${
PROTO_HEADER
}
DIRECTORY
)
include_directories
(
${
HEADER_DIR
}
)
add_executable
(
cancel_client client.cpp
${
PROTO_SRC
}
${
PROTO_HEADER
}
)
add_executable
(
cancel_client client.cpp
${
PROTO_SRC
}
${
PROTO_HEADER
}
)
target_link_libraries
(
cancel_client brpc
)
target_link_libraries
(
cancel_client brpc
)
...
...
example/cascade_echo_c++/CMakeLists.txt
View file @
b87dfdbf
...
@@ -2,6 +2,8 @@ include(FindProtobuf)
...
@@ -2,6 +2,8 @@ include(FindProtobuf)
find_package
(
Protobuf REQUIRED
)
find_package
(
Protobuf REQUIRED
)
include_directories
(
${
PROTOBUF_INCLUDE_DIR
}
)
include_directories
(
${
PROTOBUF_INCLUDE_DIR
}
)
protobuf_generate_cpp
(
PROTO_SRC PROTO_HEADER echo.proto
)
protobuf_generate_cpp
(
PROTO_SRC PROTO_HEADER echo.proto
)
get_filename_component
(
HEADER_DIR
${
PROTO_HEADER
}
DIRECTORY
)
include_directories
(
${
HEADER_DIR
}
)
add_executable
(
cascade_echo_client client.cpp
${
PROTO_SRC
}
${
PROTO_HEADER
}
)
add_executable
(
cascade_echo_client client.cpp
${
PROTO_SRC
}
${
PROTO_HEADER
}
)
target_link_libraries
(
cascade_echo_client brpc
)
target_link_libraries
(
cascade_echo_client brpc
)
...
...
example/dynamic_partition_echo_c++/CMakeLists.txt
View file @
b87dfdbf
...
@@ -2,6 +2,8 @@ include(FindProtobuf)
...
@@ -2,6 +2,8 @@ include(FindProtobuf)
find_package
(
Protobuf REQUIRED
)
find_package
(
Protobuf REQUIRED
)
include_directories
(
${
PROTOBUF_INCLUDE_DIR
}
)
include_directories
(
${
PROTOBUF_INCLUDE_DIR
}
)
protobuf_generate_cpp
(
PROTO_SRC PROTO_HEADER echo.proto
)
protobuf_generate_cpp
(
PROTO_SRC PROTO_HEADER echo.proto
)
get_filename_component
(
HEADER_DIR
${
PROTO_HEADER
}
DIRECTORY
)
include_directories
(
${
HEADER_DIR
}
)
add_executable
(
dynamic_partition_echo_client client.cpp
${
PROTO_SRC
}
${
PROTO_HEADER
}
)
add_executable
(
dynamic_partition_echo_client client.cpp
${
PROTO_SRC
}
${
PROTO_HEADER
}
)
target_link_libraries
(
dynamic_partition_echo_client brpc
)
target_link_libraries
(
dynamic_partition_echo_client brpc
)
...
...
example/echo_c++/CMakeLists.txt
View file @
b87dfdbf
...
@@ -2,6 +2,8 @@ include(FindProtobuf)
...
@@ -2,6 +2,8 @@ include(FindProtobuf)
find_package
(
Protobuf REQUIRED
)
find_package
(
Protobuf REQUIRED
)
include_directories
(
${
PROTOBUF_INCLUDE_DIR
}
)
include_directories
(
${
PROTOBUF_INCLUDE_DIR
}
)
protobuf_generate_cpp
(
PROTO_SRC PROTO_HEADER echo.proto
)
protobuf_generate_cpp
(
PROTO_SRC PROTO_HEADER echo.proto
)
get_filename_component
(
HEADER_DIR
${
PROTO_HEADER
}
DIRECTORY
)
include_directories
(
${
HEADER_DIR
}
)
add_executable
(
echo_client client.cpp
${
PROTO_SRC
}
${
PROTO_HEADER
}
)
add_executable
(
echo_client client.cpp
${
PROTO_SRC
}
${
PROTO_HEADER
}
)
target_link_libraries
(
echo_client brpc
)
target_link_libraries
(
echo_client brpc
)
...
...
example/echo_c++_hulu_pbrpc/CMakeLists.txt
View file @
b87dfdbf
...
@@ -2,6 +2,8 @@ include(FindProtobuf)
...
@@ -2,6 +2,8 @@ include(FindProtobuf)
find_package
(
Protobuf REQUIRED
)
find_package
(
Protobuf REQUIRED
)
include_directories
(
${
PROTOBUF_INCLUDE_DIR
}
)
include_directories
(
${
PROTOBUF_INCLUDE_DIR
}
)
protobuf_generate_cpp
(
PROTO_SRC PROTO_HEADER echo.proto
)
protobuf_generate_cpp
(
PROTO_SRC PROTO_HEADER echo.proto
)
get_filename_component
(
HEADER_DIR
${
PROTO_HEADER
}
DIRECTORY
)
include_directories
(
${
HEADER_DIR
}
)
add_executable
(
echo_hulu_pbrpc_client client.cpp
${
PROTO_SRC
}
${
PROTO_HEADER
}
)
add_executable
(
echo_hulu_pbrpc_client client.cpp
${
PROTO_SRC
}
${
PROTO_HEADER
}
)
target_link_libraries
(
echo_hulu_pbrpc_client brpc
)
target_link_libraries
(
echo_hulu_pbrpc_client brpc
)
...
...
example/echo_c++_sofa_pbrpc/CMakeLists.txt
View file @
b87dfdbf
...
@@ -2,6 +2,8 @@ include(FindProtobuf)
...
@@ -2,6 +2,8 @@ include(FindProtobuf)
find_package
(
Protobuf REQUIRED
)
find_package
(
Protobuf REQUIRED
)
include_directories
(
${
PROTOBUF_INCLUDE_DIR
}
)
include_directories
(
${
PROTOBUF_INCLUDE_DIR
}
)
protobuf_generate_cpp
(
PROTO_SRC PROTO_HEADER echo.proto
)
protobuf_generate_cpp
(
PROTO_SRC PROTO_HEADER echo.proto
)
get_filename_component
(
HEADER_DIR
${
PROTO_HEADER
}
DIRECTORY
)
include_directories
(
${
HEADER_DIR
}
)
add_executable
(
echo_sofa_pbrpc_client client.cpp
${
PROTO_SRC
}
${
PROTO_HEADER
}
)
add_executable
(
echo_sofa_pbrpc_client client.cpp
${
PROTO_SRC
}
${
PROTO_HEADER
}
)
target_link_libraries
(
echo_sofa_pbrpc_client brpc
)
target_link_libraries
(
echo_sofa_pbrpc_client brpc
)
...
...
example/echo_c++_ubrpc_compack/CMakeLists.txt
View file @
b87dfdbf
...
@@ -3,13 +3,13 @@ find_package(Protobuf REQUIRED)
...
@@ -3,13 +3,13 @@ find_package(Protobuf REQUIRED)
include_directories
(
${
PROTOBUF_INCLUDE_DIR
}
)
include_directories
(
${
PROTOBUF_INCLUDE_DIR
}
)
include_directories
(
${
CMAKE_CURRENT_BINARY_DIR
}
)
include_directories
(
${
CMAKE_CURRENT_BINARY_DIR
}
)
execute_process
(
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
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
WORKING_DIRECTORY
${
CMAKE_CURRENT_BINARY_DIR
}
WORKING_DIRECTORY
${
CMAKE_CURRENT_BINARY_DIR
}
)
)
add_executable
(
echo_ubrpc_compack_client client.cpp echo.pb.cc
)
add_executable
(
echo_ubrpc_compack_client client.cpp
${
CMAKE_CURRENT_BINARY_DIR
}
/
echo.pb.cc
)
target_link_libraries
(
echo_ubrpc_compack_client brpc
)
target_link_libraries
(
echo_ubrpc_compack_client brpc
)
add_executable
(
echo_ubrpc_compack_server server.cpp echo.pb.cc
)
add_executable
(
echo_ubrpc_compack_server server.cpp
${
CMAKE_CURRENT_BINARY_DIR
}
/
echo.pb.cc
)
target_link_libraries
(
echo_ubrpc_compack_server brpc
)
target_link_libraries
(
echo_ubrpc_compack_server brpc
)
example/http_c++/CMakeLists.txt
View file @
b87dfdbf
...
@@ -2,6 +2,8 @@ include(FindProtobuf)
...
@@ -2,6 +2,8 @@ include(FindProtobuf)
find_package
(
Protobuf REQUIRED
)
find_package
(
Protobuf REQUIRED
)
include_directories
(
${
PROTOBUF_INCLUDE_DIR
}
)
include_directories
(
${
PROTOBUF_INCLUDE_DIR
}
)
protobuf_generate_cpp
(
PROTO_SRC PROTO_HEADER http.proto
)
protobuf_generate_cpp
(
PROTO_SRC PROTO_HEADER http.proto
)
get_filename_component
(
HEADER_DIR
${
PROTO_HEADER
}
DIRECTORY
)
include_directories
(
${
HEADER_DIR
}
)
add_executable
(
http_client http_client.cpp
)
add_executable
(
http_client http_client.cpp
)
target_link_libraries
(
http_client brpc
)
target_link_libraries
(
http_client brpc
)
...
...
example/multi_threaded_echo_c++/CMakeLists.txt
View file @
b87dfdbf
...
@@ -2,6 +2,8 @@ include(FindProtobuf)
...
@@ -2,6 +2,8 @@ include(FindProtobuf)
find_package
(
Protobuf REQUIRED
)
find_package
(
Protobuf REQUIRED
)
include_directories
(
${
PROTOBUF_INCLUDE_DIR
}
)
include_directories
(
${
PROTOBUF_INCLUDE_DIR
}
)
protobuf_generate_cpp
(
PROTO_SRC PROTO_HEADER echo.proto
)
protobuf_generate_cpp
(
PROTO_SRC PROTO_HEADER echo.proto
)
get_filename_component
(
HEADER_DIR
${
PROTO_HEADER
}
DIRECTORY
)
include_directories
(
${
HEADER_DIR
}
)
add_executable
(
multi_threaded_echo_client client.cpp
${
PROTO_SRC
}
${
PROTO_HEADER
}
)
add_executable
(
multi_threaded_echo_client client.cpp
${
PROTO_SRC
}
${
PROTO_HEADER
}
)
target_link_libraries
(
multi_threaded_echo_client brpc
)
target_link_libraries
(
multi_threaded_echo_client brpc
)
...
...
example/multi_threaded_echo_fns_c++/CMakeLists.txt
View file @
b87dfdbf
...
@@ -2,6 +2,8 @@ include(FindProtobuf)
...
@@ -2,6 +2,8 @@ include(FindProtobuf)
find_package
(
Protobuf REQUIRED
)
find_package
(
Protobuf REQUIRED
)
include_directories
(
${
PROTOBUF_INCLUDE_DIR
}
)
include_directories
(
${
PROTOBUF_INCLUDE_DIR
}
)
protobuf_generate_cpp
(
PROTO_SRC PROTO_HEADER echo.proto
)
protobuf_generate_cpp
(
PROTO_SRC PROTO_HEADER echo.proto
)
get_filename_component
(
HEADER_DIR
${
PROTO_HEADER
}
DIRECTORY
)
include_directories
(
${
HEADER_DIR
}
)
add_executable
(
multi_threaded_echo_fns_client client.cpp
${
PROTO_SRC
}
${
PROTO_HEADER
}
)
add_executable
(
multi_threaded_echo_fns_client client.cpp
${
PROTO_SRC
}
${
PROTO_HEADER
}
)
target_link_libraries
(
multi_threaded_echo_fns_client brpc
)
target_link_libraries
(
multi_threaded_echo_fns_client brpc
)
...
...
example/multi_threaded_mcpack_c++/CMakeLists.txt
View file @
b87dfdbf
...
@@ -3,12 +3,12 @@ find_package(Protobuf REQUIRED)
...
@@ -3,12 +3,12 @@ find_package(Protobuf REQUIRED)
include_directories
(
${
PROTOBUF_INCLUDE_DIR
}
)
include_directories
(
${
PROTOBUF_INCLUDE_DIR
}
)
include_directories
(
${
CMAKE_CURRENT_BINARY_DIR
}
)
include_directories
(
${
CMAKE_CURRENT_BINARY_DIR
}
)
execute_process
(
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
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
WORKING_DIRECTORY
${
CMAKE_CURRENT_BINARY_DIR
}
WORKING_DIRECTORY
${
CMAKE_CURRENT_BINARY_DIR
}
)
)
add_executable
(
multi_threaded_mcpack_client client.cpp echo.pb.cc
)
add_executable
(
multi_threaded_mcpack_client client.cpp
${
CMAKE_CURRENT_BINARY_DIR
}
/
echo.pb.cc
)
target_link_libraries
(
multi_threaded_mcpack_client brpc
)
target_link_libraries
(
multi_threaded_mcpack_client brpc
)
add_executable
(
multi_threaded_mcpack_server server.cpp echo.pb.cc
)
add_executable
(
multi_threaded_mcpack_server server.cpp
${
CMAKE_CURRENT_BINARY_DIR
}
/
echo.pb.cc
)
target_link_libraries
(
multi_threaded_mcpack_server brpc
)
target_link_libraries
(
multi_threaded_mcpack_server brpc
)
example/nshead_pb_extension_c++/CMakeLists.txt
View file @
b87dfdbf
...
@@ -2,6 +2,8 @@ include(FindProtobuf)
...
@@ -2,6 +2,8 @@ include(FindProtobuf)
find_package
(
Protobuf REQUIRED
)
find_package
(
Protobuf REQUIRED
)
include_directories
(
${
PROTOBUF_INCLUDE_DIR
}
)
include_directories
(
${
PROTOBUF_INCLUDE_DIR
}
)
protobuf_generate_cpp
(
PROTO_SRC PROTO_HEADER echo.proto
)
protobuf_generate_cpp
(
PROTO_SRC PROTO_HEADER echo.proto
)
get_filename_component
(
HEADER_DIR
${
PROTO_HEADER
}
DIRECTORY
)
include_directories
(
${
HEADER_DIR
}
)
add_executable
(
nshead_pb_extension_client client.cpp
${
PROTO_SRC
}
${
PROTO_HEADER
}
)
add_executable
(
nshead_pb_extension_client client.cpp
${
PROTO_SRC
}
${
PROTO_HEADER
}
)
target_link_libraries
(
nshead_pb_extension_client brpc
)
target_link_libraries
(
nshead_pb_extension_client brpc
)
...
...
example/parallel_echo_c++/CMakeLists.txt
View file @
b87dfdbf
...
@@ -2,6 +2,8 @@ include(FindProtobuf)
...
@@ -2,6 +2,8 @@ include(FindProtobuf)
find_package
(
Protobuf REQUIRED
)
find_package
(
Protobuf REQUIRED
)
include_directories
(
${
PROTOBUF_INCLUDE_DIR
}
)
include_directories
(
${
PROTOBUF_INCLUDE_DIR
}
)
protobuf_generate_cpp
(
PROTO_SRC PROTO_HEADER echo.proto
)
protobuf_generate_cpp
(
PROTO_SRC PROTO_HEADER echo.proto
)
get_filename_component
(
HEADER_DIR
${
PROTO_HEADER
}
DIRECTORY
)
include_directories
(
${
HEADER_DIR
}
)
add_executable
(
parallel_echo_client client.cpp
${
PROTO_SRC
}
${
PROTO_HEADER
}
)
add_executable
(
parallel_echo_client client.cpp
${
PROTO_SRC
}
${
PROTO_HEADER
}
)
target_link_libraries
(
parallel_echo_client brpc
)
target_link_libraries
(
parallel_echo_client brpc
)
...
...
example/partition_echo_c++/CMakeLists.txt
View file @
b87dfdbf
...
@@ -2,6 +2,8 @@ include(FindProtobuf)
...
@@ -2,6 +2,8 @@ include(FindProtobuf)
find_package
(
Protobuf REQUIRED
)
find_package
(
Protobuf REQUIRED
)
include_directories
(
${
PROTOBUF_INCLUDE_DIR
}
)
include_directories
(
${
PROTOBUF_INCLUDE_DIR
}
)
protobuf_generate_cpp
(
PROTO_SRC PROTO_HEADER echo.proto
)
protobuf_generate_cpp
(
PROTO_SRC PROTO_HEADER echo.proto
)
get_filename_component
(
HEADER_DIR
${
PROTO_HEADER
}
DIRECTORY
)
include_directories
(
${
HEADER_DIR
}
)
add_executable
(
client client.cpp
${
PROTO_SRC
}
${
PROTO_HEADER
}
)
add_executable
(
client client.cpp
${
PROTO_SRC
}
${
PROTO_HEADER
}
)
target_link_libraries
(
client brpc
)
target_link_libraries
(
client brpc
)
...
...
example/selective_echo_c++/CMakeLists.txt
View file @
b87dfdbf
...
@@ -2,6 +2,8 @@ include(FindProtobuf)
...
@@ -2,6 +2,8 @@ include(FindProtobuf)
find_package
(
Protobuf REQUIRED
)
find_package
(
Protobuf REQUIRED
)
include_directories
(
${
PROTOBUF_INCLUDE_DIR
}
)
include_directories
(
${
PROTOBUF_INCLUDE_DIR
}
)
protobuf_generate_cpp
(
PROTO_SRC PROTO_HEADER echo.proto
)
protobuf_generate_cpp
(
PROTO_SRC PROTO_HEADER echo.proto
)
get_filename_component
(
HEADER_DIR
${
PROTO_HEADER
}
DIRECTORY
)
include_directories
(
${
HEADER_DIR
}
)
add_executable
(
selective_echo_client client.cpp
${
PROTO_SRC
}
${
PROTO_HEADER
}
)
add_executable
(
selective_echo_client client.cpp
${
PROTO_SRC
}
${
PROTO_HEADER
}
)
target_link_libraries
(
selective_echo_client brpc
)
target_link_libraries
(
selective_echo_client brpc
)
...
...
example/session_data_and_thread_local/CMakeLists.txt
View file @
b87dfdbf
...
@@ -2,6 +2,8 @@ include(FindProtobuf)
...
@@ -2,6 +2,8 @@ include(FindProtobuf)
find_package
(
Protobuf REQUIRED
)
find_package
(
Protobuf REQUIRED
)
include_directories
(
${
PROTOBUF_INCLUDE_DIR
}
)
include_directories
(
${
PROTOBUF_INCLUDE_DIR
}
)
protobuf_generate_cpp
(
PROTO_SRC PROTO_HEADER echo.proto
)
protobuf_generate_cpp
(
PROTO_SRC PROTO_HEADER echo.proto
)
get_filename_component
(
HEADER_DIR
${
PROTO_HEADER
}
DIRECTORY
)
include_directories
(
${
HEADER_DIR
}
)
add_executable
(
session_data_and_thread_local_client client.cpp
${
PROTO_SRC
}
${
PROTO_HEADER
}
)
add_executable
(
session_data_and_thread_local_client client.cpp
${
PROTO_SRC
}
${
PROTO_HEADER
}
)
target_link_libraries
(
session_data_and_thread_local_client brpc
)
target_link_libraries
(
session_data_and_thread_local_client brpc
)
...
...
example/streaming_echo_c++/CMakeLists.txt
View file @
b87dfdbf
...
@@ -2,6 +2,8 @@ include(FindProtobuf)
...
@@ -2,6 +2,8 @@ include(FindProtobuf)
find_package
(
Protobuf REQUIRED
)
find_package
(
Protobuf REQUIRED
)
include_directories
(
${
PROTOBUF_INCLUDE_DIR
}
)
include_directories
(
${
PROTOBUF_INCLUDE_DIR
}
)
protobuf_generate_cpp
(
PROTO_SRC PROTO_HEADER echo.proto
)
protobuf_generate_cpp
(
PROTO_SRC PROTO_HEADER echo.proto
)
get_filename_component
(
HEADER_DIR
${
PROTO_HEADER
}
DIRECTORY
)
include_directories
(
${
HEADER_DIR
}
)
add_executable
(
streaming_echo_client client.cpp
${
PROTO_SRC
}
${
PROTO_HEADER
}
)
add_executable
(
streaming_echo_client client.cpp
${
PROTO_SRC
}
${
PROTO_HEADER
}
)
target_link_libraries
(
streaming_echo_client brpc
)
target_link_libraries
(
streaming_echo_client brpc
)
...
...
src/CMakeLists.txt
View file @
b87dfdbf
...
@@ -3,23 +3,44 @@ project(lib)
...
@@ -3,23 +3,44 @@ project(lib)
include
(
FindProtobuf
)
include
(
FindProtobuf
)
find_package
(
Protobuf REQUIRED
)
find_package
(
Protobuf REQUIRED
)
include_directories
(
${
PROTOBUF_INCLUDE_DIR
}
)
include_directories
(
${
PROTOBUF_INCLUDE_DIR
}
)
include_directories
(
${
CMAKE_CURRENT_BINARY_DIR
}
)
file
(
GLOB PROTOS
"*.proto"
)
file
(
GLOB PROTOS
"*.proto"
"brpc/*.proto"
"brpc/policy/*.proto"
)
list
(
APPEND PROTO_FLAGS -I
${
CMAKE_CURRENT_BINARY_DIR
}
)
list
(
APPEND PROTO_FLAGS -I
${
CMAKE_CURRENT_BINARY_DIR
}
)
foreach
(
PROTO
${
PROTOS
}
)
foreach
(
PROTO
${
PROTOS
}
)
get_filename_component
(
PROTO_WE
${
PROTO
}
NAME_WE
)
get_filename_component
(
PROTO_WE
${
PROTO
}
NAME_WE
)
#list(APPEND PROTO_SRCS "${CMAKE_CURRENT_BINARY_DIR}/${PROTO_WE}.pb.cc")
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_path=
${
CMAKE_SOURCE_DIR
}
/src
${
PROTO
}
WORKING_DIRECTORY
${
CMAKE_CURRENT_BINARY_DIR
}
)
endforeach
()
file
(
GLOB brpc_PROTOS
"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
(
execute_process
(
COMMAND
${
PROTOBUF_PROTOC_EXECUTABLE
}
${
PROTO_FLAGS
}
--cpp_out=
${
CMAKE_CURRENT_BINARY_DIR
}
--proto_path=
${
PROTOBUF_INCLUDE_DIR
}
${
PROTO
}
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
}
WORKING_DIRECTORY
${
CMAKE_CURRENT_BINARY_DIR
}
)
)
endforeach
()
endforeach
()
#add_library(proto ${PROTO_SRCS} ${PROTO_HDRS})
file
(
GLOB brpc_policy_PROTOS
"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
()
include_directories
(
${
CMAKE_CURRENT_BINARY_DIR
}
)
set
(
BUTIL_SOURCES
set
(
BUTIL_SOURCES
${
CMAKE_SOURCE_DIR
}
/src/butil/third_party/dmg_fp/g_fmt.cc
${
CMAKE_SOURCE_DIR
}
/src/butil/third_party/dmg_fp/g_fmt.cc
...
@@ -155,10 +176,9 @@ set(MCPACK2PB_SOURCES
...
@@ -155,10 +176,9 @@ set(MCPACK2PB_SOURCES
${
CMAKE_SOURCE_DIR
}
/src/mcpack2pb/mcpack2pb.cpp
${
CMAKE_SOURCE_DIR
}
/src/mcpack2pb/mcpack2pb.cpp
${
CMAKE_SOURCE_DIR
}
/src/mcpack2pb/parser.cpp
${
CMAKE_SOURCE_DIR
}
/src/mcpack2pb/parser.cpp
${
CMAKE_SOURCE_DIR
}
/src/mcpack2pb/serializer.cpp
${
CMAKE_SOURCE_DIR
}
/src/mcpack2pb/serializer.cpp
${
CMAKE_SOURCE_DIR
}
/src/idl_options.pb.cc
#
${CMAKE_SOURCE_DIR}/src/idl_options.pb.cc
)
)
set
(
SOURCES
set
(
SOURCES
${
BUTIL_SOURCES
}
${
BUTIL_SOURCES
}
${
BVAR_SOURCES1
}
${
BVAR_SOURCES1
}
...
@@ -170,6 +190,7 @@ set(SOURCES
...
@@ -170,6 +190,7 @@ set(SOURCES
${
BRPC_SOURCES2
}
${
BRPC_SOURCES2
}
${
BRPC_SOURCES3
}
${
BRPC_SOURCES3
}
${
BRPC_SOURCES4
}
${
BRPC_SOURCES4
}
${
PROTO_SRCS
}
)
)
add_library
(
brpc SHARED
${
SOURCES
}
)
add_library
(
brpc SHARED
${
SOURCES
}
)
...
...
Write
Preview
Markdown
is supported
0%
Try again
or
attach a new file
Attach a file
Cancel
You are about to add
0
people
to the discussion. Proceed with caution.
Finish editing this message first!
Cancel
Please
register
or
sign in
to comment