Skip to content
体验新版
项目
组织
正在加载...
登录
切换导航
打开侧边栏
BaiXuePrincess
Paddle
提交
7e07f0c4
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看板
提交
7e07f0c4
编写于
6月 27, 2019
作者:
S
superjomn
浏览文件
操作
浏览文件
下载
电子邮件补丁
差异文件
add inference publish
上级
b184667e
变更
3
显示空白变更内容
内联
并排
Showing
3 changed file
with
110 addition
and
8 deletion
+110
-8
cmake/lite.cmake
cmake/lite.cmake
+79
-0
paddle/fluid/lite/CMakeLists.txt
paddle/fluid/lite/CMakeLists.txt
+19
-7
paddle/fluid/lite/api/CMakeLists.txt
paddle/fluid/lite/api/CMakeLists.txt
+12
-1
未找到文件。
cmake/lite.cmake
0 → 100644
浏览文件 @
7e07f0c4
# Bundle several static libraries into one.
function
(
bundle_static_library tgt_name bundled_tgt_name fake_target
)
list
(
APPEND static_libs
${
tgt_name
}
)
function
(
_recursively_collect_dependencies input_target
)
set
(
_input_link_libraries LINK_LIBRARIES
)
get_target_property
(
_input_type
${
input_target
}
TYPE
)
if
(
${
_input_type
}
STREQUAL
"INTERFACE_LIBRARY"
)
set
(
_input_link_libraries INTERFACE_LINK_LIBRARIES
)
endif
()
get_target_property
(
public_dependencies
${
input_target
}
${
_input_link_libraries
}
)
foreach
(
dependency IN LISTS public_dependencies
)
if
(
TARGET
${
dependency
}
)
get_target_property
(
alias
${
dependency
}
ALIASED_TARGET
)
if
(
TARGET
${
alias
}
)
set
(
dependency
${
alias
}
)
endif
()
get_target_property
(
_type
${
dependency
}
TYPE
)
if
(
${
_type
}
STREQUAL
"STATIC_LIBRARY"
)
list
(
APPEND static_libs
${
dependency
}
)
endif
()
get_property
(
library_already_added
GLOBAL PROPERTY _
${
tgt_name
}
_static_bundle_
${
dependency
}
)
if
(
NOT library_already_added
)
set_property
(
GLOBAL PROPERTY _
${
tgt_name
}
_static_bundle_
${
dependency
}
ON
)
_recursively_collect_dependencies
(
${
dependency
}
)
endif
()
endif
()
endforeach
()
set
(
static_libs
${
static_libs
}
PARENT_SCOPE
)
endfunction
()
_recursively_collect_dependencies
(
${
tgt_name
}
)
list
(
REMOVE_DUPLICATES static_libs
)
set
(
bundled_tgt_full_name
${
CMAKE_BINARY_DIR
}
/
${
CMAKE_STATIC_LIBRARY_PREFIX
}${
bundled_tgt_name
}${
CMAKE_STATIC_LIBRARY_SUFFIX
}
)
message
(
STATUS
"+++++ bundled_tgt_full_name:
${
bundled_tgt_full_name
}
"
)
file
(
WRITE
${
CMAKE_BINARY_DIR
}
/
${
bundled_tgt_name
}
.ar.in
"CREATE
${
bundled_tgt_full_name
}
\n
"
)
foreach
(
tgt IN LISTS static_libs
)
file
(
APPEND
${
CMAKE_BINARY_DIR
}
/
${
bundled_tgt_name
}
.ar.in
"ADDLIB $<TARGET_FILE:
${
tgt
}
>
\n
"
)
endforeach
()
file
(
APPEND
${
CMAKE_BINARY_DIR
}
/
${
bundled_tgt_name
}
.ar.in
"SAVE
\n
"
)
file
(
APPEND
${
CMAKE_BINARY_DIR
}
/
${
bundled_tgt_name
}
.ar.in
"END
\n
"
)
file
(
GENERATE
OUTPUT
${
CMAKE_BINARY_DIR
}
/
${
bundled_tgt_name
}
.ar
INPUT
${
CMAKE_BINARY_DIR
}
/
${
bundled_tgt_name
}
.ar.in
)
set
(
ar_tool
${
CMAKE_AR
}
)
if
(
CMAKE_INTERPROCEDURAL_OPTIMIZATION
)
set
(
ar_tool
${
CMAKE_CXX_COMPILER_AR
}
)
endif
()
add_custom_command
(
COMMAND
${
ar_tool
}
-M <
${
CMAKE_BINARY_DIR
}
/
${
bundled_tgt_name
}
.ar
OUTPUT
${
bundled_tgt_full_name
}
COMMENT
"Bundling
${
bundled_tgt_name
}
"
VERBATIM
)
add_custom_target
(
${
fake_target
}
ALL DEPENDS
${
bundled_tgt_full_name
}
)
add_dependencies
(
${
fake_target
}
${
tgt_name
}
)
add_library
(
${
bundled_tgt_name
}
STATIC IMPORTED
)
set_target_properties
(
${
bundled_tgt_name
}
PROPERTIES
IMPORTED_LOCATION
${
bundled_tgt_full_name
}
INTERFACE_INCLUDE_DIRECTORIES $<TARGET_PROPERTY:
${
tgt_name
}
,INTERFACE_INCLUDE_DIRECTORIES>
)
add_dependencies
(
${
bundled_tgt_name
}
${
fake_target
}
)
endfunction
()
paddle/fluid/lite/CMakeLists.txt
浏览文件 @
7e07f0c4
...
...
@@ -2,6 +2,8 @@ if (NOT WITH_LITE)
return
()
endif
()
include
(
lite
)
message
(
WARNING
"Lite enabled!"
)
message
(
STATUS
"LIGHT_FRAMEWORK:
\t
${
LITE_WITH_LIGHT_WEIGHT_FRAMEWORK
}
"
)
message
(
STATUS
"LITE_WITH_CUDA:
\t
${
LITE_WITH_CUDA
}
"
)
...
...
@@ -85,9 +87,9 @@ function (lite_deps TARGET)
endif
()
set
(
${
TARGET
}
${
deps
}
PARENT_SCOPE
)
endfunction
()
# A fake target to include all the libraries and tests the lite module depends.
add_custom_target
(
lite_compile_deps COMMAND echo 1
)
...
...
@@ -95,6 +97,10 @@ add_custom_target(lite_compile_deps COMMAND echo 1)
# the whole fluid project to accelerate the compile speed.
set
(
offline_lib_registry_file
"
${
CMAKE_BINARY_DIR
}
/lite_libs.txt"
)
file
(
WRITE
${
offline_lib_registry_file
}
""
)
# clean
set
(
__lite_cc_files
""
;
""
)
set
(
__lite_cc_files
"
${
CMAKE_BINARY_DIR
}
/lite_cc_files.txt"
)
file
(
WRITE
${
__lite_cc_files
}
""
)
# clean
# cc_library with branch support.
# The branches:
# X86_DEPS: works only when LITE_WITH_X86 is ON.
...
...
@@ -126,8 +132,14 @@ function(lite_cc_library TARGET)
cc_library
(
${
TARGET
}
SRCS
${
args_SRCS
}
DEPS
${
deps
}
${
args_DEPS
}
)
endif
()
foreach
(
cc_file
${
args_SRCS
}
)
file
(
APPEND
${
__lite_cc_files
}
"
${
cc_file
}
\n
"
)
endforeach
()
# collect targets need to compile for lite
if
(
args_SRCS
)
add_dependencies
(
lite_compile_deps
${
TARGET
}
)
endif
()
# register a library name.
file
(
APPEND
${
offline_lib_registry_file
}
"
${
TARGET
}
\n
"
)
...
...
@@ -224,9 +236,9 @@ add_custom_target(publish_inference_cxx_lib ${TARGET}
COMMAND mkdir -p
"
${
INFER_LITE_PUBLISH_ROOT
}
/cxx/lib"
COMMAND mkdir -p
"
${
INFER_LITE_PUBLISH_ROOT
}
/cxx/include"
COMMAND cp
"
${
CMAKE_SOURCE_DIR
}
/paddle/fluid/lite/api/paddle_*.h"
"
${
INFER_LITE_PUBLISH_ROOT
}
/cxx/include"
COMMAND cp
"
${
CMAKE_BINARY_DIR
}
/
paddle/fluid/lite/api/libpaddle_api_full
.a"
"
${
INFER_LITE_PUBLISH_ROOT
}
/cxx/lib"
COMMAND cp
"
${
CMAKE_BINARY_DIR
}
/
libpaddle_api_full_bundled
.a"
"
${
INFER_LITE_PUBLISH_ROOT
}
/cxx/lib"
)
add_dependencies
(
publish_inference_cxx_lib
paddle_api_full
)
add_dependencies
(
publish_inference_cxx_lib
bundle_full_api
)
add_dependencies
(
publish_inference_lite publish_inference_cxx_lib
)
if
(
LITE_WITH_LIGHT_WEIGHT_FRAMEWORK
)
...
...
@@ -235,9 +247,9 @@ if (LITE_WITH_LIGHT_WEIGHT_FRAMEWORK)
add_custom_target
(
publish_inference_mobile_lib
${
TARGET
}
COMMAND mkdir -p
"
${
INFER_LITE_PUBLISH_ROOT
}
/mobile/lib"
COMMAND mkdir -p
"
${
INFER_LITE_PUBLISH_ROOT
}
/mobile/include"
COMMAND cp
"
${
CMAKE_SOURCE_DIR
}
/paddle/fluid/lite/api/paddle_*.h"
"
${
INFER_LITE_PUBLISH_ROOT
}
/
cxx
/include"
COMMAND cp
"
${
CMAKE_BINARY_DIR
}
/
paddle/fluid/lite/api/libpaddle_api_light.a"
"
${
INFER_LITE_PUBLISH_ROOT
}
/cxx
/lib"
COMMAND cp
"
${
CMAKE_SOURCE_DIR
}
/paddle/fluid/lite/api/paddle_*.h"
"
${
INFER_LITE_PUBLISH_ROOT
}
/
mobile
/include"
COMMAND cp
"
${
CMAKE_BINARY_DIR
}
/
libpaddle_api_light_bundled.a"
"
${
INFER_LITE_PUBLISH_ROOT
}
/mobile
/lib"
)
add_dependencies
(
publish_inference_mobile_lib paddle_api_light
)
add_dependencies
(
publish_inference_mobile_lib paddle_api_light
bundle_light_api
)
add_dependencies
(
publish_inference_lite publish_inference_mobile_lib
)
endif
()
paddle/fluid/lite/api/CMakeLists.txt
浏览文件 @
7e07f0c4
...
...
@@ -102,9 +102,20 @@ lite_cc_test(test_apis_lite SRCS apis_test.cc
lite_cc_library
(
paddle_api_lite SRCS paddle_api.cc DEPS op_params_lite
)
lite_cc_library
(
paddle_api_full SRCS cxx_api_impl.cc DEPS cxx_api_lite paddle_api_lite light_api_lite
)
#-----------------------------------------------------------------------------------------------------
# The final inference library for both CxxConfig and MobileConfig.
lite_cc_library
(
paddle_api_full SRCS cxx_api_impl.cc DEPS cxx_api_lite paddle_api_lite light_api_lite
${
ops_lite
}
ARM_DEPS
${
arm_kernels
}
)
# The final inference library for just MobileConfig.
lite_cc_library
(
paddle_api_light SRCS light_api_impl.cc DEPS light_api_lite paddle_api_lite
)
bundle_static_library
(
paddle_api_full paddle_api_full_bundled bundle_full_api
)
bundle_static_library
(
paddle_api_light paddle_api_light_bundled bundle_light_api
)
#-----------------------------------------------------------------------------------------------------
lite_cc_test
(
test_paddle_api_lite SRCS paddle_api_test.cc DEPS paddle_api_full paddle_api_light
${
ops_lite
}
ARM_DEPS
${
arm_kernels
}
...
...
编辑
预览
Markdown
is supported
0%
请重试
或
添加新附件
.
添加附件
取消
You are about to add
0
people
to the discussion. Proceed with caution.
先完成此消息的编辑!
取消
想要评论请
注册
或
登录