6.6.0 - 内置模块重写; 新增部分模块及方法; 修复高版本安卓系统兼容问题; 优化文件管理器及打包功能体验
This commit is contained in:
69
libs/rapidocr/src/main/cpp/CMakeLists.txt
Normal file
69
libs/rapidocr/src/main/cpp/CMakeLists.txt
Normal file
@@ -0,0 +1,69 @@
|
||||
cmake_minimum_required(VERSION 3.22.1)
|
||||
|
||||
project(RapidOcr)
|
||||
|
||||
# OnnxRuntime
|
||||
|
||||
include(${CMAKE_CURRENT_SOURCE_DIR}/../onnxruntime-shared/OnnxRuntimeWrapper.cmake)
|
||||
find_package(OnnxRuntime REQUIRED)
|
||||
if (OnnxRuntime_FOUND)
|
||||
message(STATUS "OnnxRuntime_LIBS: ${OnnxRuntime_LIBS}")
|
||||
message(STATUS "OnnxRuntime_INCLUDE_DIRS: ${OnnxRuntime_INCLUDE_DIRS}")
|
||||
else ()
|
||||
message(FATAL_ERROR "onnxruntime Not Found!")
|
||||
endif (OnnxRuntime_FOUND)
|
||||
|
||||
## opencv 库
|
||||
|
||||
set(OpenCV_DIR "${CMAKE_SOURCE_DIR}/../../sdk/native/jni")
|
||||
find_package(OpenCV REQUIRED)
|
||||
if (OpenCV_FOUND)
|
||||
message(STATUS "OpenCV_LIBS: ${OpenCV_LIBS}")
|
||||
message(STATUS "OpenCV_INCLUDE_DIRS: ${OpenCV_INCLUDE_DIRS}")
|
||||
else ()
|
||||
message(FATAL_ERROR "opencv Not Found!")
|
||||
endif (OpenCV_FOUND)
|
||||
|
||||
# openmp
|
||||
|
||||
set(CMAKE_C_FLAGS "${CMAKE_C_FLAGS} -fopenmp")
|
||||
set(CMAKE_CXX_FLAGS "${CMAKE_CXX_FLAGS} -fopenmp")
|
||||
set(CMAKE_SHARED_LINKER_FLAGS "${CMAKE_SHARED_LINKER_FLAGS} -fopenmp")
|
||||
|
||||
if (DEFINED ANDROID_NDK_MAJOR AND ${ANDROID_NDK_MAJOR} GREATER 20)
|
||||
set(CMAKE_SHARED_LINKER_FLAGS "${CMAKE_SHARED_LINKER_FLAGS} -static-openmp")
|
||||
endif ()
|
||||
|
||||
set(CMAKE_C_FLAGS "${CMAKE_C_FLAGS} -fomit-frame-pointer -fstrict-aliasing -ffast-math")
|
||||
set(CMAKE_CXX_FLAGS "${CMAKE_CXX_FLAGS} -fomit-frame-pointer -fstrict-aliasing -ffast-math")
|
||||
|
||||
set(CMAKE_C_FLAGS "${CMAKE_C_FLAGS} -fvisibility=hidden")
|
||||
set(CMAKE_CXX_FLAGS "${CMAKE_CXX_FLAGS} -fvisibility=hidden -fvisibility-inlines-hidden")
|
||||
|
||||
# disable rtti and exceptions
|
||||
# set(CMAKE_CXX_FLAGS "${CMAKE_CXX_FLAGS} -fno-rtti -fno-exceptions")
|
||||
|
||||
include_directories(include)
|
||||
file(GLOB OCR_SRC src/*.cpp)
|
||||
set(OCR_COMPILE_CODE ${OCR_SRC})
|
||||
|
||||
add_library(RapidOcr SHARED ${OCR_COMPILE_CODE})
|
||||
|
||||
find_library( # Sets the name of the path variable.
|
||||
log-lib
|
||||
log)
|
||||
|
||||
find_library(
|
||||
android-lib
|
||||
android
|
||||
)
|
||||
|
||||
target_link_libraries(
|
||||
RapidOcr
|
||||
${OnnxRuntime_LIBS}
|
||||
${OpenCV_LIBS}
|
||||
android
|
||||
z
|
||||
${log-lib}
|
||||
${android-lib}
|
||||
jnigraphics)
|
||||
Reference in New Issue
Block a user