-
Notifications
You must be signed in to change notification settings - Fork 6
/
CMakeLists.txt
39 lines (34 loc) · 1.71 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
cmake_minimum_required(VERSION 3.2)
project(Tesseract DESCRIPTION "libtesseract")
set(CMAKE_CXX_STANDARD 17)
add_library(${PROJECT_NAME} SHARED main.cpp exports.cpp)
IF(WIN32)
set(CMAKE_CXX_STANDARD_LIBRARIES "-static-libgcc -Wl,-Bstatic -lstdc++ -lpthread -Wl,-Bdynamic ${CMAKE_CXX_STANDARD_LIBRARIES}")
target_link_options(${PROJECT_NAME} PRIVATE -s)
target_link_libraries(${PROJECT_NAME}
-Wl,--whole-archive libtesseract.a -Wl,--no-whole-archive libleptonica.a
)
ELSEIF(APPLE)
set(CMAKE_OSX_DEPLOYMENT_TARGET "10.13" CACHE STRING "Minimum OS X deployment version" FORCE)
target_include_directories(${PROJECT_NAME} PUBLIC /usr/local/include/)
target_compile_options(${PROJECT_NAME} PRIVATE -fvisibility=hidden)
target_link_options(${PROJECT_NAME} PRIVATE -s)
target_link_libraries(${PROJECT_NAME}
"-framework accelerate"
)
target_link_libraries(${PROJECT_NAME} -force_load /usr/local/lib/libtesseract.a /usr/local/lib/libleptonica.a)
ELSE()
target_include_directories(${PROJECT_NAME} PRIVATE /usr/local/include/)
target_compile_options(${PROJECT_NAME} PRIVATE -fvisibility=hidden)
target_link_options(${PROJECT_NAME} PRIVATE -s)
target_link_libraries(${PROJECT_NAME}
-Wl,--whole-archive /usr/local/lib/libtesseract.a -Wl,--no-whole-archive /usr/local/lib/libleptonica.a
)
ENDIF()
if(CMAKE_SIZEOF_VOID_P EQUAL 8)
set_target_properties(${PROJECT_NAME} PROPERTIES PREFIX "lib")
set_target_properties(${PROJECT_NAME} PROPERTIES OUTPUT_NAME "tesseract64")
ELSEIF(CMAKE_SIZEOF_VOID_P EQUAL 4)
set_target_properties(${PROJECT_NAME} PROPERTIES PREFIX "lib")
set_target_properties(${PROJECT_NAME} PROPERTIES OUTPUT_NAME "tesseract32")
ENDIF()