Skip to content
体验新版
项目
组织
正在加载...
登录
切换导航
打开侧边栏
PaddlePaddle
Paddle-Lite
提交
9cffbb69
P
Paddle-Lite
项目概览
PaddlePaddle
/
Paddle-Lite
通知
331
Star
4
Fork
1
代码
文件
提交
分支
Tags
贡献者
分支图
Diff
Issue
271
列表
看板
标记
里程碑
合并请求
78
Wiki
0
Wiki
分析
仓库
DevOps
项目成员
Pages
P
Paddle-Lite
项目概览
项目概览
详情
发布
仓库
仓库
文件
提交
分支
标签
贡献者
分支图
比较
Issue
271
Issue
271
列表
看板
标记
里程碑
合并请求
78
合并请求
78
Pages
分析
分析
仓库分析
DevOps
Wiki
0
Wiki
成员
成员
收起侧边栏
关闭侧边栏
动态
分支图
创建新Issue
提交
Issue看板
提交
9cffbb69
编写于
1月 16, 2019
作者:
H
hjchen2
浏览文件
操作
浏览文件
下载
电子邮件补丁
差异文件
Add ci build script
上级
18474df1
变更
2
隐藏空白更改
内联
并排
Showing
2 changed file
with
269 addition
and
23 deletion
+269
-23
CMakeLists.txt
CMakeLists.txt
+21
-23
tools/paddle_mobile_build.sh
tools/paddle_mobile_build.sh
+248
-0
未找到文件。
CMakeLists.txt
浏览文件 @
9cffbb69
cmake_minimum_required
(
VERSION 3.0.0
)
option
(
USE_OPENMP
"openmp support"
ON
)
option
(
DEBUGING
"enable debug mode"
ON
)
option
(
USE_EXCEPTION
"use std exception"
ON
)
option
(
SYMBOL_HIDDEN
"symbol hidden"
OFF
)
# on when use jni or ios io
option
(
LOG_PROFILE
"log profile"
OFF
)
option
(
USE_OPENMP
"build with openmp support"
ON
)
option
(
USE_EXCEPTION
"build with exception"
ON
)
option
(
WITH_LOGGING
"print logging for debug"
ON
)
option
(
WITH_SYMBOL
"build with all symbols"
ON
)
# turn off if use jni or ios io
option
(
WITH_PROFILE
"print op profile for debug"
OFF
)
option
(
WITH_TEST
"build with unit tests"
ON
)
# select the platform to build
option
(
CPU
"armv7 with neon"
ON
)
option
(
GPU_MALI
"mali gpu"
OFF
)
option
(
GPU_CL
"opencl gpu"
OFF
)
option
(
FPGA
"fpga"
OFF
)
option
(
CPU
"build with arm CPU support"
ON
)
option
(
GPU_MALI
"build with arm mali GPU support"
OFF
)
option
(
GPU_CL
"build with OpenCL support"
OFF
)
option
(
FPGA
"build with FPGA support"
OFF
)
if
(
FPGA
)
option
(
FPGAV1
"fpga v1
"
ON
)
option
(
FPGAV2
"fpga v2
"
OFF
)
option
(
FPGAV1
"build with fpga v1 support
"
ON
)
option
(
FPGAV2
"build with fpga v2 support
"
OFF
)
endif
()
project
(
paddle-mobile
)
...
...
@@ -23,7 +23,6 @@ file(GLOB_RECURSE PADDLE_MOBILE_CC src/*.cc src/*.cpp src/*.c src/*.mm)
file
(
GLOB_RECURSE PADDLE_MOBILE_H src/*.h
)
include_directories
(
src/
)
set
(
CMAKE_BUILD_TYPE Release
)
set
(
CMAKE_CXX_FLAGS
"-O3 -s -DNDEBUG
${
CMAKE_CXX_FLAGS
}
"
)
if
(
IS_IOS
)
set
(
CMAKE_CXX_FLAGS
"-mfpu=neon -marm -fobjc-abi-version=2 -fobjc-arc \
...
...
@@ -33,13 +32,18 @@ else()
set
(
CMAKE_CXX_FLAGS
"-std=c++11
${
CMAKE_CXX_FLAGS
}
"
)
endif
()
if
(
DEBUGING
)
if
(
USE_OPENMP
)
set
(
CMAKE_CXX_FLAGS
"
${
CMAKE_CXX_FLAGS
}
-fopenmp"
)
add_definitions
(
-DPADDLE_MOBILE_USE_OPENMP
)
endif
()
if
(
WITH_LOGGING
)
message
(
STATUS
"debugging mode"
)
add_definitions
(
-DPADDLE_MOBILE_DEBUG
)
else
()
endif
()
if
(
SYMBOL_HIDDEN
)
if
(
NOT WITH_SYMBOL
)
add_definitions
(
-fvisibility=hidden -fvisibility-inlines-hidden
)
endif
()
...
...
@@ -50,15 +54,10 @@ else()
add_definitions
(
-fno-exceptions
)
endif
()
if
(
LOG
_PROFILE
)
if
(
WITH
_PROFILE
)
add_definitions
(
-DPADDLE_MOBILE_PROFILE
)
endif
()
if
(
USE_OPENMP
)
set
(
CMAKE_CXX_FLAGS
"
${
CMAKE_CXX_FLAGS
}
-fopenmp"
)
add_definitions
(
-DPADDLE_MOBILE_USE_OPENMP
)
endif
()
# platform control
if
(
ARM_LINUX
)
include
(
"
${
CMAKE_CURRENT_LIST_DIR
}
/tools/arm-platform.cmake"
)
...
...
@@ -217,7 +216,6 @@ endif()
set_property
(
CACHE NET PROPERTY STRINGS
"default"
"googlenet"
"mobilenet"
"yolo"
"squeezenet"
"FPGA_NET_V1"
"FPGA_NET_V2"
"NLP"
)
include
(
"
${
CMAKE_CURRENT_LIST_DIR
}
/tools/op.cmake"
)
# build library
if
(
ANDROID_NDK_TOOLCHAIN_INCLUDED
)
list
(
REMOVE_DUPLICATES CMAKE_CXX_FLAGS
)
...
...
@@ -239,7 +237,7 @@ else()
endif
()
# unit test
if
(
DEBUGING
)
if
(
WITH_TEST AND WITH_SYMBOL
)
if
(
IS_IOS
)
else
()
add_subdirectory
(
test
)
...
...
tools/paddle_mobile_build.sh
0 → 100755
浏览文件 @
9cffbb69
#!/usr/bin/env bash
# Copyright (c) 2018 PaddlePaddle Authors. All Rights Reserved.
#
# Licensed under the Apache License, Version 2.0 (the "License");
# you may not use this file except in compliance with the License.
# You may obtain a copy of the License at
#
# http://www.apache.org/licenses/LICENSE-2.0
#
# Unless required by applicable law or agreed to in writing, software
# distributed under the License is distributed on an "AS IS" BASIS,
# WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
# See the License for the specific language governing permissions and
# limitations under the License.
#set -ex
function
print_usage
()
{
echo
"
\n
${
RED
}
Usage
${
NONE
}
:
${
BOLD
}${
SCRIPT_NAME
}${
NONE
}
[Option] [Network]"
echo
"
\n
${
RED
}
Option
${
NONE
}
: required, specify the target platform
${
BLUE
}
android_armv7
${
NONE
}
: run build for android armv7 platform
${
BLUE
}
android_armv8
${
NONE
}
: run build for android armv8 platform
${
BLUE
}
ios
${
NONE
}
: run build for apple ios platform
${
BLUE
}
linux_armv7
${
NONE
}
: run build for linux armv7 platform
${
BLUE
}
linux_armv8
${
NONE
}
: run build for linux armv8 platform
"
echo
"
\n
${
RED
}
Network
${
NONE
}
: optional, only for compressing framework size
${
BLUE
}
googlenet
${
NONE
}
: build only googlenet supported
${
BLUE
}
mobilenet
${
NONE
}
: build only mobilenet supported
${
BLUE
}
yolo
${
NONE
}
: build only yolo supported
${
BLUE
}
squeezenet
${
NONE
}
: build only squeezenet supported
${
BLUE
}
resnet
${
NONE
}
: build only resnet supported
${
BLUE
}
mobilenetssd
${
NONE
}
: build only mobilenetssd supported
${
BLUE
}
nlp
${
NONE
}
: build only nlp model supported
${
BLUE
}
mobilenetfssd
${
NONE
}
: build only mobilenetfssd supported
${
BLUE
}
genet
${
NONE
}
: build only genet supported
${
BLUE
}
super
${
NONE
}
: build only super supported
"
}
function
init
()
{
RED
=
'\033[0;31m'
BLUE
=
'\033[0;34m'
BOLD
=
'\033[1m'
NONE
=
'\033[0m'
PADDLE_MOBILE_ROOT
=
"
$(
cd
"
$(
dirname
"
${
BASH_SOURCE
[0]
}
"
)
/../"
&&
pwd
)
"
if
[
-z
"
${
SCRIPT_NAME
}
"
]
;
then
SCRIPT_NAME
=
$0
fi
}
function
check_ndk
()
{
if
[
-z
"
${
NDK_ROOT
}
"
]
;
then
echo
"Should set NDK_ROOT as your android ndk path, such as
\n
"
echo
" export NDK_ROOT=~/android-ndk-r14b
\n
"
exit
-1
fi
}
function
build_android_armv7_cpu_only
()
{
rm
-rf
../build/armeabi-v7a
cmake ..
\
-B
"../build/armeabi-v7a"
\
-DANDROID_ABI
=
"armeabi-v7a with NEON"
\
-DCMAKE_BUILD_TYPE
=
"MinSizeRel"
\
-DCMAKE_TOOLCHAIN_FILE
=
"./tools/android-cmake/android.toolchain.cmake"
\
-DANDROID_PLATFORM
=
"android-22"
\
-DANDROID_STL
=
c++_static
\
-DANDROID
=
true
\
-DWITH_LOGGING
=
OFF
\
-DGPU_MALI
=
OFF
\
-DGPU_CL
=
OFF
\
-DFPGA
=
OFF
cd
../build/armeabi-v7a
&&
make
-j
8
cd
-
}
function
build_android_armv7_gpu
()
{
rm
-rf
../build/armeabi-v7a
cmake ..
\
-B
"../build/armeabi-v7a"
\
-DANDROID_ABI
=
"armeabi-v7a with NEON"
\
-DCMAKE_BUILD_TYPE
=
"MinSizeRel"
\
-DCMAKE_TOOLCHAIN_FILE
=
"./tools/android-cmake/android.toolchain.cmake"
\
-DANDROID_PLATFORM
=
"android-22"
\
-DANDROID_STL
=
c++_static
\
-DANDROID
=
true
\
-DWITH_LOGGING
=
OFF
\
-DGPU_MALI
=
ON
\
-DGPU_CL
=
ON
\
-DFPGA
=
OFF
cd
../build/armeabi-v7a
&&
make
-j
8
cd
-
}
function
build_android_armv8_cpu_only
()
{
rm
-rf
../build/arm64-v8a
cmake ..
\
-B
"../build/arm64-v8a"
\
-DANDROID_ABI
=
"arm64-v8a"
\
-DCMAKE_BUILD_TYPE
=
"MinSizeRel"
\
-DCMAKE_TOOLCHAIN_FILE
=
"./tools/android-cmake/android.toolchain.cmake"
\
-DANDROID_PLATFORM
=
"android-22"
\
-DANDROID_STL
=
c++_static
\
-DANDROID
=
true
\
-DWITH_LOGGING
=
OFF
\
-DGPU_MALI
=
OFF
\
-DGPU_CL
=
OFF
\
-DFPGA
=
OFF
cd
../build/arm64-v8a
&&
make
-j
1
cd
-
}
function
build_android_armv8_gpu
()
{
rm
-rf
../build/arm64-v8a
cmake ..
\
-B
"../build/arm64-v8a"
\
-DANDROID_ABI
=
"arm64-v8a"
\
-DCMAKE_BUILD_TYPE
=
"MinSizeRel"
\
-DCMAKE_TOOLCHAIN_FILE
=
"./tools/android-cmake/android.toolchain.cmake"
\
-DANDROID_PLATFORM
=
"android-22"
\
-DANDROID_STL
=
c++_static
\
-DANDROID
=
true
\
-DWITH_LOGGING
=
OFF
\
-DGPU_MALI
=
ON
\
-DGPU_CL
=
ON
\
-DFPGA
=
OFF
cd
../build/arm64-v8a
&&
make
-j
8
cd
-
}
function
build_ios_armv8_cpu_only
()
{
rm
-rf
../build/ios
cmake ..
\
-B
"../build/ios"
\
-DCMAKE_BUILD_TYPE
=
"MinSizeRel"
\
-DCMAKE_TOOLCHAIN_FILE
=
"./tools/ios-cmake/ios.toolchain.cmake"
\
-DIOS_PLATFORM
=
OS
\
-DIOS_ARCH
=
"
${
IOS_ARCH
}
"
\
-DIS_IOS
=
true
\
-DGPU_MALI
=
OFF
\
-DGPU_CL
=
OFF
\
-DFPGA
=
OFF
cd
../build/ios
&&
make
-j
8
cd
-
}
function
build_ios_armv8_gpu
()
{
rm
-rf
../build/ios
cmake ..
\
-B
"../build/ios"
\
-DCMAKE_BUILD_TYPE
=
"MinSizeRel"
\
-DCMAKE_TOOLCHAIN_FILE
=
"./tools/ios-cmake/ios.toolchain.cmake"
\
-DIOS_PLATFORM
=
OS
\
-DIOS_ARCH
=
"
${
IOS_ARCH
}
"
\
-DIS_IOS
=
true
\
-DGPU_MALI
=
OFF
\
-DGPU_CL
=
ON
\
-DFPGA
=
OFF
cd
../build/ios
&&
make
-j
8
cd
-
}
function
build_linux_armv7_cpu_only
()
{
rm
-rf
../build/armv7_linux
cmake ..
\
-B
"../build/armv7_linux"
\
-DCMAKE_BUILD_TYPE
=
"MinSizeRel"
\
-DCMAKE_TOOLCHAIN_FILE
=
"./tools/toolchains/arm-linux-gnueabihf.cmake"
\
-DGPU_MALI
=
OFF
\
-DGPU_CL
=
OFF
\
-DFPGA
=
OFF
cd
../build/armv7_linux
&&
make
-j
8
cd
-
}
function
build_linux_armv7_gpu
()
{
rm
-rf
../build/armv7_linux
cmake ..
\
-B
"../build/armv7_linux"
\
-DCMAKE_BUILD_TYPE
=
"MinSizeRel"
\
-DCMAKE_TOOLCHAIN_FILE
=
"./tools/toolchains/arm-linux-gnueabihf.cmake"
\
-DGPU_MALI
=
ON
\
-DGPU_CL
=
ON
\
-DFPGA
=
OFF
cd
../build/armv7_linux
&&
make
-j
8
cd
-
}
function
build_android_armv7
()
{
check_ndk
build_android_armv7_cpu_only
# build_android_armv7_gpu
}
function
build_android_armv8
()
{
check_ndk
build_android_armv8_cpu_only
# build_android_armv8_gpu
}
function
build_ios
()
{
build_ios_armv8_cpu_only
# build_ios_armv8_gpu
}
function
build_linux_armv7
()
{
check_ndk
build_linux_armv7_cpu_only
# build_linux_armv7_gpu
}
function
main
()
{
local
CMD
=
$1
init
case
$CMD
in
android_armv7
)
build_android_armv7
;;
android_armv8
)
build_android_armv8
;;
ios
)
build_ios
;;
linux_armv7
)
build_linux_armv7
;;
*
)
print_usage
exit
0
;;
esac
}
main
$@
编辑
预览
Markdown
is supported
0%
请重试
或
添加新附件
.
添加附件
取消
You are about to add
0
people
to the discussion. Proceed with caution.
先完成此消息的编辑!
取消
想要评论请
注册
或
登录