Skip to content
体验新版
项目
组织
正在加载...
登录
切换导航
打开侧边栏
PaddlePaddle
PaddleDetection
提交
e4bab9a4
P
PaddleDetection
项目概览
PaddlePaddle
/
PaddleDetection
大约 1 年 前同步成功
通知
695
Star
11112
Fork
2696
代码
文件
提交
分支
Tags
贡献者
分支图
Diff
Issue
184
列表
看板
标记
里程碑
合并请求
40
Wiki
0
Wiki
分析
仓库
DevOps
项目成员
Pages
P
PaddleDetection
项目概览
项目概览
详情
发布
仓库
仓库
文件
提交
分支
标签
贡献者
分支图
比较
Issue
184
Issue
184
列表
看板
标记
里程碑
合并请求
40
合并请求
40
Pages
分析
分析
仓库分析
DevOps
Wiki
0
Wiki
成员
成员
收起侧边栏
关闭侧边栏
动态
分支图
创建新Issue
提交
Issue看板
提交
e4bab9a4
编写于
9月 13, 2017
作者:
Y
Yiqun Liu
提交者:
GitHub
9月 13, 2017
浏览文件
操作
浏览文件
下载
差异文件
Merge pull request #4057 from Xreki/build_install_third_party
Install all the depended third_party libraries in "make install" phase
上级
8778957c
b75123b5
变更
10
显示空白变更内容
内联
并排
Showing
10 changed file
with
122 addition
and
17 deletion
+122
-17
CMakeLists.txt
CMakeLists.txt
+3
-0
Dockerfile.android
Dockerfile.android
+6
-7
cmake/external/gflags.cmake
cmake/external/gflags.cmake
+11
-2
cmake/external/glog.cmake
cmake/external/glog.cmake
+11
-2
cmake/external/openblas.cmake
cmake/external/openblas.cmake
+20
-0
cmake/external/protobuf.cmake
cmake/external/protobuf.cmake
+9
-0
cmake/external/zlib.cmake
cmake/external/zlib.cmake
+9
-0
paddle/capi/CMakeLists.txt
paddle/capi/CMakeLists.txt
+20
-0
paddle/function/neon/NeonDepthwiseConv.h
paddle/function/neon/NeonDepthwiseConv.h
+1
-1
paddle/scripts/docker/build_android.sh
paddle/scripts/docker/build_android.sh
+32
-5
未找到文件。
CMakeLists.txt
浏览文件 @
e4bab9a4
...
...
@@ -67,6 +67,9 @@ endif()
if
(
ANDROID
)
if
(
${
CMAKE_SYSTEM_VERSION
}
VERSION_LESS
"16"
)
message
(
FATAL_ERROR
"Unsupport standalone toolchains with Android API level lower than 16"
)
elseif
(
${
CMAKE_SYSTEM_VERSION
}
VERSION_LESS
"21"
)
# TODO: support glog for Android api 16 ~ 19 in the future
message
(
WARNING
"Using the unofficial git repository <https://github.com/Xreki/glog.git> instead"
)
endif
()
set
(
WITH_GPU OFF CACHE STRING
...
...
Dockerfile.android
浏览文件 @
e4bab9a4
...
...
@@ -6,13 +6,14 @@ RUN /bin/bash -c 'if [[ -n ${UBUNTU_MIRROR} ]]; then sed -i 's#http://archive.ub
# ENV variables
ARG ANDROID_ABI
ARG ANDROID_API
ENV ANDROID_ABI=${ANDROID_ABI:-"armeabi-v7a"}
ENV ANDROID_API=${ANDROID_API:-21}
ENV HOME=/root \
ANDROID_NDK_HOME=/opt/android-ndk-linux \
ANDROID_ARM_STANDALONE_TOOLCHAIN=/opt/arm-toolchain \
ANDROID_ARM64_STANDALONE_TOOLCHAIN=/opt/arm64-toolchain
ANDROID_TOOLCHAINS_DIR=/opt/toolchains
RUN apt-get update && \
apt-get install -y \
...
...
@@ -42,14 +43,12 @@ RUN pip install --upgrade pip && \
pip install pre-commit
# Android NDK
RUN mkdir /opt/android-ndk-tmp && \
RUN mkdir -p ${ANDROID_TOOLCHAINS_DIR} && \
mkdir -p /opt/android-ndk-tmp && \
cd /opt/android-ndk-tmp && \
wget -q https://dl.google.com/android/repository/android-ndk-r14b-linux-x86_64.zip && \
unzip -q android-ndk-r14b-linux-x86_64.zip && \
mv android-ndk-r14b ${ANDROID_NDK_HOME} && \
${ANDROID_NDK_HOME}/build/tools/make-standalone-toolchain.sh --arch=arm --platform=android-23 --install-dir=${ANDROID_ARM_STANDALONE_TOOLCHAIN} && \
${ANDROID_NDK_HOME}/build/tools/make-standalone-toolchain.sh --arch=arm64 --platform=android-23 --install-dir=${ANDROID_ARM64_STANDALONE_TOOLCHAIN} && \
rm -rf /opt/android-ndk-tmp && \
rm -rf ${ANDROID_NDK_HOME}
rm -rf /opt/android-ndk-tmp
CMD ["bash", "/paddle/paddle/scripts/docker/build_android.sh"]
cmake/external/gflags.cmake
浏览文件 @
e4bab9a4
...
...
@@ -56,3 +56,12 @@ SET_PROPERTY(TARGET gflags PROPERTY IMPORTED_LOCATION ${GFLAGS_LIBRARIES})
ADD_DEPENDENCIES
(
gflags extern_gflags
)
LIST
(
APPEND external_project_dependencies gflags
)
IF
(
WITH_C_API
)
INSTALL
(
DIRECTORY
${
GFLAGS_INCLUDE_DIR
}
DESTINATION third_party/gflags
)
IF
(
ANDROID
)
INSTALL
(
FILES
${
GFLAGS_LIBRARIES
}
DESTINATION third_party/gflags/lib/
${
ANDROID_ABI
}
)
ELSE
()
INSTALL
(
FILES
${
GFLAGS_LIBRARIES
}
DESTINATION third_party/gflags/lib
)
ENDIF
()
ENDIF
()
cmake/external/glog.cmake
浏览文件 @
e4bab9a4
...
...
@@ -56,3 +56,12 @@ ADD_DEPENDENCIES(glog extern_glog gflags)
LINK_LIBRARIES
(
glog gflags
)
LIST
(
APPEND external_project_dependencies glog
)
IF
(
WITH_C_API
)
INSTALL
(
DIRECTORY
${
GLOG_INCLUDE_DIR
}
DESTINATION third_party/glog
)
IF
(
ANDROID
)
INSTALL
(
FILES
${
GLOG_LIBRARIES
}
DESTINATION third_party/glog/lib/
${
ANDROID_ABI
}
)
ELSE
()
INSTALL
(
FILES
${
GLOG_LIBRARIES
}
DESTINATION third_party/glog/lib
)
ENDIF
()
ENDIF
()
cmake/external/openblas.cmake
浏览文件 @
e4bab9a4
...
...
@@ -73,6 +73,26 @@ IF(NOT ${CBLAS_FOUND})
UPDATE_COMMAND
""
CONFIGURE_COMMAND
""
)
IF
(
WITH_C_API
)
INSTALL
(
DIRECTORY
${
CBLAS_INC_DIR
}
DESTINATION third_party/openblas
)
# Because libopenblas.a is a symbolic link of another library, thus need to
# install the whole directory.
IF
(
ANDROID
)
SET
(
TMP_INSTALL_DIR third_party/openblas/lib/
${
ANDROID_ABI
}
)
ELSE
()
SET
(
TMP_INSTALL_DIR third_party/openblas/lib
)
ENDIF
()
INSTALL
(
CODE
"execute_process(
COMMAND
${
CMAKE_COMMAND
}
-E copy_directory
${
CBLAS_INSTALL_DIR
}
/lib
destination
${
CMAKE_INSTALL_PREFIX
}
/
${
TMP_INSTALL_DIR
}
)"
)
INSTALL
(
CODE
"MESSAGE(STATUS
\"
Installing:
\"
\"
${
CBLAS_INSTALL_DIR
}
/lib ->
${
CMAKE_INSTALL_PREFIX
}
/
${
TMP_INSTALL_DIR
}
\"
)"
)
ENDIF
()
ENDIF
(
NOT
${
CBLAS_FOUND
}
)
MESSAGE
(
STATUS
"BLAS library:
${
CBLAS_LIBRARIES
}
"
)
...
...
cmake/external/protobuf.cmake
浏览文件 @
e4bab9a4
...
...
@@ -223,6 +223,15 @@ IF(NOT PROTOBUF_FOUND)
SET
(
PROTOBUF_PROTOC_LIBRARY
${
extern_protobuf_PROTOC_LIBRARY
}
CACHE FILEPATH
"protoc library."
FORCE
)
IF
(
WITH_C_API
)
INSTALL
(
DIRECTORY
${
PROTOBUF_INCLUDE_DIR
}
DESTINATION third_party/protobuf
)
IF
(
ANDROID
)
INSTALL
(
FILES
${
PROTOBUF_LIBRARY
}
DESTINATION third_party/protobuf/lib/
${
ANDROID_ABI
}
)
ELSE
()
INSTALL
(
FILES
${
PROTOBUF_LIBRARY
}
DESTINATION third_party/protobuf/lib
)
ENDIF
()
ENDIF
()
IF
(
CMAKE_CROSSCOMPILING
)
PROMPT_PROTOBUF_LIB
(
protobuf_host extern_protobuf
)
ELSE
()
...
...
cmake/external/zlib.cmake
浏览文件 @
e4bab9a4
...
...
@@ -49,3 +49,12 @@ ExternalProject_Add(
)
LIST
(
APPEND external_project_dependencies zlib
)
IF
(
WITH_C_API
)
INSTALL
(
DIRECTORY
${
ZLIB_INCLUDE_DIR
}
DESTINATION third_party/zlib
)
IF
(
ANDROID
)
INSTALL
(
FILES
${
ZLIB_LIBRARIES
}
DESTINATION third_party/zlib/lib/
${
ANDROID_ABI
}
)
ELSE
()
INSTALL
(
FILES
${
ZLIB_LIBRARIES
}
DESTINATION third_party/zlib/lib
)
ENDIF
()
ENDIF
()
paddle/capi/CMakeLists.txt
浏览文件 @
e4bab9a4
...
...
@@ -64,9 +64,29 @@ link_paddle_exe(paddle_capi_shared)
install
(
FILES
${
CAPI_HEADERS
}
DESTINATION include/paddle
)
install
(
FILES
${
CMAKE_CURRENT_BINARY_DIR
}
/config.h DESTINATION include/paddle
)
if
(
ANDROID
)
execute_process
(
COMMAND
${
GIT_EXECUTABLE
}
log --pretty=oneline -1
OUTPUT_VARIABLE GIT_COMMITS_LIST
RESULT_VARIABLE GIT_COMMITS_LIST_RESULT
ERROR_QUIET OUTPUT_STRIP_TRAILING_WHITESPACE
)
if
(
${
GIT_COMMITS_LIST_RESULT
}
)
set
(
GIT_COMMITS_LIST
"No commits."
)
endif
()
install
(
FILES
${
CMAKE_CURRENT_BINARY_DIR
}
/
${
capi_whole_library
}
DESTINATION lib/
${
ANDROID_ABI
}
)
install
(
TARGETS paddle_capi_shared DESTINATION lib/
${
ANDROID_ABI
}
)
install
(
CODE
"FILE(WRITE
${
CMAKE_INSTALL_PREFIX
}
/lib/
${
ANDROID_ABI
}
/BUILD.txt
\"
Compiler:
\n\"
\"\\
t
${
CMAKE_C_COMPILER
}
\\
n
\"
\"\\
t
${
CMAKE_CXX_COMPILER
}
\\
n
\"
\"
Compiler Flags:
\\
n
\"
\"\\
t
${
CMAKE_F_FLAGS
}
\\
n
\"
\"\\
t
${
CMAKE_CXX_FLAGS
}
\\
n
\"
\"
Android API:
${
CMAKE_SYSTEM_VERSION
}
\\
n
\"
\"
Lastest commit:
\\
n
\"
\"\\
t
${
GIT_COMMITS_LIST
}
\\
n
\"
)"
)
else
(
ANDROID
)
install
(
FILES
${
CMAKE_CURRENT_BINARY_DIR
}
/
${
capi_whole_library
}
DESTINATION lib
)
install
(
TARGETS paddle_capi_shared DESTINATION lib
)
...
...
paddle/function/neon/NeonDepthwiseConv.h
浏览文件 @
e4bab9a4
...
...
@@ -594,7 +594,7 @@ struct StridePadding {
float32x4_t
s1
=
vdupq_n_f32
(
0.
f
);
for
(
int
s
=
0
;
s
<
step
;
s
++
)
{
float32x4_t
s0
=
vld1q_f32
(
input
);
float32x4x2_t
v
=
{
s0
,
s1
};
float32x4x2_t
v
=
{
{
s0
,
s1
}
};
vst2q_f32
(
inputPadding
,
v
);
input
+=
4
;
inputPadding
+=
8
;
...
...
paddle/scripts/docker/build_android.sh
浏览文件 @
e4bab9a4
...
...
@@ -2,8 +2,30 @@
set
-xe
if
[
$ANDROID_ABI
==
"arm64-v8a"
]
;
then
ANDROID_ARCH
=
arm64
else
# armeabi, armeabi-v7a
ANDROID_ARCH
=
arm
fi
ANDROID_STANDALONE_TOOLCHAIN
=
$ANDROID_TOOLCHAINS_DIR
/
$ANDROID_ARCH
-android-
$ANDROID_API
cat
<<
EOF
============================================
Generating the standalone toolchain ...
${
ANDROID_NDK_HOME
}
/build/tools/make-standalone-toolchain.sh
--arch=
$ANDROID_ARCH
--platform=android-
$ANDROID_API
--install-dir=
${
ANDROID_STANDALONE_TOOLCHAIN
}
============================================
EOF
${
ANDROID_NDK_HOME
}
/build/tools/make-standalone-toolchain.sh
\
--arch
=
$ANDROID_ARCH
\
--platform
=
android-
$ANDROID_API
\
--install-dir
=
$ANDROID_STANDALONE_TOOLCHAIN
BUILD_ROOT
=
/paddle/build_android
DEST_ROOT
=
/paddle/install
DEST_ROOT
=
/paddle/install
_android
rm
-rf
$BUILD_ROOT
2>/dev/null
||
true
mkdir
-p
$BUILD_ROOT
...
...
@@ -11,7 +33,7 @@ cd $BUILD_ROOT
if
[
$ANDROID_ABI
==
"armeabi-v7a"
]
;
then
cmake
-DCMAKE_SYSTEM_NAME
=
Android
\
-DANDROID_STANDALONE_TOOLCHAIN
=
$ANDROID_
ARM_
STANDALONE_TOOLCHAIN
\
-DANDROID_STANDALONE_TOOLCHAIN
=
$ANDROID_STANDALONE_TOOLCHAIN
\
-DANDROID_ABI
=
$ANDROID_ABI
\
-DANDROID_ARM_NEON
=
ON
\
-DANDROID_ARM_MODE
=
ON
\
...
...
@@ -26,7 +48,7 @@ if [ $ANDROID_ABI == "armeabi-v7a" ]; then
..
elif
[
$ANDROID_ABI
==
"arm64-v8a"
]
;
then
cmake
-DCMAKE_SYSTEM_NAME
=
Android
\
-DANDROID_STANDALONE_TOOLCHAIN
=
$ANDROID_
ARM64_
STANDALONE_TOOLCHAIN
\
-DANDROID_STANDALONE_TOOLCHAIN
=
$ANDROID_STANDALONE_TOOLCHAIN
\
-DANDROID_ABI
=
$ANDROID_ABI
\
-DANDROID_ARM_MODE
=
ON
\
-DHOST_C_COMPILER
=
/usr/bin/gcc
\
...
...
@@ -40,12 +62,12 @@ elif [ $ANDROID_ABI == "arm64-v8a" ]; then
..
elif
[
$ANDROID_ABI
==
"armeabi"
]
;
then
cmake
-DCMAKE_SYSTEM_NAME
=
Android
\
-DANDROID_STANDALONE_TOOLCHAIN
=
$ANDROID_
ARM_
STANDALONE_TOOLCHAIN
\
-DANDROID_STANDALONE_TOOLCHAIN
=
$ANDROID_STANDALONE_TOOLCHAIN
\
-DANDROID_ABI
=
$ANDROID_ABI
\
-DANDROID_ARM_MODE
=
ON
\
-DHOST_C_COMPILER
=
/usr/bin/gcc
\
-DHOST_CXX_COMPILER
=
/usr/bin/g++
\
-DCMAKE_INSTALL_PREFIX
=
/paddle/install
\
-DCMAKE_INSTALL_PREFIX
=
$DEST_ROOT
\
-DCMAKE_BUILD_TYPE
=
Release
\
-DWITH_C_API
=
ON
\
-DWITH_SWIG_PY
=
OFF
\
...
...
@@ -55,5 +77,10 @@ else
echo
"Invalid ANDROID_ABI:
$ANDROID_ABI
"
fi
cat
<<
EOF
============================================
Building in
$BUILD_ROOT
...
============================================
EOF
make
-j
`
nproc
`
make
install
-j
`
nproc
`
编辑
预览
Markdown
is supported
0%
请重试
或
添加新附件
.
添加附件
取消
You are about to add
0
people
to the discussion. Proceed with caution.
先完成此消息的编辑!
取消
想要评论请
注册
或
登录