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
1ac67120
Commit
1ac67120
authored
Jan 03, 2018
by
zhujiashun
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
make test be compiled alone
parent
5a170fe5
Hide whitespace changes
Inline
Side-by-side
Showing
6 changed files
with
250 additions
and
235 deletions
+250
-235
CMakeLists.txt
CMakeLists.txt
+202
-5
build_in_travis_ci.sh
build_in_travis_ci.sh
+1
-1
CMakeLists.txt
example/CMakeLists.txt
+4
-0
CMakeLists.txt
example/echo_c++/CMakeLists.txt
+0
-1
CMakeLists.txt
src/CMakeLists.txt
+6
-199
CMakeLists.txt
test/CMakeLists.txt
+37
-29
No files found.
CMakeLists.txt
View file @
1ac67120
...
@@ -17,7 +17,7 @@ endif()
...
@@ -17,7 +17,7 @@ endif()
option
(
WITH_GLOG
"With glog"
OFF
)
option
(
WITH_GLOG
"With glog"
OFF
)
option
(
BRPC_DEBUG
"With debug symbol"
ON
)
option
(
BRPC_DEBUG
"With debug symbol"
ON
)
option
(
BUILD_EXAMPLE
"Whether building examples"
O
N
)
option
(
BUILD_EXAMPLE
"Whether building examples"
O
FF
)
option
(
BUILD_UNIT_TESTS
"Whether building unit tests"
OFF
)
option
(
BUILD_UNIT_TESTS
"Whether building unit tests"
OFF
)
option
(
EXAMPLE_LINK_SO
"Whether examples are linked dynamically"
OFF
)
option
(
EXAMPLE_LINK_SO
"Whether examples are linked dynamically"
OFF
)
...
@@ -51,17 +51,18 @@ endif()
...
@@ -51,17 +51,18 @@ 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
${
CMAKE_CURRENT_BINARY_DIR
}
)
)
set
(
CMAKE_CXX_STANDARD 11
)
set
(
CMAKE_CXX_STANDARD 11
)
set
(
CMAKE_CXX_STANDARD_REQUIRED ON
)
set
(
CMAKE_CXX_STANDARD_REQUIRED ON
)
set
(
CMAKE_CPP_FLAGS
"-DBRPC_WITH_GLOG=
${
WITH_GLOG_VAL
}
-DGFLAGS_NS=
${
GFLAGS_NS
}
"
)
set
(
CMAKE_CPP_FLAGS
"-DBRPC_WITH_GLOG=
${
WITH_GLOG_VAL
}
-DGFLAGS_NS=
${
GFLAGS_NS
}
"
)
# TODO: add BRPC_REVISION
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 -D__STRICT_ANSI__"
)
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 -D__STRICT_ANSI__"
)
set
(
CMAKE_CPP_FLAGS
"
${
CMAKE_CPP_FLAGS
}
${
DEBUG_SYMBOL
}
"
)
set
(
CMAKE_CPP_FLAGS
"
${
CMAKE_CPP_FLAGS
}
${
DEBUG_SYMBOL
}
"
)
set
(
CMAKE_CXX_FLAGS
"
${
CMAKE_CPP_FLAGS
}
-O2 -pipe -Wall -W -fPIC -fstrict-aliasing -Wno-invalid-offsetof -Wno-unused-parameter -fno-omit-frame-pointer"
)
set
(
CMAKE_CXX_FLAGS
"
${
CMAKE_CPP_FLAGS
}
-O2 -pipe -Wall -W -fPIC -fstrict-aliasing -Wno-invalid-offsetof -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"
)
set
(
CMAKE_C_FLAGS
"
${
CMAKE_CPP_FLAGS
}
-O2 -pipe -Wall -W -fPIC -fstrict-aliasing -Wno-unused-parameter -fno-omit-frame-pointer"
)
SET
(
CMAKE_EXE_LINKER_FLAGS
"-pthread"
)
if
(
CMAKE_CXX_COMPILER_ID STREQUAL
"GNU"
)
if
(
CMAKE_CXX_COMPILER_ID STREQUAL
"GNU"
)
#required by butil/crc32.cc to boost performance for 10x
#required by butil/crc32.cc to boost performance for 10x
...
@@ -109,12 +110,208 @@ set(CMAKE_LIBRARY_OUTPUT_DIRECTORY ${CMAKE_BINARY_DIR}/lib)
...
@@ -109,12 +110,208 @@ set(CMAKE_LIBRARY_OUTPUT_DIRECTORY ${CMAKE_BINARY_DIR}/lib)
# for *.a
# for *.a
set
(
CMAKE_ARCHIVE_OUTPUT_DIRECTORY
${
CMAKE_BINARY_DIR
}
/lib
)
set
(
CMAKE_ARCHIVE_OUTPUT_DIRECTORY
${
CMAKE_BINARY_DIR
}
/lib
)
file
(
GLOB PROTOS
"src/*.proto"
)
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"
)
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
"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
()
set
(
BUTIL_SOURCES
${
CMAKE_SOURCE_DIR
}
/src/butil/third_party/dmg_fp/g_fmt.cc
${
CMAKE_SOURCE_DIR
}
/src/butil/third_party/dmg_fp/dtoa_wrapper.cc
${
CMAKE_SOURCE_DIR
}
/src/butil/third_party/dynamic_annotations/dynamic_annotations.c
${
CMAKE_SOURCE_DIR
}
/src/butil/third_party/icu/icu_utf.cc
${
CMAKE_SOURCE_DIR
}
/src/butil/third_party/superfasthash/superfasthash.c
${
CMAKE_SOURCE_DIR
}
/src/butil/third_party/modp_b64/modp_b64.cc
${
CMAKE_SOURCE_DIR
}
/src/butil/third_party/nspr/prtime.cc
${
CMAKE_SOURCE_DIR
}
/src/butil/third_party/symbolize/demangle.cc
${
CMAKE_SOURCE_DIR
}
/src/butil/third_party/symbolize/symbolize.cc
${
CMAKE_SOURCE_DIR
}
/src/butil/third_party/snappy/snappy-sinksource.cc
${
CMAKE_SOURCE_DIR
}
/src/butil/third_party/snappy/snappy-stubs-internal.cc
${
CMAKE_SOURCE_DIR
}
/src/butil/third_party/snappy/snappy.cc
${
CMAKE_SOURCE_DIR
}
/src/butil/third_party/murmurhash3/murmurhash3.cpp
${
CMAKE_SOURCE_DIR
}
/src/butil/arena.cpp
${
CMAKE_SOURCE_DIR
}
/src/butil/at_exit.cc
${
CMAKE_SOURCE_DIR
}
/src/butil/atomicops_internals_x86_gcc.cc
${
CMAKE_SOURCE_DIR
}
/src/butil/base64.cc
${
CMAKE_SOURCE_DIR
}
/src/butil/big_endian.cc
${
CMAKE_SOURCE_DIR
}
/src/butil/cpu.cc
${
CMAKE_SOURCE_DIR
}
/src/butil/debug/alias.cc
${
CMAKE_SOURCE_DIR
}
/src/butil/debug/asan_invalid_access.cc
${
CMAKE_SOURCE_DIR
}
/src/butil/debug/crash_logging.cc
${
CMAKE_SOURCE_DIR
}
/src/butil/debug/debugger.cc
${
CMAKE_SOURCE_DIR
}
/src/butil/debug/debugger_posix.cc
${
CMAKE_SOURCE_DIR
}
/src/butil/debug/dump_without_crashing.cc
${
CMAKE_SOURCE_DIR
}
/src/butil/debug/proc_maps_linux.cc
${
CMAKE_SOURCE_DIR
}
/src/butil/debug/stack_trace.cc
${
CMAKE_SOURCE_DIR
}
/src/butil/debug/stack_trace_posix.cc
${
CMAKE_SOURCE_DIR
}
/src/butil/environment.cc
${
CMAKE_SOURCE_DIR
}
/src/butil/files/file.cc
${
CMAKE_SOURCE_DIR
}
/src/butil/files/file_posix.cc
${
CMAKE_SOURCE_DIR
}
/src/butil/files/file_enumerator.cc
${
CMAKE_SOURCE_DIR
}
/src/butil/files/file_enumerator_posix.cc
${
CMAKE_SOURCE_DIR
}
/src/butil/files/file_path.cc
${
CMAKE_SOURCE_DIR
}
/src/butil/files/file_path_constants.cc
${
CMAKE_SOURCE_DIR
}
/src/butil/files/memory_mapped_file.cc
${
CMAKE_SOURCE_DIR
}
/src/butil/files/memory_mapped_file_posix.cc
${
CMAKE_SOURCE_DIR
}
/src/butil/files/scoped_file.cc
${
CMAKE_SOURCE_DIR
}
/src/butil/files/scoped_temp_dir.cc
${
CMAKE_SOURCE_DIR
}
/src/butil/file_util.cc
${
CMAKE_SOURCE_DIR
}
/src/butil/file_util_linux.cc
${
CMAKE_SOURCE_DIR
}
/src/butil/file_util_posix.cc
${
CMAKE_SOURCE_DIR
}
/src/butil/guid.cc
${
CMAKE_SOURCE_DIR
}
/src/butil/guid_posix.cc
${
CMAKE_SOURCE_DIR
}
/src/butil/hash.cc
${
CMAKE_SOURCE_DIR
}
/src/butil/lazy_instance.cc
${
CMAKE_SOURCE_DIR
}
/src/butil/location.cc
${
CMAKE_SOURCE_DIR
}
/src/butil/md5.cc
${
CMAKE_SOURCE_DIR
}
/src/butil/memory/aligned_memory.cc
${
CMAKE_SOURCE_DIR
}
/src/butil/memory/ref_counted.cc
${
CMAKE_SOURCE_DIR
}
/src/butil/memory/ref_counted_memory.cc
${
CMAKE_SOURCE_DIR
}
/src/butil/memory/singleton.cc
${
CMAKE_SOURCE_DIR
}
/src/butil/memory/weak_ptr.cc
${
CMAKE_SOURCE_DIR
}
/src/butil/posix/file_descriptor_shuffle.cc
${
CMAKE_SOURCE_DIR
}
/src/butil/posix/global_descriptors.cc
${
CMAKE_SOURCE_DIR
}
/src/butil/rand_util.cc
${
CMAKE_SOURCE_DIR
}
/src/butil/rand_util_posix.cc
${
CMAKE_SOURCE_DIR
}
/src/butil/fast_rand.cpp
${
CMAKE_SOURCE_DIR
}
/src/butil/safe_strerror_posix.cc
${
CMAKE_SOURCE_DIR
}
/src/butil/sha1_portable.cc
${
CMAKE_SOURCE_DIR
}
/src/butil/strings/latin1_string_conversions.cc
${
CMAKE_SOURCE_DIR
}
/src/butil/strings/nullable_string16.cc
${
CMAKE_SOURCE_DIR
}
/src/butil/strings/safe_sprintf.cc
${
CMAKE_SOURCE_DIR
}
/src/butil/strings/string16.cc
${
CMAKE_SOURCE_DIR
}
/src/butil/strings/string_number_conversions.cc
${
CMAKE_SOURCE_DIR
}
/src/butil/strings/string_split.cc
${
CMAKE_SOURCE_DIR
}
/src/butil/strings/string_piece.cc
${
CMAKE_SOURCE_DIR
}
/src/butil/strings/string_util.cc
${
CMAKE_SOURCE_DIR
}
/src/butil/strings/string_util_constants.cc
${
CMAKE_SOURCE_DIR
}
/src/butil/strings/stringprintf.cc
${
CMAKE_SOURCE_DIR
}
/src/butil/strings/sys_string_conversions_posix.cc
${
CMAKE_SOURCE_DIR
}
/src/butil/strings/utf_offset_string_conversions.cc
${
CMAKE_SOURCE_DIR
}
/src/butil/strings/utf_string_conversion_utils.cc
${
CMAKE_SOURCE_DIR
}
/src/butil/strings/utf_string_conversions.cc
${
CMAKE_SOURCE_DIR
}
/src/butil/synchronization/cancellation_flag.cc
${
CMAKE_SOURCE_DIR
}
/src/butil/synchronization/condition_variable_posix.cc
${
CMAKE_SOURCE_DIR
}
/src/butil/synchronization/waitable_event_posix.cc
${
CMAKE_SOURCE_DIR
}
/src/butil/threading/non_thread_safe_impl.cc
${
CMAKE_SOURCE_DIR
}
/src/butil/threading/platform_thread_linux.cc
${
CMAKE_SOURCE_DIR
}
/src/butil/threading/platform_thread_posix.cc
${
CMAKE_SOURCE_DIR
}
/src/butil/threading/simple_thread.cc
${
CMAKE_SOURCE_DIR
}
/src/butil/threading/thread_checker_impl.cc
${
CMAKE_SOURCE_DIR
}
/src/butil/threading/thread_collision_warner.cc
${
CMAKE_SOURCE_DIR
}
/src/butil/threading/thread_id_name_manager.cc
${
CMAKE_SOURCE_DIR
}
/src/butil/threading/thread_local_posix.cc
${
CMAKE_SOURCE_DIR
}
/src/butil/threading/thread_local_storage.cc
${
CMAKE_SOURCE_DIR
}
/src/butil/threading/thread_local_storage_posix.cc
${
CMAKE_SOURCE_DIR
}
/src/butil/threading/thread_restrictions.cc
${
CMAKE_SOURCE_DIR
}
/src/butil/threading/watchdog.cc
${
CMAKE_SOURCE_DIR
}
/src/butil/time/clock.cc
${
CMAKE_SOURCE_DIR
}
/src/butil/time/default_clock.cc
${
CMAKE_SOURCE_DIR
}
/src/butil/time/default_tick_clock.cc
${
CMAKE_SOURCE_DIR
}
/src/butil/time/tick_clock.cc
${
CMAKE_SOURCE_DIR
}
/src/butil/time/time.cc
${
CMAKE_SOURCE_DIR
}
/src/butil/time/time_posix.cc
${
CMAKE_SOURCE_DIR
}
/src/butil/version.cc
${
CMAKE_SOURCE_DIR
}
/src/butil/logging.cc
${
CMAKE_SOURCE_DIR
}
/src/butil/class_name.cpp
${
CMAKE_SOURCE_DIR
}
/src/butil/errno.cpp
${
CMAKE_SOURCE_DIR
}
/src/butil/find_cstr.cpp
${
CMAKE_SOURCE_DIR
}
/src/butil/status.cpp
${
CMAKE_SOURCE_DIR
}
/src/butil/string_printf.cpp
${
CMAKE_SOURCE_DIR
}
/src/butil/thread_local.cpp
${
CMAKE_SOURCE_DIR
}
/src/butil/unix_socket.cpp
${
CMAKE_SOURCE_DIR
}
/src/butil/endpoint.cpp
${
CMAKE_SOURCE_DIR
}
/src/butil/fd_utility.cpp
${
CMAKE_SOURCE_DIR
}
/src/butil/files/temp_file.cpp
${
CMAKE_SOURCE_DIR
}
/src/butil/files/file_watcher.cpp
${
CMAKE_SOURCE_DIR
}
/src/butil/time.cpp
${
CMAKE_SOURCE_DIR
}
/src/butil/zero_copy_stream_as_streambuf.cpp
${
CMAKE_SOURCE_DIR
}
/src/butil/crc32c.cc
${
CMAKE_SOURCE_DIR
}
/src/butil/containers/case_ignored_flat_map.cpp
${
CMAKE_SOURCE_DIR
}
/src/butil/iobuf.cpp
${
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/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
)
set
(
MCPACK2PB_SOURCES
${
CMAKE_SOURCE_DIR
}
/src/mcpack2pb/field_type.cpp
${
CMAKE_SOURCE_DIR
}
/src/mcpack2pb/mcpack2pb.cpp
${
CMAKE_SOURCE_DIR
}
/src/mcpack2pb/parser.cpp
${
CMAKE_SOURCE_DIR
}
/src/mcpack2pb/serializer.cpp
)
set
(
SOURCES
${
BVAR_SOURCES1
}
${
BVAR_SOURCES2
}
${
BTHREAD_SOURCES
}
${
JSON2PB_SOURCES
}
${
MCPACK2PB_SOURCES
}
${
BRPC_SOURCES1
}
${
BRPC_SOURCES2
}
${
BRPC_SOURCES3
}
${
BRPC_SOURCES4
}
${
PROTO_SRCS
}
)
ADD_SUBDIRECTORY
(
src
)
ADD_SUBDIRECTORY
(
src
)
if
(
BUILD_EXAMPLE
)
if
(
BUILD_EXAMPLE
)
ADD_SUBDIRECTORY
(
example
)
ADD_SUBDIRECTORY
(
example
)
endif
()
endif
()
if
(
BUILD_UNIT_TESTS
)
if
(
BUILD_UNIT_TESTS
)
ADD_SUBDIRECTORY
(
test
)
ADD_SUBDIRECTORY
(
test
)
enable_testing
()
#enable_testing
()
add_test
(
NAME test_butil COMMAND test_butil
)
#add_test
(NAME test_butil COMMAND test_butil)
endif
()
endif
()
#install directory
# cmake -DCMAKE_INSTALL_PREFIX=/usr
install
(
DIRECTORY
${
CMAKE_SOURCE_DIR
}
/src/
DESTINATION include
FILES_MATCHING
PATTERN
"*.h"
PATTERN
"*.hpp"
)
install
(
DIRECTORY
${
CMAKE_CURRENT_BINARY_DIR
}
DESTINATION include
FILES_MATCHING
PATTERN
"*.h"
PATTERN
"*.hpp"
)
build_in_travis_ci.sh
View file @
1ac67120
...
@@ -27,7 +27,7 @@ fi
...
@@ -27,7 +27,7 @@ fi
echo
"start building by cmake"
echo
"start building by cmake"
rm
-rf
build
&&
mkdir
build
&&
cd
build
rm
-rf
build
&&
mkdir
build
&&
cd
build
if
[
"
$PURPOSE
"
=
"compile"
]
;
then
if
[
"
$PURPOSE
"
=
"compile"
]
;
then
if
!
cmake
-DBRPC_DEBUG
=
OFF
-DBUILD_EXAMPLE
=
O
N
-DBUILD_UNIT_TESTS
=
OFF ..
;
then
if
!
cmake
-DBRPC_DEBUG
=
OFF
-DBUILD_EXAMPLE
=
O
FF
-DBUILD_UNIT_TESTS
=
OFF ..
;
then
echo
"Fail to generate Makefile by cmake"
echo
"Fail to generate Makefile by cmake"
exit
1
exit
1
fi
fi
...
...
example/CMakeLists.txt
View file @
1ac67120
if
(
BUILD_UNIT_TESTS
)
return
()
endif
()
add_subdirectory
(
http_c++
)
add_subdirectory
(
http_c++
)
add_subdirectory
(
asynchronous_echo_c++
)
add_subdirectory
(
asynchronous_echo_c++
)
add_subdirectory
(
backup_request_c++
)
add_subdirectory
(
backup_request_c++
)
...
...
example/echo_c++/CMakeLists.txt
View file @
1ac67120
...
@@ -10,7 +10,6 @@ if(EXAMPLE_LINK_SO)
...
@@ -10,7 +10,6 @@ if(EXAMPLE_LINK_SO)
target_link_libraries
(
echo_client brpc
)
target_link_libraries
(
echo_client brpc
)
target_link_libraries
(
echo_server brpc
)
target_link_libraries
(
echo_server brpc
)
else
()
else
()
message
(
"not EXAMPLE_LINK_SO"
)
target_link_libraries
(
echo_client brpc_static
${
DYNAMIC_LIB
}
)
target_link_libraries
(
echo_client brpc_static
${
DYNAMIC_LIB
}
)
target_link_libraries
(
echo_server brpc_static
${
DYNAMIC_LIB
}
)
target_link_libraries
(
echo_server brpc_static
${
DYNAMIC_LIB
}
)
endif
()
endif
()
src/CMakeLists.txt
View file @
1ac67120
file
(
GLOB PROTOS
"*.proto"
)
if
(
BUILD_UNIT_TESTS
)
list
(
APPEND PROTO_FLAGS -I
${
CMAKE_CURRENT_BINARY_DIR
}
)
return
()
foreach
(
PROTO
${
PROTOS
}
)
endif
()
get_filename_component
(
PROTO_WE
${
PROTO
}
NAME_WE
)
list
(
APPEND PROTO_SRCS
"
${
CMAKE_CURRENT_BINARY_DIR
}
/
${
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
}
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
(
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
"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
}
)
include_directories
(
${
CMAKE_CURRENT_BINARY_DIR
}
)
include_directories
(
${
CMAKE_SOURCE_DIR
}
/src
)
include_directories
(
${
CMAKE_SOURCE_DIR
}
/src
)
set
(
BUTIL_SOURCES
add_library
(
OBJ_LIB OBJECT
${
BUTIL_SOURCES
}
${
SOURCES
}
)
${
CMAKE_SOURCE_DIR
}
/src/butil/third_party/dmg_fp/g_fmt.cc
${
CMAKE_SOURCE_DIR
}
/src/butil/third_party/dmg_fp/dtoa_wrapper.cc
${
CMAKE_SOURCE_DIR
}
/src/butil/third_party/dynamic_annotations/dynamic_annotations.c
${
CMAKE_SOURCE_DIR
}
/src/butil/third_party/icu/icu_utf.cc
${
CMAKE_SOURCE_DIR
}
/src/butil/third_party/superfasthash/superfasthash.c
${
CMAKE_SOURCE_DIR
}
/src/butil/third_party/modp_b64/modp_b64.cc
${
CMAKE_SOURCE_DIR
}
/src/butil/third_party/nspr/prtime.cc
${
CMAKE_SOURCE_DIR
}
/src/butil/third_party/symbolize/demangle.cc
${
CMAKE_SOURCE_DIR
}
/src/butil/third_party/symbolize/symbolize.cc
${
CMAKE_SOURCE_DIR
}
/src/butil/third_party/snappy/snappy-sinksource.cc
${
CMAKE_SOURCE_DIR
}
/src/butil/third_party/snappy/snappy-stubs-internal.cc
${
CMAKE_SOURCE_DIR
}
/src/butil/third_party/snappy/snappy.cc
${
CMAKE_SOURCE_DIR
}
/src/butil/third_party/murmurhash3/murmurhash3.cpp
${
CMAKE_SOURCE_DIR
}
/src/butil/arena.cpp
${
CMAKE_SOURCE_DIR
}
/src/butil/at_exit.cc
${
CMAKE_SOURCE_DIR
}
/src/butil/atomicops_internals_x86_gcc.cc
${
CMAKE_SOURCE_DIR
}
/src/butil/base64.cc
${
CMAKE_SOURCE_DIR
}
/src/butil/big_endian.cc
${
CMAKE_SOURCE_DIR
}
/src/butil/cpu.cc
${
CMAKE_SOURCE_DIR
}
/src/butil/debug/alias.cc
${
CMAKE_SOURCE_DIR
}
/src/butil/debug/asan_invalid_access.cc
${
CMAKE_SOURCE_DIR
}
/src/butil/debug/crash_logging.cc
${
CMAKE_SOURCE_DIR
}
/src/butil/debug/debugger.cc
${
CMAKE_SOURCE_DIR
}
/src/butil/debug/debugger_posix.cc
${
CMAKE_SOURCE_DIR
}
/src/butil/debug/dump_without_crashing.cc
${
CMAKE_SOURCE_DIR
}
/src/butil/debug/proc_maps_linux.cc
${
CMAKE_SOURCE_DIR
}
/src/butil/debug/stack_trace.cc
${
CMAKE_SOURCE_DIR
}
/src/butil/debug/stack_trace_posix.cc
${
CMAKE_SOURCE_DIR
}
/src/butil/environment.cc
${
CMAKE_SOURCE_DIR
}
/src/butil/files/file.cc
${
CMAKE_SOURCE_DIR
}
/src/butil/files/file_posix.cc
${
CMAKE_SOURCE_DIR
}
/src/butil/files/file_enumerator.cc
${
CMAKE_SOURCE_DIR
}
/src/butil/files/file_enumerator_posix.cc
${
CMAKE_SOURCE_DIR
}
/src/butil/files/file_path.cc
${
CMAKE_SOURCE_DIR
}
/src/butil/files/file_path_constants.cc
${
CMAKE_SOURCE_DIR
}
/src/butil/files/memory_mapped_file.cc
${
CMAKE_SOURCE_DIR
}
/src/butil/files/memory_mapped_file_posix.cc
${
CMAKE_SOURCE_DIR
}
/src/butil/files/scoped_file.cc
${
CMAKE_SOURCE_DIR
}
/src/butil/files/scoped_temp_dir.cc
${
CMAKE_SOURCE_DIR
}
/src/butil/file_util.cc
${
CMAKE_SOURCE_DIR
}
/src/butil/file_util_linux.cc
${
CMAKE_SOURCE_DIR
}
/src/butil/file_util_posix.cc
${
CMAKE_SOURCE_DIR
}
/src/butil/guid.cc
${
CMAKE_SOURCE_DIR
}
/src/butil/guid_posix.cc
${
CMAKE_SOURCE_DIR
}
/src/butil/hash.cc
${
CMAKE_SOURCE_DIR
}
/src/butil/lazy_instance.cc
${
CMAKE_SOURCE_DIR
}
/src/butil/location.cc
${
CMAKE_SOURCE_DIR
}
/src/butil/md5.cc
${
CMAKE_SOURCE_DIR
}
/src/butil/memory/aligned_memory.cc
${
CMAKE_SOURCE_DIR
}
/src/butil/memory/ref_counted.cc
${
CMAKE_SOURCE_DIR
}
/src/butil/memory/ref_counted_memory.cc
${
CMAKE_SOURCE_DIR
}
/src/butil/memory/singleton.cc
${
CMAKE_SOURCE_DIR
}
/src/butil/memory/weak_ptr.cc
${
CMAKE_SOURCE_DIR
}
/src/butil/posix/file_descriptor_shuffle.cc
${
CMAKE_SOURCE_DIR
}
/src/butil/posix/global_descriptors.cc
${
CMAKE_SOURCE_DIR
}
/src/butil/rand_util.cc
${
CMAKE_SOURCE_DIR
}
/src/butil/rand_util_posix.cc
${
CMAKE_SOURCE_DIR
}
/src/butil/fast_rand.cpp
${
CMAKE_SOURCE_DIR
}
/src/butil/safe_strerror_posix.cc
${
CMAKE_SOURCE_DIR
}
/src/butil/sha1_portable.cc
${
CMAKE_SOURCE_DIR
}
/src/butil/strings/latin1_string_conversions.cc
${
CMAKE_SOURCE_DIR
}
/src/butil/strings/nullable_string16.cc
${
CMAKE_SOURCE_DIR
}
/src/butil/strings/safe_sprintf.cc
${
CMAKE_SOURCE_DIR
}
/src/butil/strings/string16.cc
${
CMAKE_SOURCE_DIR
}
/src/butil/strings/string_number_conversions.cc
${
CMAKE_SOURCE_DIR
}
/src/butil/strings/string_split.cc
${
CMAKE_SOURCE_DIR
}
/src/butil/strings/string_piece.cc
${
CMAKE_SOURCE_DIR
}
/src/butil/strings/string_util.cc
${
CMAKE_SOURCE_DIR
}
/src/butil/strings/string_util_constants.cc
${
CMAKE_SOURCE_DIR
}
/src/butil/strings/stringprintf.cc
${
CMAKE_SOURCE_DIR
}
/src/butil/strings/sys_string_conversions_posix.cc
${
CMAKE_SOURCE_DIR
}
/src/butil/strings/utf_offset_string_conversions.cc
${
CMAKE_SOURCE_DIR
}
/src/butil/strings/utf_string_conversion_utils.cc
${
CMAKE_SOURCE_DIR
}
/src/butil/strings/utf_string_conversions.cc
${
CMAKE_SOURCE_DIR
}
/src/butil/synchronization/cancellation_flag.cc
${
CMAKE_SOURCE_DIR
}
/src/butil/synchronization/condition_variable_posix.cc
${
CMAKE_SOURCE_DIR
}
/src/butil/synchronization/waitable_event_posix.cc
${
CMAKE_SOURCE_DIR
}
/src/butil/threading/non_thread_safe_impl.cc
${
CMAKE_SOURCE_DIR
}
/src/butil/threading/platform_thread_linux.cc
${
CMAKE_SOURCE_DIR
}
/src/butil/threading/platform_thread_posix.cc
${
CMAKE_SOURCE_DIR
}
/src/butil/threading/simple_thread.cc
${
CMAKE_SOURCE_DIR
}
/src/butil/threading/thread_checker_impl.cc
${
CMAKE_SOURCE_DIR
}
/src/butil/threading/thread_collision_warner.cc
${
CMAKE_SOURCE_DIR
}
/src/butil/threading/thread_id_name_manager.cc
${
CMAKE_SOURCE_DIR
}
/src/butil/threading/thread_local_posix.cc
${
CMAKE_SOURCE_DIR
}
/src/butil/threading/thread_local_storage.cc
${
CMAKE_SOURCE_DIR
}
/src/butil/threading/thread_local_storage_posix.cc
${
CMAKE_SOURCE_DIR
}
/src/butil/threading/thread_restrictions.cc
${
CMAKE_SOURCE_DIR
}
/src/butil/threading/watchdog.cc
${
CMAKE_SOURCE_DIR
}
/src/butil/time/clock.cc
${
CMAKE_SOURCE_DIR
}
/src/butil/time/default_clock.cc
${
CMAKE_SOURCE_DIR
}
/src/butil/time/default_tick_clock.cc
${
CMAKE_SOURCE_DIR
}
/src/butil/time/tick_clock.cc
${
CMAKE_SOURCE_DIR
}
/src/butil/time/time.cc
${
CMAKE_SOURCE_DIR
}
/src/butil/time/time_posix.cc
${
CMAKE_SOURCE_DIR
}
/src/butil/version.cc
${
CMAKE_SOURCE_DIR
}
/src/butil/logging.cc
${
CMAKE_SOURCE_DIR
}
/src/butil/class_name.cpp
${
CMAKE_SOURCE_DIR
}
/src/butil/errno.cpp
${
CMAKE_SOURCE_DIR
}
/src/butil/find_cstr.cpp
${
CMAKE_SOURCE_DIR
}
/src/butil/status.cpp
${
CMAKE_SOURCE_DIR
}
/src/butil/string_printf.cpp
${
CMAKE_SOURCE_DIR
}
/src/butil/thread_local.cpp
${
CMAKE_SOURCE_DIR
}
/src/butil/unix_socket.cpp
${
CMAKE_SOURCE_DIR
}
/src/butil/endpoint.cpp
${
CMAKE_SOURCE_DIR
}
/src/butil/fd_utility.cpp
${
CMAKE_SOURCE_DIR
}
/src/butil/files/temp_file.cpp
${
CMAKE_SOURCE_DIR
}
/src/butil/files/file_watcher.cpp
${
CMAKE_SOURCE_DIR
}
/src/butil/time.cpp
${
CMAKE_SOURCE_DIR
}
/src/butil/zero_copy_stream_as_streambuf.cpp
${
CMAKE_SOURCE_DIR
}
/src/butil/crc32c.cc
${
CMAKE_SOURCE_DIR
}
/src/butil/containers/case_ignored_flat_map.cpp
${
CMAKE_SOURCE_DIR
}
/src/butil/iobuf.cpp
${
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/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
)
set
(
MCPACK2PB_SOURCES
${
CMAKE_SOURCE_DIR
}
/src/mcpack2pb/field_type.cpp
${
CMAKE_SOURCE_DIR
}
/src/mcpack2pb/mcpack2pb.cpp
${
CMAKE_SOURCE_DIR
}
/src/mcpack2pb/parser.cpp
${
CMAKE_SOURCE_DIR
}
/src/mcpack2pb/serializer.cpp
)
set
(
SOURCES
${
BVAR_SOURCES1
}
${
BVAR_SOURCES2
}
${
BTHREAD_SOURCES
}
${
JSON2PB_SOURCES
}
${
MCPACK2PB_SOURCES
}
${
BRPC_SOURCES1
}
${
BRPC_SOURCES2
}
${
BRPC_SOURCES3
}
${
BRPC_SOURCES4
}
${
PROTO_SRCS
}
)
add_library
(
OBJ_LIB OBJECT
${
SOURCES
}
)
add_library
(
BUTIL_LIB OBJECT
${
BUTIL_SOURCES
}
)
# shared libraries need PIC
# shared libraries need PIC
set_property
(
TARGET
${
OBJ_LIB
}
PROPERTY POSITION_INDEPENDENT_CODE 1
)
set_property
(
TARGET
${
OBJ_LIB
}
PROPERTY POSITION_INDEPENDENT_CODE 1
)
set_property
(
TARGET
${
BUTIL_LIB
}
PROPERTY POSITION_INDEPENDENT_CODE 1
)
add_library
(
brpc SHARED $<TARGET_OBJECTS:OBJ_LIB>
$<TARGET_OBJECTS:BUTIL_LIB>
)
add_library
(
brpc SHARED $<TARGET_OBJECTS:OBJ_LIB>
)
add_library
(
brpc_static STATIC $<TARGET_OBJECTS:OBJ_LIB>
$<TARGET_OBJECTS:BUTIL_LIB>
)
add_library
(
brpc_static STATIC $<TARGET_OBJECTS:OBJ_LIB>
)
target_link_libraries
(
brpc
${
DYNAMIC_LIB
}
)
target_link_libraries
(
brpc
${
DYNAMIC_LIB
}
)
...
@@ -220,16 +40,3 @@ install(TARGETS brpc
...
@@ -220,16 +40,3 @@ install(TARGETS brpc
ARCHIVE DESTINATION lib
${
LIBSUFFIX
}
ARCHIVE DESTINATION lib
${
LIBSUFFIX
}
)
)
install
(
DIRECTORY
${
CMAKE_SOURCE_DIR
}
/src/
DESTINATION include
FILES_MATCHING
PATTERN
"*.h"
PATTERN
"*.hpp"
)
install
(
DIRECTORY
${
CMAKE_CURRENT_BINARY_DIR
}
/
DESTINATION include
FILES_MATCHING
PATTERN
"*.h"
PATTERN
"*.hpp"
)
test/CMakeLists.txt
View file @
1ac67120
...
@@ -5,7 +5,7 @@ file(GLOB PROTOS "*.proto")
...
@@ -5,7 +5,7 @@ file(GLOB PROTOS "*.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
TEST_
PROTO_SRCS
"
${
CMAKE_CURRENT_BINARY_DIR
}
/
${
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_path=
${
CMAKE_SOURCE_DIR
}
/src --proto_path=
${
CMAKE_SOURCE_DIR
}
/test
${
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
}
/test
${
PROTO
}
WORKING_DIRECTORY
${
CMAKE_CURRENT_BINARY_DIR
}
WORKING_DIRECTORY
${
CMAKE_CURRENT_BINARY_DIR
}
...
@@ -27,7 +27,7 @@ file(COPY ${CMAKE_SOURCE_DIR}/test/jsonout DESTINATION ${CMAKE_CURRENT_BINARY_DI
...
@@ -27,7 +27,7 @@ file(COPY ${CMAKE_SOURCE_DIR}/test/jsonout DESTINATION ${CMAKE_CURRENT_BINARY_DI
file
(
COPY
${
CMAKE_SOURCE_DIR
}
/test/run_tests.sh DESTINATION
${
CMAKE_CURRENT_BINARY_DIR
}
)
file
(
COPY
${
CMAKE_SOURCE_DIR
}
/test/run_tests.sh DESTINATION
${
CMAKE_CURRENT_BINARY_DIR
}
)
SET
(
TEST_BUTIL_SOURCES
SET
(
TEST_BUTIL_SOURCES
${
CMAKE_SOURCE_DIR
}
/test/popen_unittest.cpp
#
${CMAKE_SOURCE_DIR}/test/popen_unittest.cpp
${
CMAKE_SOURCE_DIR
}
/test/at_exit_unittest.cc
${
CMAKE_SOURCE_DIR
}
/test/at_exit_unittest.cc
${
CMAKE_SOURCE_DIR
}
/test/atomicops_unittest.cc
${
CMAKE_SOURCE_DIR
}
/test/atomicops_unittest.cc
${
CMAKE_SOURCE_DIR
}
/test/base64_unittest.cc
${
CMAKE_SOURCE_DIR
}
/test/base64_unittest.cc
...
@@ -127,43 +127,51 @@ SET(TEST_BUTIL_SOURCES
...
@@ -127,43 +127,51 @@ SET(TEST_BUTIL_SOURCES
${
CMAKE_SOURCE_DIR
}
/test/butil_unittest_main.cpp
${
CMAKE_SOURCE_DIR
}
/test/butil_unittest_main.cpp
)
)
set
(
BVAR_SOURCES1
# -DBVAR_NOT_LINK_DEFAULT_VARIABLES not work for gcc >= 5.0, just remove the file to prevent linking into unit tests
${
CMAKE_SOURCE_DIR
}
/src/bvar/collector.cpp
set
(
BVAR_SOURCE
${
BVAR_SOURCES1
}
${
BVAR_SOURCES2
}
)
${
CMAKE_SOURCE_DIR
}
/src/bvar/gflag.cpp
list
(
REMOVE_ITEM BVAR_SOURCE
${
CMAKE_SOURCE_DIR
}
/src/bvar/default_variables.cpp
)
${
CMAKE_SOURCE_DIR
}
/src/bvar/latency_recorder.cpp
add_library
(
BUTIL_DEBUG_LIB OBJECT
${
BUTIL_SOURCES
}
)
${
CMAKE_SOURCE_DIR
}
/src/bvar/variable.cpp
add_library
(
OBJ_DEBUG_LIB OBJECT
${
SOURCES
}
)
)
aux_source_directory
(
${
CMAKE_SOURCE_DIR
}
/src/bvar/detail BVAR_SOURCES2
)
file
(
GLOB TEST_BVAR_SRCS
"bvar_*_unittest.cpp"
)
file
(
GLOB TEST_BVAR_SRCS
"bvar_*_unittest.cpp"
)
add_executable
(
test_bvar $<TARGET_OBJECTS:BUTIL_LIB>
${
BVAR_SOURCES1
}
${
BVAR_SOURCES2
}
${
TEST_BVAR_SRCS
}
)
add_executable
(
test_bvar $<TARGET_OBJECTS:BUTIL_DEBUG_LIB>
target_link_libraries
(
test_bvar
${
BVAR_SOURCE
}
${
PROTOBUF_LIBRARIES
}
${
TEST_BVAR_SRCS
}
)
${
GTEST_LIB
}
target_link_libraries
(
test_bvar
${
GTEST_LIB
}
${
GPERFTOOLS_LIBRARIES
}
${
GPERFTOOLS_LIBRARIES
}
${
GFLAGS_LIBRARY
}
${
DYNAMIC_LIB
}
)
${
PROTOC_LIB
}
rt
ssl
crypto
dl
z
)
add_library
(
PROTO_OBJ OBJECT
${
PROTO_SRCS
}
)
add_library
(
PROTO_OBJ OBJECT
${
TEST_PROTO_SRCS
}
)
add_executable
(
test_butil
${
TEST_BUTIL_SOURCES
}
$<TARGET_OBJECTS:PROTO_OBJ>
)
add_executable
(
test_butil
${
TEST_BUTIL_SOURCES
}
target_link_libraries
(
test_butil brpc
${
GTEST_LIB
}
)
$<TARGET_OBJECTS:PROTO_OBJ>
$<TARGET_OBJECTS:BUTIL_DEBUG_LIB>
$<TARGET_OBJECTS:OBJ_DEBUG_LIB>
)
target_link_libraries
(
test_butil
${
GTEST_LIB
}
${
GPERFTOOLS_LIBRARIES
}
${
DYNAMIC_LIB
}
)
file
(
GLOB BTHREAD_UNITTESTS
"bthread*unittest.cpp"
)
file
(
GLOB BTHREAD_UNITTESTS
"bthread*unittest.cpp"
)
foreach
(
BTHREAD_UT
${
BTHREAD_UNITTESTS
}
)
foreach
(
BTHREAD_UT
${
BTHREAD_UNITTESTS
}
)
get_filename_component
(
BTHREAD_UT_WE
${
BTHREAD_UT
}
NAME_WE
)
get_filename_component
(
BTHREAD_UT_WE
${
BTHREAD_UT
}
NAME_WE
)
add_executable
(
${
BTHREAD_UT_WE
}
${
BTHREAD_UT
}
$<TARGET_OBJECTS:PROTO_OBJ>
)
add_executable
(
${
BTHREAD_UT_WE
}
${
BTHREAD_UT
}
target_link_libraries
(
${
BTHREAD_UT_WE
}
brpc
${
GTEST_MAIN_LIB
}
${
GPERFTOOLS_LIBRARIES
}
${
GTEST_LIB
}
)
$<TARGET_OBJECTS:PROTO_OBJ>
$<TARGET_OBJECTS:BUTIL_DEBUG_LIB>
$<TARGET_OBJECTS:OBJ_DEBUG_LIB>
)
target_link_libraries
(
${
BTHREAD_UT_WE
}
${
GTEST_MAIN_LIB
}
${
GTEST_LIB
}
${
GPERFTOOLS_LIBRARIES
}
${
DYNAMIC_LIB
}
)
endforeach
()
endforeach
()
file
(
GLOB BRPC_UNITTESTS
"brpc_*_unittest.cpp"
)
file
(
GLOB BRPC_UNITTESTS
"brpc_*_unittest.cpp"
)
foreach
(
BRPC_UT
${
BRPC_UNITTESTS
}
)
foreach
(
BRPC_UT
${
BRPC_UNITTESTS
}
)
get_filename_component
(
BRPC_UT_WE
${
BRPC_UT
}
NAME_WE
)
get_filename_component
(
BRPC_UT_WE
${
BRPC_UT
}
NAME_WE
)
add_executable
(
${
BRPC_UT_WE
}
${
BRPC_UT
}
$<TARGET_OBJECTS:PROTO_OBJ>
)
add_executable
(
${
BRPC_UT_WE
}
${
BRPC_UT
}
target_link_libraries
(
${
BRPC_UT_WE
}
brpc
${
GTEST_MAIN_LIB
}
${
GPERFTOOLS_LIBRARIES
}
${
GTEST_LIB
}
)
$<TARGET_OBJECTS:PROTO_OBJ>
$<TARGET_OBJECTS:BUTIL_DEBUG_LIB>
$<TARGET_OBJECTS:OBJ_DEBUG_LIB>
)
target_link_libraries
(
${
BRPC_UT_WE
}
${
GTEST_MAIN_LIB
}
${
GPERFTOOLS_LIBRARIES
}
${
GTEST_LIB
}
${
DYNAMIC_LIB
}
)
endforeach
()
endforeach
()
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