提交 b5fc1a37 编写于 作者: X Xiaoyang LI 提交者: GitHub

support ios tiny publish (#1910)

* fix ios build script, test=develop

* add ios tiny publish target, test=develop

* fix ios build scrip, test=develop

* merge build_ios.sh to build.sh, test=develop

* ios support BUILD_EXTRA, test=develop
上级 79bdecdd
......@@ -89,6 +89,17 @@ if (LITE_WITH_LIGHT_WEIGHT_FRAMEWORK AND LITE_WITH_ARM)
add_custom_command(TARGET publish_inference_cxx_lib POST_BUILD
COMMAND ${CMAKE_STRIP} "--strip-debug" ${INFER_LITE_PUBLISH_ROOT}/cxx/lib/*.a)
endif()
else()
if (IOS)
add_custom_target(tiny_publish_lib ${TARGET}
COMMAND mkdir -p "${INFER_LITE_PUBLISH_ROOT}/lib"
COMMAND mkdir -p "${INFER_LITE_PUBLISH_ROOT}/include"
COMMAND cp "${CMAKE_SOURCE_DIR}/lite/api/paddle_*.h" "${INFER_LITE_PUBLISH_ROOT}/include"
COMMAND cp "${CMAKE_BINARY_DIR}/libpaddle_api_light_bundled.a" "${INFER_LITE_PUBLISH_ROOT}/lib"
)
add_dependencies(tiny_publish_lib bundle_light_api)
add_dependencies(publish_inference tiny_publish_lib)
endif()
endif()
......
......@@ -135,6 +135,41 @@ function make_all_tests {
cd - > /dev/null
}
function make_ios {
local os=$1
local abi=$2
build_dir=build.ios.${os}.${abi}
echo "building ios target into $build_dir"
echo "target os: $os"
echo "target abi: $abi"
mkdir -p ${build_dir}
cd ${build_dir}
GEN_CODE_PATH_PREFIX=lite/gen_code
mkdir -p ./${GEN_CODE_PATH_PREFIX}
touch ./${GEN_CODE_PATH_PREFIX}/__generated_code__.cc
cmake .. \
-DWITH_GPU=OFF \
-DWITH_MKL=OFF \
-DWITH_LITE=ON \
-DLITE_WITH_CUDA=OFF \
-DLITE_WITH_X86=OFF \
-DLITE_WITH_ARM=ON \
-DWITH_TESTING=OFF \
-DLITE_WITH_JAVA=OFF \
-DLITE_SHUTDOWN_LOG=ON \
-DLITE_ON_TINY_PUBLISH=ON \
-DLITE_WITH_OPENMP=OFF \
-DWITH_ARM_DOTPROD=OFF \
-DLITE_WITH_LIGHT_WEIGHT_FRAMEWORK=ON \
-DARM_TARGET_ARCH_ABI=$abi \
-DLITE_BUILD_EXTRA=$BUILD_EXTRA \
-DARM_TARGET_OS=$os
make -j4 publish_inference
cd -
}
function print_usage {
set +x
......@@ -142,22 +177,25 @@ function print_usage {
echo
echo "----------------------------------------"
echo -e "compile tiny publish so lib:"
echo -e "for android:"
echo -e " ./build.sh --arm_os=<os> --arm_abi=<abi> --arm_lang=<lang> --android_stl=<stl> tiny_publish"
echo -e "for ios:"
echo -e " ./build.sh --arm_os=<os> --arm_abi=<abi> ios"
echo
echo -e "compile full publish so lib:"
echo -e "compile full publish so lib (ios not support):"
echo -e " ./build.sh --arm_os=<os> --arm_abi=<abi> --arm_lang=<lang> --android_stl=<stl> full_publish"
echo
echo -e "compile all arm tests:"
echo -e "compile all arm tests (ios not support):"
echo -e " ./build.sh --arm_os=<os> --arm_abi=<abi> --arm_lang=<lang> test"
echo
echo -e "optional argument:"
echo -e "--build_extra: (OFF|ON); controls whether to publish extra operators and kernels for (sequence-related model such as OCR or NLP)"
echo
echo -e "argument choices:"
echo -e "--arm_os:\t android"
echo -e "--arm_os:\t android|ios|ios64"
echo -e "--arm_abi:\t armv8|armv7"
echo -e "--arm_lang:\t gcc|clang"
echo -e "--android_stl:\t c++_static|c++_shared"
echo -e "--arm_lang:\t gcc|clang (for android)"
echo -e "--android_stl:\t c++_static|c++_shared (for android)"
echo
echo -e "tasks:"
echo
......@@ -209,6 +247,10 @@ function main {
make_all_tests $ARM_OS $ARM_ABI $ARM_LANG
shift
;;
ios)
make_ios $ARM_OS $ARM_ABI
shift
;;
*)
# unknown option
print_usage
......
#!/bin/bash
set -e
build_dir=build.ios.armv7.arm64
mkdir -p ${build_dir}
cd ${build_dir}
GEN_CODE_PATH_PREFIX=lite/gen_code
mkdir -p ./${GEN_CODE_PATH_PREFIX}
touch ./${GEN_CODE_PATH_PREFIX}/__generated_code__.cc
cmake .. \
-DWITH_GPU=OFF \
-DWITH_MKL=OFF \
-DWITH_LITE=ON \
-DLITE_WITH_CUDA=OFF \
-DLITE_WITH_X86=OFF \
-DLITE_WITH_ARM=ON \
-DWITH_TESTING=OFF \
-DLITE_WITH_JAVA=OFF \
-DLITE_SHUTDOWN_LOG=ON \
-DLITE_ON_TINY_PUBLISH=ON \
-DLITE_WITH_OPENMP=OFF \
-DWITH_ARM_DOTPROD=OFF \
-DLITE_WITH_LIGHT_WEIGHT_FRAMEWORK=ON \
-DARM_TARGET_OS=ios
make -j4
cd -
Markdown is supported
0% .
You are about to add 0 people to the discussion. Proceed with caution.
先完成此消息的编辑!
想要评论请 注册