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
9597389c
Unverified
Commit
9597389c
authored
Jan 06, 2018
by
Ge Jun
Committed by
GitHub
Jan 06, 2018
Browse files
Options
Browse Files
Download
Plain Diff
Merge pull request #183 from brpc/cmake_support
fix compatibility problem in ubuntu16.04&cmake3.5.1
parents
7808b12c
55ca0ff0
Show whitespace changes
Inline
Side-by-side
Showing
2 changed files
with
39 additions
and
34 deletions
+39
-34
CMakeLists.txt
CMakeLists.txt
+37
-31
CMakeLists.txt
test/CMakeLists.txt
+2
-3
No files found.
CMakeLists.txt
View file @
9597389c
...
@@ -113,20 +113,6 @@ set(CMAKE_LIBRARY_OUTPUT_DIRECTORY ${CMAKE_BINARY_DIR}/lib)
...
@@ -113,20 +113,6 @@ 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
"
${
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
)
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
"
${
CMAKE_SOURCE_DIR
}
/src/brpc/*.proto"
)
file
(
GLOB BRPC_POLICY_PROTOS
"
${
CMAKE_SOURCE_DIR
}
/src/brpc/policy/*.proto"
)
# list all source files
# list all source files
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
...
@@ -245,17 +231,10 @@ set(BUTIL_SOURCES
...
@@ -245,17 +231,10 @@ set(BUTIL_SOURCES
${
CMAKE_SOURCE_DIR
}
/src/butil/popen.cpp
${
CMAKE_SOURCE_DIR
}
/src/butil/popen.cpp
)
)
aux_source_directory
(
${
CMAKE_SOURCE_DIR
}
/src/bvar BVAR_SOURCES
)
file
(
GLOB_RECURSE BVAR_SOURCES
"
${
CMAKE_SOURCE_DIR
}
/src/bvar/*.cpp"
)
aux_source_directory
(
${
CMAKE_SOURCE_DIR
}
/src/bvar/detail BVAR_DETAIL_SOURCES
)
file
(
GLOB_RECURSE BTHREAD_SOURCES
"
${
CMAKE_SOURCE_DIR
}
/src/bthread/*.cpp"
)
file
(
GLOB_RECURSE JSON2PB_SOURCES
"
${
CMAKE_SOURCE_DIR
}
/src/json2pb/*.cpp"
)
aux_source_directory
(
${
CMAKE_SOURCE_DIR
}
/src/bthread BTHREAD_SOURCES
)
file
(
GLOB_RECURSE BRPC_SOURCES
"
${
CMAKE_SOURCE_DIR
}
/src/brpc/*.cpp"
)
aux_source_directory
(
${
CMAKE_SOURCE_DIR
}
/src/json2pb JSON2PB_SOURCES
)
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
set
(
MCPACK2PB_SOURCES
${
CMAKE_SOURCE_DIR
}
/src/mcpack2pb/field_type.cpp
${
CMAKE_SOURCE_DIR
}
/src/mcpack2pb/field_type.cpp
...
@@ -264,21 +243,48 @@ set(MCPACK2PB_SOURCES
...
@@ -264,21 +243,48 @@ set(MCPACK2PB_SOURCES
${
CMAKE_SOURCE_DIR
}
/src/mcpack2pb/serializer.cpp
${
CMAKE_SOURCE_DIR
}
/src/mcpack2pb/serializer.cpp
)
)
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
)
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
(
SOURCES
set
(
SOURCES
${
BVAR_SOURCES
}
${
BVAR_SOURCES
}
${
BVAR_DETAIL_SOURCES
}
${
BTHREAD_SOURCES
}
${
BTHREAD_SOURCES
}
${
JSON2PB_SOURCES
}
${
JSON2PB_SOURCES
}
${
MCPACK2PB_SOURCES
}
${
MCPACK2PB_SOURCES
}
${
BRPC_SOURCES
}
${
BRPC_SOURCES
}
${
BRPC_DETAILS_SOURCES
}
${
BRPC_BUILTIN_SOURCES
}
${
BRPC_POLICY_SOURCES
}
${
PROTO_SRCS
}
${
PROTO_SRCS
}
${
BRPC_PROTOS
}
${
BRPC_POLICY_PROTOS
}
)
)
message
(
"SOURCES=
${
SOURCES
}
"
)
add_subdirectory
(
src
)
add_subdirectory
(
src
)
if
(
BUILD_EXAMPLE
)
if
(
BUILD_EXAMPLE
)
add_subdirectory
(
example
)
add_subdirectory
(
example
)
...
...
test/CMakeLists.txt
View file @
9597389c
...
@@ -139,12 +139,11 @@ SET(TEST_BUTIL_SOURCES
...
@@ -139,12 +139,11 @@ 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
# -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_SOURCES
}
${
BVAR_DETAIL_SOURCES
}
)
list
(
REMOVE_ITEM BVAR_SOURCES
${
CMAKE_SOURCE_DIR
}
/src/bvar/default_variables.cpp
)
list
(
REMOVE_ITEM BVAR_SOURCE
${
CMAKE_SOURCE_DIR
}
/src/bvar/default_variables.cpp
)
file
(
GLOB TEST_BVAR_SRCS
"bvar_*_unittest.cpp"
)
file
(
GLOB TEST_BVAR_SRCS
"bvar_*_unittest.cpp"
)
add_executable
(
test_bvar $<TARGET_OBJECTS:BUTIL_LIB>
add_executable
(
test_bvar $<TARGET_OBJECTS:BUTIL_LIB>
${
BVAR_SOURCE
}
${
BVAR_SOURCE
S
}
${
TEST_BVAR_SRCS
}
)
${
TEST_BVAR_SRCS
}
)
target_link_libraries
(
test_bvar
${
GTEST_LIB
}
target_link_libraries
(
test_bvar
${
GTEST_LIB
}
${
GPERFTOOLS_LIBRARIES
}
${
GPERFTOOLS_LIBRARIES
}
...
...
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