forked from mindspore-Ecosystem/mindspore
fix bug in java api
This commit is contained in:
parent
6782325bfd
commit
797296177d
|
@ -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
|
||||
|
|
|
@ -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
|
||||
|
|
|
@ -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) {
|
||||
|
|
Loading…
Reference in New Issue