From 797296177d1673f674b34cb71179813d0b8536ab Mon Sep 17 00:00:00 2001 From: hangq Date: Thu, 20 Aug 2020 20:38:43 +0800 Subject: [PATCH] fix bug in java api --- mindspore/lite/java/build_aar.sh | 18 +++++++++--------- mindspore/lite/java/native/CMakeLists.txt | 7 +++++++ mindspore/lite/java/native/runtime/context.cpp | 2 +- 3 files changed, 17 insertions(+), 10 deletions(-) diff --git a/mindspore/lite/java/build_aar.sh b/mindspore/lite/java/build_aar.sh index bd4653bc4ac..fd683581e5b 100644 --- a/mindspore/lite/java/build_aar.sh +++ b/mindspore/lite/java/build_aar.sh @@ -5,20 +5,20 @@ BASE_PATH=$(cd "$(dirname $0)"; pwd) TOP_PATH="${BASE_PATH}/../../.." # build mindspore-lite arm64 cd ${TOP_PATH} -bash build.sh -I arm64 -COMPILE_RET=$? +#bash build.sh -I arm64 +#COMPILE_RET=$? -if [[ "${COMPILE_RET}" -ne 0 ]]; then - echo "---------------- mindspore lite: build failed ----------------" - exit -fi +#if [[ "${COMPILE_RET}" -ne 0 ]]; then +# echo "---------------- mindspore lite: build failed ----------------" +# exit +#fi # copy arm64 so cd ${TOP_PATH}/output/ -rm -rf MSLite-0.7.0-linux_arm64 -tar -zxvf MSLite-0.7.0-linux_arm64.tar.gz +rm -rf mindspore-lite-0.6.0 +tar -zxvf mindspore-lite-0.6.0-runtime-arm64-cpu.tar.gz mkdir -p ${BASE_PATH}/lib/ -cp ${TOP_PATH}/output/MSLite-0.7.0-linux_arm64/lib/libmindspore-lite.so ${BASE_PATH}/lib/ +cp ${TOP_PATH}/output/mindspore-lite-0.6.0/lib/libmindspore-lite.so ${BASE_PATH}/lib/ cp ${ANDROID_NDK}/toolchains/llvm/prebuilt/linux-x86_64/sysroot/usr/lib/aarch64-linux-android/libc++_shared.so ${BASE_PATH}/lib/ # build jni so diff --git a/mindspore/lite/java/native/CMakeLists.txt b/mindspore/lite/java/native/CMakeLists.txt index 30c13591a8f..f9336c3a115 100644 --- a/mindspore/lite/java/native/CMakeLists.txt +++ b/mindspore/lite/java/native/CMakeLists.txt @@ -1,6 +1,12 @@ cmake_minimum_required(VERSION 3.14) project (Lite-java) +set(MS_VERSION_MAJOY 0) +set(MS_VERSION_MINOR 6) +set(MS_VERSION_REVISION 0) +set(CMAKE_C_FLAGS "${CMAKE_C_FLAGS} -DMS_VERSION_MAJOY=${MS_VERSION_MAJOY} -DMS_VERSION_MINOR=${MS_VERSION_MINOR} -DMS_VERSION_REVISION=${MS_VERSION_REVISION}") +set(CMAKE_CXX_FLAGS "${CMAKE_CXX_FLAGS} -DMS_VERSION_MAJOY=${MS_VERSION_MAJOY} -DMS_VERSION_MINOR=${MS_VERSION_MINOR} -DMS_VERSION_REVISION=${MS_VERSION_REVISION}") + include_directories(${CMAKE_CURRENT_SOURCE_DIR}/) include_directories(${CMAKE_CURRENT_SOURCE_DIR}/../../../lite/) include_directories(${CMAKE_CURRENT_SOURCE_DIR}/../../../core/) @@ -10,6 +16,7 @@ link_directories(${CMAKE_CURRENT_SOURCE_DIR}/../lib) add_library(mindspore-lite-jni SHARED ${CMAKE_CURRENT_SOURCE_DIR}/common/jni_utils.cpp ${CMAKE_CURRENT_SOURCE_DIR}/runtime/model.cpp + ${CMAKE_CURRENT_SOURCE_DIR}/runtime/version.cpp ${CMAKE_CURRENT_SOURCE_DIR}/runtime/context.cpp ${CMAKE_CURRENT_SOURCE_DIR}/runtime/ms_tensor.cpp ${CMAKE_CURRENT_SOURCE_DIR}/runtime/lite_session.cpp diff --git a/mindspore/lite/java/native/runtime/context.cpp b/mindspore/lite/java/native/runtime/context.cpp index 9b5576d34f1..eaedc4d26aa 100644 --- a/mindspore/lite/java/native/runtime/context.cpp +++ b/mindspore/lite/java/native/runtime/context.cpp @@ -25,7 +25,7 @@ extern "C" JNIEXPORT jlong JNICALL Java_com_mindspore_lite_context_Context_creat jint cpu_bind_mode) { auto *context = new (std::nothrow) mindspore::lite::Context(); if (context == nullptr) { - MS_LOG(ERROR) << "new Context fail!"; + MS_LOGE("new Context fail!"); return (jlong)context; } switch (device_type) {