From d60c9e7c7e9ce3678f5d583a14f76fa9760fe8ae Mon Sep 17 00:00:00 2001 From: hjchen2 Date: Fri, 12 Oct 2018 10:58:48 +0000 Subject: [PATCH] Fix compile options and revert jni cpp --- CMakeLists.txt | 3 ++- src/jni/paddle_mobile_jni.cpp | 4 ++-- tools/pre-commit.hooks/cpplint.hook | 2 +- 3 files changed, 5 insertions(+), 4 deletions(-) diff --git a/CMakeLists.txt b/CMakeLists.txt index 8006cb7e3e..3f9fbcbc18 100644 --- a/CMakeLists.txt +++ b/CMakeLists.txt @@ -5,6 +5,7 @@ project(paddle-mobile) option(CPU "armv7 with neon support" ON) option(MALI_GPU "mali gpu support" OFF) option(FPGA "fpga support" OFF) + option(USE_OPENMP "openmp support" OFF) option(DEBUGING "enable debug mode" ON) option(USE_EXCEPTION "use std exception" OFF) @@ -15,7 +16,7 @@ file(GLOB_RECURSE PADDLE_MOBILE_H src/*.h) include_directories(src/) set(CMAKE_BUILD_TYPE Release) -add_definitions(-O3 -s -DNDEBUG) +set(CMAKE_CXX_FLAGS "-O3 -s -DNDEBUG ${CMAKE_CXX_FLAGS}") if(IS_IOS) set(CMAKE_CXX_FLAGS "-mfpu=neon -marm -fobjc-abi-version=2 -fobjc-arc \ -std=gnu++11 -stdlib=libc++ -isysroot ${CMAKE_OSX_SYSROOT} ${CMAKE_CXX_FLAGS}") diff --git a/src/jni/paddle_mobile_jni.cpp b/src/jni/paddle_mobile_jni.cpp index 8f3350e174..56d522b156 100644 --- a/src/jni/paddle_mobile_jni.cpp +++ b/src/jni/paddle_mobile_jni.cpp @@ -84,14 +84,14 @@ Java_com_baidu_paddle_PML_loadnlp(JNIEnv *env, jclass thiz, jstring modelPath) { #ifdef ENABLE_EXCEPTION try { isLoadOk = getPaddleMobileInstance()->Load( - jstring2cppstring(env, modelPath), optimize, false, true); + jstring2cppstring(env, modelPath), optimize, false, 1, true); } catch (paddle_mobile::PaddleMobileException &e) { ANDROIDLOGE("jni got an PaddleMobileException! ", e.what()); isLoadOk = false; } #else isLoadOk = getPaddleMobileInstance()->Load(jstring2cppstring(env, modelPath), - optimize, false, true); + optimize, false, 1, true); #endif return static_cast(isLoadOk); } diff --git a/tools/pre-commit.hooks/cpplint.hook b/tools/pre-commit.hooks/cpplint.hook index 78ca3cfcdd..c3e28eacd1 100644 --- a/tools/pre-commit.hooks/cpplint.hook +++ b/tools/pre-commit.hooks/cpplint.hook @@ -5,7 +5,7 @@ TOTAL_ERRORS=0 # The trick to remove deleted files: https://stackoverflow.com/a/2413151 for file in $(git diff --cached --name-status | awk '$1 != "D" {print $2}' | \ grep -v ".pb.cpp" | grep -v ".pb.h" | grep -v ".pb-c.h" | grep -v ".pb-c.c" | \ - grep -v "protobuf-c.h" | grep -v "protobuf-c.c"); do + grep -v "protobuf-c.h" | grep -v "protobuf-c.c" | grep -v "jni.cpp"); do cpplint $file; TOTAL_ERRORS=$(expr $TOTAL_ERRORS + $?); done -- GitLab