From 3394daac40d5a9b7a2caf082c5630afa9544f8c2 Mon Sep 17 00:00:00 2001 From: Chunwei Date: Fri, 28 Jun 2019 08:40:21 +0000 Subject: [PATCH] add tools to publish --- paddle/fluid/lite/CMakeLists.txt | 9 ++++++++- paddle/fluid/lite/tools/build.sh | 6 +++--- 2 files changed, 11 insertions(+), 4 deletions(-) diff --git a/paddle/fluid/lite/CMakeLists.txt b/paddle/fluid/lite/CMakeLists.txt index 35897a60c9..a484856991 100644 --- a/paddle/fluid/lite/CMakeLists.txt +++ b/paddle/fluid/lite/CMakeLists.txt @@ -235,7 +235,7 @@ if (WITH_TESTING) endif() # for publish -set(INFER_LITE_PUBLISH_ROOT "${CMAKE_BINARY_DIR}/inference_lite_lib" CACHE STRING "inference publish path") +set(INFER_LITE_PUBLISH_ROOT "${CMAKE_BINARY_DIR}/inference_lite_lib.${ARM_TARGET_OS}.${ARM_TARGET_ARCH_ABI}") message(STATUS "publish inference lib to ${INFER_LITE_PUBLISH_ROOT}") # The final target for publish lite lib @@ -244,18 +244,25 @@ add_custom_target(publish_inference_lite) #cc_library(inference_cxx_lib DEPS cxx_api_lite) add_custom_target(publish_inference_cxx_lib ${TARGET} COMMAND mkdir -p "${INFER_LITE_PUBLISH_ROOT}/cxx/lib" + COMMAND mkdir -p "${INFER_LITE_PUBLISH_ROOT}/bin" COMMAND mkdir -p "${INFER_LITE_PUBLISH_ROOT}/cxx/include" COMMAND cp "${CMAKE_SOURCE_DIR}/paddle/fluid/lite/api/paddle_*.h" "${INFER_LITE_PUBLISH_ROOT}/cxx/include" COMMAND cp "${CMAKE_BINARY_DIR}/libpaddle_api_full_bundled.a" "${INFER_LITE_PUBLISH_ROOT}/cxx/lib" + COMMAND cp "${CMAKE_BINARY_DIR}/paddle/fluid/lite/api/model_optimize_tool" "${INFER_LITE_PUBLISH_ROOT}/bin" + COMMAND cp "${CMAKE_BINARY_DIR}/paddle/fluid/lite/gen_code/paddle_code_generator" "${INFER_LITE_PUBLISH_ROOT}/bin" ) +add_dependencies(publish_inference_cxx_lib model_optimize_tool) +add_dependencies(publish_inference_cxx_lib paddle_code_generator) add_dependencies(publish_inference_cxx_lib bundle_full_api) add_dependencies(publish_inference_lite publish_inference_cxx_lib) + if (LITE_WITH_LIGHT_WEIGHT_FRAMEWORK) #cc_library(inference_mobile_lib DEPS light_api_lite) add_custom_target(publish_inference_mobile_lib ${TARGET} COMMAND mkdir -p "${INFER_LITE_PUBLISH_ROOT}/mobile/lib" + COMMAND mkdir -p "${INFER_LITE_PUBLISH_ROOT}/mobile/bin" COMMAND mkdir -p "${INFER_LITE_PUBLISH_ROOT}/mobile/include" COMMAND cp "${CMAKE_SOURCE_DIR}/paddle/fluid/lite/api/paddle_*.h" "${INFER_LITE_PUBLISH_ROOT}/mobile/include" COMMAND cp "${CMAKE_BINARY_DIR}/libpaddle_api_light_bundled.a" "${INFER_LITE_PUBLISH_ROOT}/mobile/lib" diff --git a/paddle/fluid/lite/tools/build.sh b/paddle/fluid/lite/tools/build.sh index 1d543ee034..c46a8cf698 100755 --- a/paddle/fluid/lite/tools/build.sh +++ b/paddle/fluid/lite/tools/build.sh @@ -255,8 +255,8 @@ function _test_model_optimize_tool { local adb="adb -s emulator-${port}" make model_optimize_tool -j$NUM_CORES_FOR_COMPILE - local test_path=$(find . -name model_optimize_tool) - local model_path=$(find . -name lite_naive_model) + local test_path=$(find . -name model_optimize_tool | head -n1) + local model_path=$(find . -name lite_naive_model | head -n1) $adb push ${test_path} ${ADB_WORK_DIR} $adb shell mkdir -p $remote_model_path $adb push $model_path/* $remote_model_path @@ -272,7 +272,7 @@ function _test_paddle_code_generator { local adb="adb -s emulator-${port}" make paddle_code_generator -j$NUM_CORES_FOR_COMPILE - local test_path=$(find . -name $test_name) + local test_path=$(find . -name $test_name | head -n1) $adb push $test_path $remote_test $adb shell $remote_test --optimized_model $remote_model --generated_code_file $ADB_WORK_DIR/gen_code.cc -- GitLab