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
9ede407b
Commit
9ede407b
authored
Jan 05, 2018
by
zhujiashun
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
add generating proto code to compatible with different version of cmake
parent
452c3c3b
Hide whitespace changes
Inline
Side-by-side
Showing
2 changed files
with
38 additions
and
3 deletions
+38
-3
CMakeLists.txt
CMakeLists.txt
+31
-3
CMakeLists.txt
src/CMakeLists.txt
+7
-0
No files found.
CMakeLists.txt
View file @
9ede407b
...
...
@@ -124,6 +124,27 @@ 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
()
# list all source files
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
...
...
@@ -273,12 +294,12 @@ set(SOURCES
${
PROTO_SRCS
}
)
ADD_SUBDIRECTORY
(
src
)
add_subdirectory
(
src
)
if
(
BUILD_EXAMPLE
)
ADD_SUBDIRECTORY
(
example
)
add_subdirectory
(
example
)
endif
()
if
(
BUILD_UNIT_TESTS
)
ADD_SUBDIRECTORY
(
test
)
add_subdirectory
(
test
)
endif
()
install
(
DIRECTORY
${
CMAKE_SOURCE_DIR
}
/src/
...
...
@@ -287,3 +308,10 @@ install(DIRECTORY ${CMAKE_SOURCE_DIR}/src/
PATTERN
"*.h"
PATTERN
"*.hpp"
)
install
(
DIRECTORY
${
CMAKE_CURRENT_BINARY_DIR
}
/
DESTINATION include
FILES_MATCHING
PATTERN
"*.h"
PATTERN
"*.hpp"
)
src/CMakeLists.txt
View file @
9ede407b
...
...
@@ -12,6 +12,7 @@ include_directories(${CMAKE_SOURCE_DIR}/src)
add_library
(
BUTIL_LIB OBJECT
${
BUTIL_SOURCES
}
)
add_library
(
OBJ_LIB OBJECT
${
SOURCES
}
)
# shared library needs POSITION_INDEPENDENT_CODE
set_property
(
TARGET
${
OBJ_LIB
}
PROPERTY POSITION_INDEPENDENT_CODE 1
)
set_property
(
TARGET
${
BUTIL_LIB
}
PROPERTY POSITION_INDEPENDENT_CODE 1
)
...
...
@@ -44,3 +45,9 @@ install(TARGETS brpc
LIBRARY DESTINATION lib
${
LIBSUFFIX
}
ARCHIVE DESTINATION lib
${
LIBSUFFIX
}
)
install
(
TARGETS brpc_static
RUNTIME DESTINATION bin
LIBRARY DESTINATION lib
${
LIBSUFFIX
}
ARCHIVE DESTINATION lib
${
LIBSUFFIX
}
)
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