Skip to content
体验新版
项目
组织
正在加载...
登录
切换导航
打开侧边栏
BaiXuePrincess
Paddle
提交
2002c78e
P
Paddle
项目概览
BaiXuePrincess
/
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看板
提交
2002c78e
编写于
10月 11, 2017
作者:
X
X.Dragon
提交者:
GitHub
10月 11, 2017
浏览文件
操作
浏览文件
下载
差异文件
Merge pull request #4638 from NHZlX/protobuf_lite
use protobuf_lite druning inference
上级
e9325ea8
4cf8ad52
变更
2
隐藏空白更改
内联
并排
Showing
2 changed file
with
55 addition
and
2 deletion
+55
-2
cmake/generic.cmake
cmake/generic.cmake
+48
-1
proto/CMakeLists.txt
proto/CMakeLists.txt
+7
-1
未找到文件。
cmake/generic.cmake
浏览文件 @
2002c78e
...
...
@@ -389,13 +389,60 @@ function(go_test TARGET_NAME)
WORKING_DIRECTORY
${
CMAKE_CURRENT_SOURCE_DIR
}
)
endfunction
(
go_test
)
# Modification of standard 'protobuf_generate_cpp()' with protobuf-lite support
# Usage:
# paddle_protobuf_generate_cpp(<proto_srcs> <proto_hdrs> <proto_files>)
function
(
paddle_protobuf_generate_cpp SRCS HDRS
)
if
(
NOT ARGN
)
message
(
SEND_ERROR
"Error: paddle_protobuf_generate_cpp() called without any proto files"
)
return
()
endif
()
set
(
${
SRCS
}
)
set
(
${
HDRS
}
)
if
(
MOBILE_INFERENCE
)
set
(
EXTRA_FLAG
"lite:"
)
else
()
set
(
EXTRA_FLAG
""
)
endif
()
foreach
(
FIL
${
ARGN
}
)
get_filename_component
(
ABS_FIL
${
FIL
}
ABSOLUTE
)
get_filename_component
(
FIL_WE
${
FIL
}
NAME_WE
)
set
(
_protobuf_protoc_src
"
${
CMAKE_CURRENT_BINARY_DIR
}
/
${
FIL_WE
}
.pb.cc"
)
set
(
_protobuf_protoc_hdr
"
${
CMAKE_CURRENT_BINARY_DIR
}
/
${
FIL_WE
}
.pb.h"
)
list
(
APPEND
${
SRCS
}
"
${
_protobuf_protoc_src
}
"
)
list
(
APPEND
${
HDRS
}
"
${
_protobuf_protoc_hdr
}
"
)
add_custom_command
(
OUTPUT
"
${
_protobuf_protoc_src
}
"
"
${
_protobuf_protoc_hdr
}
"
COMMAND
${
CMAKE_COMMAND
}
-E make_directory
"
${
CMAKE_CURRENT_BINARY_DIR
}
"
COMMAND
${
PROTOBUF_PROTOC_EXECUTABLE
}
-I
${
CMAKE_CURRENT_SOURCE_DIR
}
--cpp_out
"
${
EXTRA_FLAG
}${
CMAKE_CURRENT_BINARY_DIR
}
"
${
ABS_FIL
}
DEPENDS
${
ABS_FIL
}
protoc
COMMENT
"Running C++ protocol buffer compiler on
${
FIL
}
"
VERBATIM
)
endforeach
()
set_source_files_properties
(
${${
SRCS
}}
${${
HDRS
}}
PROPERTIES GENERATED TRUE
)
set
(
${
SRCS
}
${${
SRCS
}}
PARENT_SCOPE
)
set
(
${
HDRS
}
${${
HDRS
}}
PARENT_SCOPE
)
endfunction
()
function
(
proto_library TARGET_NAME
)
set
(
oneValueArgs
""
)
set
(
multiValueArgs SRCS DEPS
)
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
}
)
p
addle_p
rotobuf_generate_cpp
(
proto_srcs proto_hdrs
${
proto_library_SRCS
}
)
cc_library
(
${
TARGET_NAME
}
SRCS
${
proto_srcs
}
DEPS
${
proto_library_DEPS
}
protobuf
)
endfunction
()
...
...
proto/CMakeLists.txt
浏览文件 @
2002c78e
file
(
GLOB proto_filenames . *.proto
)
if
(
MOBILE_INFERENCE
)
file
(
GLOB proto_filenames . ModelConfig.proto ParameterConfig.proto
TrainerConfig.proto DataConfig.proto
)
else
()
file
(
GLOB proto_filenames . *.proto
)
endif
()
include_directories
(
${
CMAKE_CURRENT_BINARY_DIR
}
)
proto_library
(
paddle_proto SRCS
${
proto_filenames
}
)
...
...
编辑
预览
Markdown
is supported
0%
请重试
或
添加新附件
.
添加附件
取消
You are about to add
0
people
to the discussion. Proceed with caution.
先完成此消息的编辑!
取消
想要评论请
注册
或
登录