Skip to content
体验新版
项目
组织
正在加载...
登录
切换导航
打开侧边栏
马赛克医院
Paddle
提交
c8e56d31
P
Paddle
项目概览
马赛克医院
/
Paddle
与 Fork 源项目一致
Fork自
PaddlePaddle / Paddle
通知
1
Star
1
Fork
0
代码
文件
提交
分支
Tags
贡献者
分支图
Diff
Issue
0
列表
看板
标记
里程碑
合并请求
0
Wiki
0
Wiki
分析
仓库
DevOps
项目成员
Pages
P
Paddle
项目概览
项目概览
详情
发布
仓库
仓库
文件
提交
分支
标签
贡献者
分支图
比较
Issue
0
Issue
0
列表
看板
标记
里程碑
合并请求
0
合并请求
0
Pages
分析
分析
仓库分析
DevOps
Wiki
0
Wiki
成员
成员
收起侧边栏
关闭侧边栏
动态
分支图
创建新Issue
提交
Issue看板
体验新版 GitCode,发现更多精彩内容 >>
提交
c8e56d31
编写于
6月 29, 2017
作者:
Y
Yu Yang
提交者:
GitHub
6月 29, 2017
浏览文件
操作
浏览文件
下载
差异文件
Merge pull request #2653 from reyoung/feature/protobuf_lib
Add pb_cc_library in generic.cmake
上级
590795d7
a1e7284a
变更
16
隐藏空白更改
内联
并排
Showing
16 changed file
with
53 addition
and
55 deletion
+53
-55
cmake/external/protobuf.cmake
cmake/external/protobuf.cmake
+13
-2
cmake/generic.cmake
cmake/generic.cmake
+13
-0
doc/CMakeLists.txt
doc/CMakeLists.txt
+0
-7
paddle/api/CMakeLists.txt
paddle/api/CMakeLists.txt
+1
-1
paddle/capi/CMakeLists.txt
paddle/capi/CMakeLists.txt
+1
-1
paddle/cuda/CMakeLists.txt
paddle/cuda/CMakeLists.txt
+1
-1
paddle/function/CMakeLists.txt
paddle/function/CMakeLists.txt
+1
-1
paddle/gserver/CMakeLists.txt
paddle/gserver/CMakeLists.txt
+1
-1
paddle/math/CMakeLists.txt
paddle/math/CMakeLists.txt
+1
-1
paddle/optimizer/CMakeLists.txt
paddle/optimizer/CMakeLists.txt
+1
-1
paddle/parameter/CMakeLists.txt
paddle/parameter/CMakeLists.txt
+1
-1
paddle/pserver/CMakeLists.txt
paddle/pserver/CMakeLists.txt
+2
-2
paddle/testing/CMakeLists.txt
paddle/testing/CMakeLists.txt
+2
-2
paddle/trainer/CMakeLists.txt
paddle/trainer/CMakeLists.txt
+2
-1
paddle/utils/CMakeLists.txt
paddle/utils/CMakeLists.txt
+1
-1
proto/CMakeLists.txt
proto/CMakeLists.txt
+12
-32
未找到文件。
cmake/external/protobuf.cmake
浏览文件 @
c8e56d31
...
...
@@ -13,6 +13,10 @@
# limitations under the License.
INCLUDE
(
ExternalProject
)
# Always invoke `FIND_PACKAGE(Protobuf)` for importing function protobuf_generate_cpp
FIND_PACKAGE
(
Protobuf QUIET
)
SET
(
PROTOBUF_FOUND
"OFF"
)
# Print and set the protobuf library information,
# finish this cmake process and exit from this file.
...
...
@@ -39,12 +43,19 @@ macro(PROMPT_PROTOBUF_LIB)
ADD_LIBRARY
(
protobuf_lite
${
protobuf_LIBTYPE
}
IMPORTED GLOBAL
)
SET_PROPERTY
(
TARGET protobuf_lite PROPERTY IMPORTED_LOCATION
${
PROTOBUF_LITE_LIBRARY
}
)
ADD_LIBRARY
(
protoc
${
protobuf_LIBTYPE
}
IMPORTED GLOBAL
)
SET_PROPERTY
(
TARGET protoc PROPERTY IMPORTED_LOCATION
${
PROTOC_LIBRARY
}
)
ADD_LIBRARY
(
libprotoc
${
protobuf_LIBTYPE
}
IMPORTED GLOBAL
)
SET_PROPERTY
(
TARGET libprotoc PROPERTY IMPORTED_LOCATION
${
PROTOC_LIBRARY
}
)
ADD_EXECUTABLE
(
protoc IMPORTED GLOBAL
)
SET_PROPERTY
(
TARGET protoc PROPERTY IMPORTED_LOCATION
${
PROTOBUF_PROTOC_EXECUTABLE
}
)
# FIND_Protobuf.cmake uses `Protobuf_PROTOC_EXECUTABLE`.
# make `protobuf_generate_cpp` happy.
SET
(
Protobuf_PROTOC_EXECUTABLE
${
PROTOBUF_PROTOC_EXECUTABLE
}
)
FOREACH
(
dep
${
protobuf_DEPS
}
)
ADD_DEPENDENCIES
(
protobuf
${
dep
}
)
ADD_DEPENDENCIES
(
protobuf_lite
${
dep
}
)
ADD_DEPENDENCIES
(
libprotoc
${
dep
}
)
ADD_DEPENDENCIES
(
protoc
${
dep
}
)
ENDFOREACH
()
...
...
cmake/generic.cmake
浏览文件 @
c8e56d31
...
...
@@ -87,6 +87,9 @@
# go_library(example SHARED)
#
# including binary directory for generated headers.
include_directories
(
${
CMAKE_BINARY_DIR
}
)
if
(
NOT APPLE
)
find_package
(
Threads REQUIRED
)
link_libraries
(
${
CMAKE_THREAD_LIBS_INIT
}
)
...
...
@@ -331,3 +334,13 @@ function(go_test TARGET_NAME)
add_custom_target
(
${
TARGET_NAME
}
ALL DEPENDS
${
TARGET_NAME
}
_timestamp
${
go_test_DEPS
}
)
add_test
(
${
TARGET_NAME
}
${
CMAKE_CURRENT_BINARY_DIR
}
/
${
TARGET_NAME
}
)
endfunction
(
go_test
)
function
(
proto_library TARGET_NAME
)
set
(
oneValueArgs
""
)
set
(
multiValueArgs SRCS
)
cmake_parse_arguments
(
proto_library
"
${
options
}
"
"
${
oneValueArgs
}
"
"
${
multiValueArgs
}
"
${
ARGN
}
)
set
(
proto_srcs
)
set
(
proto_hdrs
)
protobuf_generate_cpp
(
proto_srcs proto_hdrs
${
proto_library_SRCS
}
)
cc_library
(
${
TARGET_NAME
}
SRCS
${
proto_srcs
}
DEPS protobuf
)
endfunction
()
doc/CMakeLists.txt
浏览文件 @
c8e56d31
...
...
@@ -27,10 +27,6 @@ sphinx_add_target(paddle_docs
${
CMAKE_CURRENT_SOURCE_DIR
}
${
SPHINX_HTML_DIR_EN
}
)
add_dependencies
(
paddle_docs
gen_proto_py
)
# configured documentation tools and intermediate build results
set
(
BINARY_BUILD_DIR_CN
"
${
CMAKE_CURRENT_BINARY_DIR
}
/cn/_build"
)
...
...
@@ -51,6 +47,3 @@ sphinx_add_target(paddle_docs_cn
${
SPHINX_CACHE_DIR_CN
}
${
CMAKE_CURRENT_SOURCE_DIR
}
${
SPHINX_HTML_DIR_CN
}
)
add_dependencies
(
paddle_docs_cn
gen_proto_py
)
paddle/api/CMakeLists.txt
浏览文件 @
c8e56d31
...
...
@@ -16,7 +16,7 @@ set(API_HEADER
Internal.h
)
add_library
(
paddle_api STATIC
${
API_SOURCES
}
)
add_dependencies
(
paddle_api
gen_proto_cpp
paddle_trainer_lib
)
add_dependencies
(
paddle_api
paddle_proto
paddle_trainer_lib
)
INCLUDE
(
${
SWIG_USE_FILE
}
)
INCLUDE_DIRECTORIES
(
${
PROJ_ROOT
}
/paddle
)
...
...
paddle/capi/CMakeLists.txt
浏览文件 @
c8e56d31
...
...
@@ -26,7 +26,7 @@ target_include_directories(paddle_capi PUBLIC ${CMAKE_CURRENT_BINARY_DIR})
add_style_check_target
(
paddle_capi
${
CAPI_SOURCES
}
${
CAPI_HEADER
}
${
CAPI_PRIVATE_HEADER
}
)
add_dependencies
(
paddle_capi
gen_proto_cpp
)
add_dependencies
(
paddle_capi
paddle_proto
)
# combine all paddle static libraries together, into libpaddle_capi_whole.a
...
...
paddle/cuda/CMakeLists.txt
浏览文件 @
c8e56d31
...
...
@@ -83,7 +83,7 @@ else()
${
CUDA_CXX_SOURCES
}
)
endif
()
add_dependencies
(
paddle_cuda
${
external_project_dependencies
}
)
add_dependencies
(
paddle_cuda
paddle_proto
${
external_project_dependencies
}
)
add_style_check_target
(
paddle_cuda
${
CUDA_SOURCES
}
...
...
paddle/function/CMakeLists.txt
浏览文件 @
c8e56d31
...
...
@@ -12,7 +12,7 @@ endif()
add_library
(
paddle_function STATIC
${
cpp_files
}
${
cu_objs
}
)
add_dependencies
(
paddle_function
${
external_project_dependencies
}
)
add_dependencies
(
paddle_function
gen_proto_cpp
)
add_dependencies
(
paddle_function
paddle_proto
)
if
(
WITH_TESTING
)
if
(
WITH_GPU
)
...
...
paddle/gserver/CMakeLists.txt
浏览文件 @
c8e56d31
...
...
@@ -58,7 +58,7 @@ endif()
add_style_check_target
(
paddle_gserver
${
GSERVER_SOURCES
}
)
add_style_check_target
(
paddle_gserver
${
GSERVER_HEADER
}
)
add_dependencies
(
paddle_gserver
gen_proto_cpp
)
add_dependencies
(
paddle_gserver
paddle_proto
${
external_project_dependencies
}
)
if
(
WITH_TESTING
)
add_subdirectory
(
tests
)
endif
()
paddle/math/CMakeLists.txt
浏览文件 @
c8e56d31
...
...
@@ -33,7 +33,7 @@ endif()
add_style_check_target
(
paddle_math
${
MATH_SOURCES
}
)
add_style_check_target
(
paddle_math
${
MATH_HEADERS
}
)
add_dependencies
(
paddle_math
gen_proto_cpp
)
# depends
add_dependencies
(
paddle_math
paddle_proto
${
external_project_dependencies
}
)
# depends
if
(
WITH_TESTING
)
add_subdirectory
(
tests
)
endif
()
paddle/optimizer/CMakeLists.txt
浏览文件 @
c8e56d31
...
...
@@ -10,7 +10,7 @@ set(OPITMIZER_SRCS
)
add_library
(
paddle_optimizer STATIC
${
OPITMIZER_SRCS
}
)
add_dependencies
(
paddle_optimizer
gen_proto_cpp
)
add_dependencies
(
paddle_optimizer
paddle_proto
${
external_project_dependencies
}
)
if
(
WITH_TESTING
)
add_simple_unittest
(
serialization_test
)
...
...
paddle/parameter/CMakeLists.txt
浏览文件 @
c8e56d31
...
...
@@ -7,7 +7,7 @@ add_library(paddle_parameter STATIC
${
PARAMETERS_SOURCES
}
)
add_style_check_target
(
paddle_parameter
${
PARAMETERS_SOURCES
}
)
add_style_check_target
(
paddle_parameter
${
PARAMETERS_HEADERS
}
)
add_dependencies
(
paddle_parameter
gen_proto_cpp
)
add_dependencies
(
paddle_parameter
paddle_proto
${
external_project_dependencies
}
)
if
(
WITH_TESTING
)
add_subdirectory
(
tests
)
endif
()
paddle/pserver/CMakeLists.txt
浏览文件 @
c8e56d31
...
...
@@ -17,7 +17,7 @@ add_library(paddle_network STATIC
add_style_check_target
(
paddle_network
${
NETWORK_SOURCES
}
)
add_style_check_target
(
paddle_network
${
NETWORK_HEADERS
}
)
add_dependencies
(
paddle_network
gen_proto_cpp
)
add_dependencies
(
paddle_network
paddle_proto
${
external_project_dependencies
}
)
################### paddle_pserver ######################
set
(
PSERVER_SOURCES
...
...
@@ -40,7 +40,7 @@ add_library(paddle_pserver STATIC
add_style_check_target
(
paddle_pserver
${
PSERVER_SOURCES
}
)
add_style_check_target
(
paddle_pserver
${
PSERVER_HEADERS
}
)
add_dependencies
(
paddle_pserver
gen_proto_cpp
)
add_dependencies
(
paddle_pserver
paddle_proto
${
external_project_dependencies
}
)
set
(
PSERVER_MAIN_SOURCES
ParameterServer2Main.cpp
)
...
...
paddle/testing/CMakeLists.txt
浏览文件 @
c8e56d31
...
...
@@ -2,7 +2,7 @@
if
(
WITH_TESTING
)
add_library
(
paddle_test_main STATIC TestMain.cpp
)
add_dependencies
(
paddle_test_main
gen_proto_cpp
)
add_dependencies
(
paddle_test_main
paddle_proto
${
external_project_dependencies
}
)
add_library
(
paddle_test_util STATIC TestUtil.cpp
)
add_dependencies
(
paddle_test_util
gen_proto_cpp
)
add_dependencies
(
paddle_test_util
paddle_proto
${
external_project_dependencies
}
)
endif
()
paddle/trainer/CMakeLists.txt
浏览文件 @
c8e56d31
...
...
@@ -41,7 +41,8 @@ add_style_check_target(paddle_trainer_lib
add_style_check_target
(
paddle_trainer_lib
${
TRAINER_HEADERS
}
)
add_dependencies
(
paddle_trainer_lib
gen_proto_cpp
)
paddle_proto
${
external_project_dependencies
}
)
macro
(
add_paddle_exe TARGET_NAME
)
add_executable
(
${
TARGET_NAME
}
${
ARGN
}
)
...
...
paddle/utils/CMakeLists.txt
浏览文件 @
c8e56d31
...
...
@@ -17,7 +17,7 @@ add_library(paddle_utils STATIC
add_style_check_target
(
paddle_utils
${
UTIL_HEADERS
}
)
add_style_check_target
(
paddle_utils
${
UTIL_SOURCES
}
${
UTIL_ARCH_SOURCES
}
)
add_dependencies
(
paddle_utils
gen_proto_cpp
)
add_dependencies
(
paddle_utils
paddle_proto
${
external_project_dependencies
}
)
if
(
WITH_TESTING
)
add_subdirectory
(
tests
)
endif
()
proto/CMakeLists.txt
浏览文件 @
c8e56d31
set
(
proto_filenames
DataConfig.proto
DataFormat.proto
ModelConfig.proto
ParameterConfig.proto
ParameterService.proto
TrainerConfig.proto
OptimizerConfig.proto
ParameterServerConfig.proto
)
file
(
GLOB proto_filenames . *.proto
)
include_directories
(
${
CMAKE_CURRENT_BINARY_DIR
}
)
proto_library
(
paddle_proto SRCS
${
proto_filenames
}
)
set
(
PROTO_GEN
)
set
(
PROTO_GEN_PY
)
foreach
(
filename
${
proto_filenames
}
)
get_filename_component
(
base_filename
${
filename
}
NAME_WE
)
set
(
CUR_PROTO_GEN
${
CMAKE_CURRENT_BINARY_DIR
}
/
${
base_filename
}
.pb.h
${
CMAKE_CURRENT_BINARY_DIR
}
/
${
base_filename
}
.pb.cc
)
set
(
PROTO_GEN
${
PROTO_GEN
}
${
CUR_PROTO_GEN
}
)
add_custom_command
(
OUTPUT
${
CUR_PROTO_GEN
}
COMMAND env
${
py_env
}
${
PROTOBUF_PROTOC_EXECUTABLE
}
--cpp_out
${
CMAKE_CURRENT_BINARY_DIR
}
--proto_path
${
PROJ_ROOT
}
/proto
${
PROJ_ROOT
}
/proto/
${
filename
}
DEPENDS
${
filename
}
${
external_project_dependencies
}
)
get_filename_component
(
ABS_FIL
${
filename
}
ABSOLUTE
)
get_filename_component
(
FIL_WE
${
filename
}
NAME_WE
)
set
(
CUR_PROTO_GEN_PY
${
PROJ_ROOT
}
/paddle/python/paddle/proto/
${
base_filename
}
_pb2.py
)
${
PROJ_ROOT
}
/paddle/python/paddle/proto/
${
FIL_WE
}
_pb2.py
)
set
(
PROTO_GEN_PY
${
CUR_PROTO_GEN_PY
}
${
PROTO_GEN_PY
}
)
${
CUR_PROTO_GEN_PY
}
${
PROTO_GEN_PY
}
)
add_custom_command
(
OUTPUT
${
CUR_PROTO_GEN_PY
}
COMMAND env
${
py_env
}
${
PROTOBUF_PROTOC_EXECUTABLE
}
--python_out
${
PROJ_ROOT
}
/python/paddle/proto
--proto_path
${
PROJ_ROOT
}
/proto
${
PROJ_ROOT
}
/proto/
${
filename
}
DEPENDS
${
filename
}
${
external_project_dependencies
}
)
COMMAND
${
PROTOBUF_PROTOC_EXECUTABLE
}
ARGS
"--python_out=
${
PROJ_ROOT
}
/python/paddle/proto"
"-I"
${
CMAKE_CURRENT_SOURCE_DIR
}
${
ABS_FIL
}
DEPENDS
${
ABS_FIL
}
${
external_project_dependencies
}
)
endforeach
()
add_custom_target
(
gen_proto_cpp ALL DEPENDS
${
PROTO_GEN
}
)
add_custom_target
(
gen_proto_py ALL DEPENDS
${
PROTO_GEN_PY
}
)
add_library
(
paddle_proto STATIC
${
PROTO_GEN
}
)
target_include_directories
(
paddle_proto PUBLIC
${
CMAKE_CURRENT_BINARY_DIR
}
)
编辑
预览
Markdown
is supported
0%
请重试
或
添加新附件
.
添加附件
取消
You are about to add
0
people
to the discussion. Proceed with caution.
先完成此消息的编辑!
取消
想要评论请
注册
或
登录