-
Notifications
You must be signed in to change notification settings - Fork 0
/
CMakeLists.txt
46 lines (39 loc) · 1.36 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
if (WIN32)
cmake_minimum_required(VERSION 3.12)
elseif (APPLE)
cmake_minimum_required(VERSION 3.17)
elseif (UNIX)
cmake_minimum_required(VERSION 3.16)
endif ()
project(OcrLibTest)
set(CMAKE_CXX_STANDARD 11)
add_definitions(-DUNICODE -D_UNICODE)
# import OcrLib
include(${CMAKE_CURRENT_SOURCE_DIR}/OcrLib/OcrLibWrapper.cmake)
find_package(OcrLib REQUIRED)
if (OcrLib_FOUND)
message(STATUS "OcrLib_LIBS: ${OcrLib_LIBS}")
message(STATUS "OcrLib_INCLUDE_DIRS: ${OcrLib_INCLUDE_DIRS}")
else ()
message(FATAL_ERROR "OcrLib Not Found!")
endif (OcrLib_FOUND)
# End Of Ocr CLib
# Test CLib Program
include_directories(${CMAKE_CURRENT_SOURCE_DIR}/include)
set(TESTSRC src/maintest.cpp)
add_executable(OcrLibTest ${TESTSRC})
include_directories(${OpenCV_INCLUDE_DIRS})
target_link_libraries(OcrLibTest ${OcrLib_LIBS})
# Install exe
install(TARGETS OcrLibTest EXPORT OcrLibTest)
# Install test script
if (WIN32)
file(GLOB TEST_SCRIPT ${CMAKE_CURRENT_SOURCE_DIR}/resource/*.bat)
else ()
file(GLOB TEST_SCRIPT ${CMAKE_CURRENT_SOURCE_DIR}/resource/*.sh)
endif ()
install(FILES ${TEST_SCRIPT} DESTINATION ${CMAKE_INSTALL_PREFIX})
# Install images dir
install(DIRECTORY ${CMAKE_CURRENT_SOURCE_DIR}/resource/images DESTINATION ${CMAKE_INSTALL_PREFIX})
# Install models dir
install(DIRECTORY ${CMAKE_CURRENT_SOURCE_DIR}/resource/models DESTINATION ${CMAKE_INSTALL_PREFIX})