blob: 1dca15d3f9a69174f155a67ab695d829a76a1edd (
plain)
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
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
|
#
# leptonica
#
################################################################################
########################################
# SHARED LIBRARY leptonica
########################################
file(GLOB hdr "*.h")
file(GLOB src "*.c")
if (MSVC)
set_source_files_properties(${src} PROPERTIES LANGUAGE CXX)
endif()
string(REPLACE "-O3" "-O2" CMAKE_C_FLAGS_RELEASE "${CMAKE_C_FLAGS_RELEASE}")
add_library (leptonica ${src} ${hdr})
set_target_properties (leptonica PROPERTIES VERSION ${VERSION_PLAIN})
set_target_properties (leptonica PROPERTIES SOVERSION 5.4.0)
if (WIN32)
set_target_properties (leptonica PROPERTIES OUTPUT_NAME leptonica-${VERSION_PLAIN})
set_target_properties (leptonica PROPERTIES DEBUG_OUTPUT_NAME leptonica-${VERSION_PLAIN}d)
else()
set_target_properties (leptonica PROPERTIES OUTPUT_NAME leptonica)
set_target_properties (leptonica PROPERTIES DEBUG_OUTPUT_NAME leptonica)
endif()
if (BUILD_SHARED_LIBS)
target_compile_definitions (leptonica PRIVATE -DLIBLEPT_EXPORTS)
endif()
if (GIF_LIBRARIES)
target_include_directories (leptonica PUBLIC ${GIF_INCLUDE_DIR})
target_link_libraries (leptonica ${GIF_LIBRARIES})
endif()
if (JPEG_LIBRARIES)
target_include_directories (leptonica PUBLIC ${JPEG_INCLUDE_DIR})
target_link_libraries (leptonica ${JPEG_LIBRARIES})
endif()
if (JP2K_FOUND)
target_include_directories (leptonica PUBLIC ${JP2K_INCLUDE_DIRS})
target_link_libraries (leptonica ${JP2K_LIBRARIES})
endif()
if (PNG_LIBRARIES)
target_include_directories (leptonica PUBLIC ${PNG_INCLUDE_DIRS})
target_link_libraries (leptonica ${PNG_LIBRARIES})
endif()
if (TIFF_LIBRARIES)
target_include_directories (leptonica PUBLIC ${TIFF_INCLUDE_DIR})
target_link_libraries (leptonica ${TIFF_LIBRARIES})
endif()
if (WEBP_FOUND)
target_include_directories (leptonica PUBLIC ${WEBP_INCLUDE_DIRS})
target_link_libraries (leptonica ${WEBP_LIBRARIES})
endif()
if (ZLIB_LIBRARIES)
target_include_directories (leptonica PUBLIC ${ZLIB_INCLUDE_DIRS})
target_link_libraries (leptonica ${ZLIB_LIBRARIES})
endif()
if (UNIX)
target_link_libraries (leptonica m)
set(lib ${CMAKE_SHARED_LIBRARY_PREFIX})
set(dll ${CMAKE_SHARED_LIBRARY_SUFFIX})
set(old_target ${lib}lept${dll})
if (SYM_LINK)
add_custom_target(lept ALL
${CMAKE_COMMAND} -E create_symlink "$<TARGET_FILE:leptonica>" ${old_target}
DEPENDS ${PROJECT_NAME}
COMMENT "Creating lept symlink")
install(FILES ${CMAKE_BINARY_DIR}/src/${old_target} DESTINATION lib)
endif(SYM_LINK)
endif()
if (NOT SW_BUILD)
export(TARGETS leptonica FILE ${CMAKE_BINARY_DIR}/LeptonicaTargets.cmake)
else()
target_link_libraries (leptonica
org.sw.demo.gif
org.sw.demo.jpeg
org.sw.demo.glennrp.png
org.sw.demo.tiff
org.sw.demo.webmproject.webp
org.sw.demo.uclouvain.openjpeg.openjp2
)
file(WRITE ${CMAKE_BINARY_DIR}/LeptonicaTargets.cmake "include(${CMAKE_BINARY_DIR}/cppan.cmake)\n")
export(TARGETS leptonica APPEND FILE ${CMAKE_BINARY_DIR}/LeptonicaTargets.cmake)
endif()
install(TARGETS leptonica EXPORT LeptonicaTargets RUNTIME DESTINATION bin LIBRARY DESTINATION lib ARCHIVE DESTINATION lib)
install(EXPORT LeptonicaTargets DESTINATION lib/cmake)
install(FILES
${hdr}
${CMAKE_BINARY_DIR}/src/endianness.h
DESTINATION include/leptonica)
################################################################################
|