Skip to content
体验新版
项目
组织
正在加载...
登录
切换导航
打开侧边栏
BaiXuePrincess
Paddle
提交
92e7b095
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看板
提交
92e7b095
编写于
9月 12, 2017
作者:
L
Liu Yiqun
浏览文件
操作
浏览文件
下载
电子邮件补丁
差异文件
Add ARGS ANDROID_API in Dockerfile.android, to support using toolchain of different api level.
上级
27d7812b
变更
2
隐藏空白更改
内联
并排
Showing
2 changed file
with
38 addition
and
12 deletion
+38
-12
Dockerfile.android
Dockerfile.android
+6
-7
paddle/scripts/docker/build_android.sh
paddle/scripts/docker/build_android.sh
+32
-5
未找到文件。
Dockerfile.android
浏览文件 @
92e7b095
...
@@ -6,13 +6,14 @@ RUN /bin/bash -c 'if [[ -n ${UBUNTU_MIRROR} ]]; then sed -i 's#http://archive.ub
...
@@ -6,13 +6,14 @@ RUN /bin/bash -c 'if [[ -n ${UBUNTU_MIRROR} ]]; then sed -i 's#http://archive.ub
# ENV variables
# ENV variables
ARG ANDROID_ABI
ARG ANDROID_ABI
ARG ANDROID_API
ENV ANDROID_ABI=${ANDROID_ABI:-"armeabi-v7a"}
ENV ANDROID_ABI=${ANDROID_ABI:-"armeabi-v7a"}
ENV ANDROID_API=${ANDROID_API:-21}
ENV HOME=/root \
ENV HOME=/root \
ANDROID_NDK_HOME=/opt/android-ndk-linux \
ANDROID_NDK_HOME=/opt/android-ndk-linux \
ANDROID_ARM_STANDALONE_TOOLCHAIN=/opt/arm-toolchain \
ANDROID_TOOLCHAINS_DIR=/opt/toolchains
ANDROID_ARM64_STANDALONE_TOOLCHAIN=/opt/arm64-toolchain
RUN apt-get update && \
RUN apt-get update && \
apt-get install -y \
apt-get install -y \
...
@@ -42,14 +43,12 @@ RUN pip install --upgrade pip && \
...
@@ -42,14 +43,12 @@ RUN pip install --upgrade pip && \
pip install pre-commit
pip install pre-commit
# Android NDK
# 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 && \
cd /opt/android-ndk-tmp && \
wget -q https://dl.google.com/android/repository/android-ndk-r14b-linux-x86_64.zip && \
wget -q https://dl.google.com/android/repository/android-ndk-r14b-linux-x86_64.zip && \
unzip -q android-ndk-r14b-linux-x86_64.zip && \
unzip -q android-ndk-r14b-linux-x86_64.zip && \
mv android-ndk-r14b ${ANDROID_NDK_HOME} && \
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} && \
rm -rf /opt/android-ndk-tmp
${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}
CMD ["bash", "/paddle/paddle/scripts/docker/build_android.sh"]
CMD ["bash", "/paddle/paddle/scripts/docker/build_android.sh"]
paddle/scripts/docker/build_android.sh
浏览文件 @
92e7b095
...
@@ -2,8 +2,30 @@
...
@@ -2,8 +2,30 @@
set
-xe
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
BUILD_ROOT
=
/paddle/build_android
DEST_ROOT
=
/paddle/install
DEST_ROOT
=
/paddle/install
_android
rm
-rf
$BUILD_ROOT
2>/dev/null
||
true
rm
-rf
$BUILD_ROOT
2>/dev/null
||
true
mkdir
-p
$BUILD_ROOT
mkdir
-p
$BUILD_ROOT
...
@@ -11,7 +33,7 @@ cd $BUILD_ROOT
...
@@ -11,7 +33,7 @@ cd $BUILD_ROOT
if
[
$ANDROID_ABI
==
"armeabi-v7a"
]
;
then
if
[
$ANDROID_ABI
==
"armeabi-v7a"
]
;
then
cmake
-DCMAKE_SYSTEM_NAME
=
Android
\
cmake
-DCMAKE_SYSTEM_NAME
=
Android
\
-DANDROID_STANDALONE_TOOLCHAIN
=
$ANDROID_
ARM_
STANDALONE_TOOLCHAIN
\
-DANDROID_STANDALONE_TOOLCHAIN
=
$ANDROID_STANDALONE_TOOLCHAIN
\
-DANDROID_ABI
=
$ANDROID_ABI
\
-DANDROID_ABI
=
$ANDROID_ABI
\
-DANDROID_ARM_NEON
=
ON
\
-DANDROID_ARM_NEON
=
ON
\
-DANDROID_ARM_MODE
=
ON
\
-DANDROID_ARM_MODE
=
ON
\
...
@@ -26,7 +48,7 @@ if [ $ANDROID_ABI == "armeabi-v7a" ]; then
...
@@ -26,7 +48,7 @@ if [ $ANDROID_ABI == "armeabi-v7a" ]; then
..
..
elif
[
$ANDROID_ABI
==
"arm64-v8a"
]
;
then
elif
[
$ANDROID_ABI
==
"arm64-v8a"
]
;
then
cmake
-DCMAKE_SYSTEM_NAME
=
Android
\
cmake
-DCMAKE_SYSTEM_NAME
=
Android
\
-DANDROID_STANDALONE_TOOLCHAIN
=
$ANDROID_
ARM64_
STANDALONE_TOOLCHAIN
\
-DANDROID_STANDALONE_TOOLCHAIN
=
$ANDROID_STANDALONE_TOOLCHAIN
\
-DANDROID_ABI
=
$ANDROID_ABI
\
-DANDROID_ABI
=
$ANDROID_ABI
\
-DANDROID_ARM_MODE
=
ON
\
-DANDROID_ARM_MODE
=
ON
\
-DHOST_C_COMPILER
=
/usr/bin/gcc
\
-DHOST_C_COMPILER
=
/usr/bin/gcc
\
...
@@ -40,12 +62,12 @@ elif [ $ANDROID_ABI == "arm64-v8a" ]; then
...
@@ -40,12 +62,12 @@ elif [ $ANDROID_ABI == "arm64-v8a" ]; then
..
..
elif
[
$ANDROID_ABI
==
"armeabi"
]
;
then
elif
[
$ANDROID_ABI
==
"armeabi"
]
;
then
cmake
-DCMAKE_SYSTEM_NAME
=
Android
\
cmake
-DCMAKE_SYSTEM_NAME
=
Android
\
-DANDROID_STANDALONE_TOOLCHAIN
=
$ANDROID_
ARM_
STANDALONE_TOOLCHAIN
\
-DANDROID_STANDALONE_TOOLCHAIN
=
$ANDROID_STANDALONE_TOOLCHAIN
\
-DANDROID_ABI
=
$ANDROID_ABI
\
-DANDROID_ABI
=
$ANDROID_ABI
\
-DANDROID_ARM_MODE
=
ON
\
-DANDROID_ARM_MODE
=
ON
\
-DHOST_C_COMPILER
=
/usr/bin/gcc
\
-DHOST_C_COMPILER
=
/usr/bin/gcc
\
-DHOST_CXX_COMPILER
=
/usr/bin/g++
\
-DHOST_CXX_COMPILER
=
/usr/bin/g++
\
-DCMAKE_INSTALL_PREFIX
=
/paddle/install
\
-DCMAKE_INSTALL_PREFIX
=
$DEST_ROOT
\
-DCMAKE_BUILD_TYPE
=
Release
\
-DCMAKE_BUILD_TYPE
=
Release
\
-DWITH_C_API
=
ON
\
-DWITH_C_API
=
ON
\
-DWITH_SWIG_PY
=
OFF
\
-DWITH_SWIG_PY
=
OFF
\
...
@@ -55,5 +77,10 @@ else
...
@@ -55,5 +77,10 @@ else
echo
"Invalid ANDROID_ABI:
$ANDROID_ABI
"
echo
"Invalid ANDROID_ABI:
$ANDROID_ABI
"
fi
fi
cat
<<
EOF
============================================
Building in
$BUILD_ROOT
...
============================================
EOF
make
-j
`
nproc
`
make
-j
`
nproc
`
make
install
-j
`
nproc
`
make
install
-j
`
nproc
`
编辑
预览
Markdown
is supported
0%
请重试
或
添加新附件
.
添加附件
取消
You are about to add
0
people
to the discussion. Proceed with caution.
先完成此消息的编辑!
取消
想要评论请
注册
或
登录