提交 0a197583 编写于 作者: X Xiaoyang LI 提交者: Yan Chunwei

support ios tiny publish (#1910) (#1919)

上级 3a28a80b
...@@ -89,6 +89,17 @@ if (LITE_WITH_LIGHT_WEIGHT_FRAMEWORK AND LITE_WITH_ARM) ...@@ -89,6 +89,17 @@ if (LITE_WITH_LIGHT_WEIGHT_FRAMEWORK AND LITE_WITH_ARM)
add_custom_command(TARGET publish_inference_cxx_lib POST_BUILD add_custom_command(TARGET publish_inference_cxx_lib POST_BUILD
COMMAND ${CMAKE_STRIP} "--strip-debug" ${INFER_LITE_PUBLISH_ROOT}/cxx/lib/*.a) COMMAND ${CMAKE_STRIP} "--strip-debug" ${INFER_LITE_PUBLISH_ROOT}/cxx/lib/*.a)
endif() 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() endif()
......
...@@ -135,6 +135,41 @@ function make_all_tests { ...@@ -135,6 +135,41 @@ function make_all_tests {
cd - > /dev/null 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 { function print_usage {
set +x set +x
...@@ -142,22 +177,25 @@ function print_usage { ...@@ -142,22 +177,25 @@ function print_usage {
echo echo
echo "----------------------------------------" echo "----------------------------------------"
echo -e "compile tiny publish so lib:" 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 " ./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
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 -e " ./build.sh --arm_os=<os> --arm_abi=<abi> --arm_lang=<lang> --android_stl=<stl> full_publish"
echo 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 -e " ./build.sh --arm_os=<os> --arm_abi=<abi> --arm_lang=<lang> test"
echo echo
echo -e "optional argument:" 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 -e "--build_extra: (OFF|ON); controls whether to publish extra operators and kernels for (sequence-related model such as OCR or NLP)"
echo echo
echo -e "argument choices:" 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_abi:\t armv8|armv7"
echo -e "--arm_lang:\t gcc|clang" echo -e "--arm_lang:\t gcc|clang (for android)"
echo -e "--android_stl:\t c++_static|c++_shared" echo -e "--android_stl:\t c++_static|c++_shared (for android)"
echo echo
echo -e "tasks:" echo -e "tasks:"
echo echo
...@@ -209,6 +247,10 @@ function main { ...@@ -209,6 +247,10 @@ function main {
make_all_tests $ARM_OS $ARM_ABI $ARM_LANG make_all_tests $ARM_OS $ARM_ABI $ARM_LANG
shift shift
;; ;;
ios)
make_ios $ARM_OS $ARM_ABI
shift
;;
*) *)
# unknown option # unknown option
print_usage 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.
先完成此消息的编辑!
想要评论请 注册