Skip to content
体验新版
项目
组织
正在加载...
登录
切换导航
打开侧边栏
PaddlePaddle
Paddle
提交
669304f4
P
Paddle
项目概览
PaddlePaddle
/
Paddle
大约 1 年 前同步成功
通知
2298
Star
20931
Fork
5422
代码
文件
提交
分支
Tags
贡献者
分支图
Diff
Issue
1423
列表
看板
标记
里程碑
合并请求
543
Wiki
0
Wiki
分析
仓库
DevOps
项目成员
Pages
P
Paddle
项目概览
项目概览
详情
发布
仓库
仓库
文件
提交
分支
标签
贡献者
分支图
比较
Issue
1,423
Issue
1,423
列表
看板
标记
里程碑
合并请求
543
合并请求
543
Pages
分析
分析
仓库分析
DevOps
Wiki
0
Wiki
成员
成员
收起侧边栏
关闭侧边栏
动态
分支图
创建新Issue
提交
Issue看板
体验新版 GitCode,发现更多精彩内容 >>
未验证
提交
669304f4
编写于
8月 25, 2018
作者:
D
dzhwinter
提交者:
GitHub
8月 25, 2018
浏览文件
操作
浏览文件
下载
电子邮件补丁
差异文件
protobuf (#12935)
上级
5df65811
变更
1
隐藏空白更改
内联
并排
Showing
1 changed file
with
18 addition
and
5 deletion
+18
-5
cmake/external/protobuf.cmake
cmake/external/protobuf.cmake
+18
-5
未找到文件。
cmake/external/protobuf.cmake
浏览文件 @
669304f4
...
...
@@ -14,11 +14,14 @@
INCLUDE
(
ExternalProject
)
# Always invoke `FIND_PACKAGE(Protobuf)` for importing function protobuf_generate_cpp
IF
(
NOT WIN32
)
FIND_PACKAGE
(
Protobuf QUIET
)
ENDIF
(
NOT WIN32
)
macro
(
UNSET_VAR VAR_NAME
)
UNSET
(
${
VAR_NAME
}
CACHE
)
UNSET
(
${
VAR_NAME
}
)
endmacro
()
UNSET_VAR
(
PROTOBUF_INCLUDE_DIR
)
UNSET_VAR
(
PROTOBUF_FOUND
)
UNSET_VAR
(
PROTOBUF_PROTOC_EXECUTABLE
)
...
...
@@ -94,12 +97,14 @@ macro(PROMPT_PROTOBUF_LIB)
SET
(
protobuf_DEPS
${
ARGN
}
)
MESSAGE
(
STATUS
"Protobuf protoc executable:
${
PROTOBUF_PROTOC_EXECUTABLE
}
"
)
MESSAGE
(
STATUS
"Protobuf-lite library:
${
PROTOBUF_LITE_LIBRARY
}
"
)
MESSAGE
(
STATUS
"Protobuf library:
${
PROTOBUF_LIBRARY
}
"
)
MESSAGE
(
STATUS
"Protoc library:
${
PROTOBUF_PROTOC_LIBRARY
}
"
)
MESSAGE
(
STATUS
"Protobuf version:
${
PROTOBUF_VERSION
}
"
)
INCLUDE_DIRECTORIES
(
${
PROTOBUF_INCLUDE_DIR
}
)
# Assuming that all the protobuf libraries are of the same type.
IF
(
${
PROTOBUF_LIBRARY
}
MATCHES
"
${
CMAKE_STATIC_LIBRARY_SUFFIX
}
$"
)
IF
(
${
PROTOBUF_LIBRARY
}
MATCHES
${
CMAKE_STATIC_LIBRARY_SUFFIX
}
)
SET
(
protobuf_LIBTYPE STATIC
)
ELSEIF
(
${
PROTOBUF_LIBRARY
}
MATCHES
"
${
CMAKE_SHARED_LIBRARY_SUFFIX
}
$"
)
SET
(
protobuf_LIBTYPE SHARED
)
...
...
@@ -137,18 +142,25 @@ macro(SET_PROTOBUF_VERSION)
endmacro
()
set
(
PROTOBUF_ROOT
""
CACHE PATH
"Folder contains protobuf"
)
IF
(
WIN32
)
SET
(
PROTOBUF_ROOT
${
THIRD_PARTY_PATH
}
/install/protobuf
)
MESSAGE
(
WARNING,
"In windows, protobuf only support msvc build, please build it manually and put it at "
${
PROTOBUF_ROOT
}
)
ENDIF
(
WIN32
)
if
(
NOT
"
${
PROTOBUF_ROOT
}
"
STREQUAL
""
)
find_path
(
PROTOBUF_INCLUDE_DIR google/protobuf/message.h PATHS
${
PROTOBUF_ROOT
}
/include NO_DEFAULT_PATH
)
find_library
(
PROTOBUF_LIBRARY protobuf PATHS
${
PROTOBUF_ROOT
}
/lib NO_DEFAULT_PATH
)
find_library
(
PROTOBUF_LITE_LIBRARY protobuf-lite PATHS
${
PROTOBUF_ROOT
}
/lib NO_DEFAULT_PATH
)
find_library
(
PROTOBUF_PROTOC_LIBRARY protoc PATHS
${
PROTOBUF_ROOT
}
/lib NO_DEFAULT_PATH
)
find_library
(
PROTOBUF_LIBRARY protobuf
libprotobuf.lib
PATHS
${
PROTOBUF_ROOT
}
/lib NO_DEFAULT_PATH
)
find_library
(
PROTOBUF_LITE_LIBRARY protobuf-lite
libprotobuf-lite.lib
PATHS
${
PROTOBUF_ROOT
}
/lib NO_DEFAULT_PATH
)
find_library
(
PROTOBUF_PROTOC_LIBRARY protoc
libprotoc.lib
PATHS
${
PROTOBUF_ROOT
}
/lib NO_DEFAULT_PATH
)
find_program
(
PROTOBUF_PROTOC_EXECUTABLE protoc PATHS
${
PROTOBUF_ROOT
}
/bin NO_DEFAULT_PATH
)
if
(
PROTOBUF_INCLUDE_DIR AND PROTOBUF_LIBRARY AND PROTOBUF_LITE_LIBRARY AND PROTOBUF_PROTOC_LIBRARY AND PROTOBUF_PROTOC_EXECUTABLE
)
message
(
STATUS
"Using custom protobuf library in
${
PROTOBUF_ROOT
}
."
)
SET
(
PROTOBUF_FOUND true
)
SET_PROTOBUF_VERSION
()
PROMPT_PROTOBUF_LIB
()
else
()
message
(
WARNING
"Cannot find protobuf library in
${
PROTOBUF_ROOT
}
.
"
)
message
(
WARNING
"Cannot find protobuf library in
${
PROTOBUF_ROOT
}
"
)
endif
()
endif
()
...
...
@@ -239,6 +251,7 @@ IF(CMAKE_CROSSCOMPILING)
CACHE FILEPATH
"protobuf executable."
FORCE
)
ENDIF
()
IF
(
NOT PROTOBUF_FOUND
)
build_protobuf
(
extern_protobuf FALSE
)
...
...
编辑
预览
Markdown
is supported
0%
请重试
或
添加新附件
.
添加附件
取消
You are about to add
0
people
to the discussion. Proceed with caution.
先完成此消息的编辑!
取消
想要评论请
注册
或
登录