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
Expand all
Hide whitespace changes
Inline
Side-by-side
Showing
6 changed files
with
42 additions
and
31 deletions
+42
-31
CMakeLists.txt
CMakeLists.txt
+0
-0
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
+0
-0
CMakeLists.txt
test/CMakeLists.txt
+37
-29
No files found.
CMakeLists.txt
View file @
1ac67120
This diff is collapsed.
Click to expand it.
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
This diff is collapsed.
Click to expand it.
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