-
Notifications
You must be signed in to change notification settings - Fork 0
/
CMakelists.txt
51 lines (43 loc) · 1.78 KB
/
CMakelists.txt
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
if (WIN32)
cmake_minimum_required(VERSION 3.12)
elseif (APPLE)
cmake_minimum_required(VERSION 3.17)
elseif (UNIX)
cmake_minimum_required(VERSION 3.17)
endif ()
project(PaddleOcrOnnx)
set(CMAKE_CXX_STANDARD 11)
add_definitions(-DUNICODE -D_UNICODE)
if (CMAKE_BUILD_TYPE STREQUAL "Debug")
add_definitions("-Wall -g -O0")
else ()
add_definitions("-Wall")
endif ()
# OnnxRuntime
include_directories(${CMAKE_CURRENT_SOURCE_DIR}/third_party/onnxruntime/include)
link_libraries(${CMAKE_CURRENT_SOURCE_DIR}/third_party/onnxruntime/lib/libonnxruntime.dylib)
# Gflags
include_directories(${CMAKE_CURRENT_SOURCE_DIR}/third_party/gflags/include/)
link_directories(${CMAKE_CURRENT_SOURCE_DIR}/third_party/gflags/lib/)
# OpenCV
find_package(OpenCV REQUIRED PATHS ${CMAKE_CURRENT_SOURCE_DIR}/third_party/opencv/share/OpenCV NO_DEFAULT_PATH)
include_directories(${OpenCV_INCLUDE_DIRS})
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)
# Auto log
include_directories(${CMAKE_CURRENT_SOURCE_DIR}/third_party/AutoLog)
# Glog
include_directories(${CMAKE_CURRENT_SOURCE_DIR}/third_party/glog/include/)
link_directories(${CMAKE_CURRENT_SOURCE_DIR}/third_party/glog/lib/)
# Source
include_directories(${CMAKE_SOURCE_DIR}/)
AUX_SOURCE_DIRECTORY(./src SRCS)
add_executable(PaddleOcrOnnx ${SRCS})
target_link_libraries(PaddleOcrOnnx ${OpenCV_LIBS})
target_link_libraries(PaddleOcrOnnx ${CMAKE_CURRENT_SOURCE_DIR}/third_party/onnxruntime/lib/libonnxruntime.dylib)
target_link_libraries(PaddleOcrOnnx ${CMAKE_CURRENT_SOURCE_DIR}/third_party/gflags/lib/libgflags.a)
target_link_libraries(PaddleOcrOnnx ${CMAKE_CURRENT_SOURCE_DIR}/third_party/glog/lib/libglog.a)