forked from amahule/CoolReader
-
Notifications
You must be signed in to change notification settings - Fork 1
/
CMakeLists.txt
255 lines (224 loc) · 8.22 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
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
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
143
144
145
146
147
148
149
150
151
152
153
154
155
156
157
158
159
160
161
162
163
164
165
166
167
168
169
170
171
172
173
174
175
176
177
178
179
180
181
182
183
184
185
186
187
188
189
190
191
192
193
194
195
196
197
198
199
200
201
202
203
204
205
206
207
208
209
210
211
212
213
214
215
216
217
218
219
220
221
222
223
224
225
226
227
228
229
230
231
232
233
234
235
236
237
238
239
240
241
242
243
244
245
246
247
248
249
250
251
252
253
254
255
PROJECT(cr3)
cmake_minimum_required(VERSION 2.6)
#INCLUDE(CPack)
IF(NOT CMAKE_BUILD_TYPE)
SET(CMAKE_BUILD_TYPE Release CACHE STRING
"Choose the type of build, options are: None Debug Release RelWithDebInfo MinSizeRel."
FORCE)
ENDIF(NOT CMAKE_BUILD_TYPE)
IF(${CMAKE_BUILD_TYPE} STREQUAL Debug)
ADD_DEFINITIONS( -D_DEBUG=1 -DDEBUG=1 )
ELSE()
ADD_DEFINITIONS( -DNDEBUG=1 )
ENDIF(${CMAKE_BUILD_TYPE} STREQUAL Debug)
if (NOT DEFINED GUI)
SET(GUI QT)
message("GUI type is not specified!")
message("Using ${GUI} as default")
message("Add cmake parameter -D GUI={QT|WX|CRGUI_XCB|CRGUI_NANOX|CRGUI_JINKE_PLUGIN|CRGUI_WIN32|FB2PROPS} to use another GUI frontend")
else ()
message("Using GUI frontend ${GUI}")
endif (NOT DEFINED GUI)
# Determines whether to use external app EDICT for dictionary
if (NOT DEFINED USE_EXTERNAL_EDICT_DICTIONARY)
SET(USE_EXTERNAL_EDICT_DICTIONARY 0)
else()
SET(USE_EXTERNAL_EDICT_DICTIONARY ${USE_EXTERNAL_EDICT_DICTIONARY})
endif (NOT DEFINED USE_EXTERNAL_EDICT_DICTIONARY)
message("using USE_EXTERNAL_EDICT_DICTIONARY=${USE_EXTERNAL_EDICT_DICTIONARY}")
ADD_DEFINITIONS( -DUSE_EXTERNAL_EDICT_DICTIONARY=${USE_EXTERNAL_EDICT_DICTIONARY} )
# Document buffer cache / compression settings
#whether to compress data
if (NOT DEFINED DOC_DATA_COMPRESSION_LEVEL)
message("-D DOC_DATA_COMPRESSION_LEVEL=0|1|2|3|4|5 parameter is not defined: will use default value")
SET(DOC_DATA_COMPRESSION_LEVEL 1)
else()
SET(DOC_DATA_COMPRESSION_LEVEL ${DOC_DATA_COMPRESSION_LEVEL})
endif (NOT DEFINED DOC_DATA_COMPRESSION_LEVEL)
message("using TEXT_COMPRESSION_LEVEL=${DOC_DATA_COMPRESSION_LEVEL}")
ADD_DEFINITIONS( -DDOC_DATA_COMPRESSION_LEVEL=${DOC_DATA_COMPRESSION_LEVEL} )
# Total RAM buffers size for document
if (NOT DEFINED DOC_BUFFER_SIZE)
message("-D DOC_BUFFER_SIZE=N parameter is not defined: will use default value")
SET(DOC_BUFFER_SIZE 0x400000)
else()
SET(DOC_BUFFER_SIZE ${DOC_BUFFER_SIZE})
endif (NOT DEFINED DOC_BUFFER_SIZE)
message("using DOC_BUFFER_SIZE=${DOC_BUFFER_SIZE}")
ADD_DEFINITIONS( -DDOC_BUFFER_SIZE=${DOC_BUFFER_SIZE} )
# big page margins support
if (NOT DEFINED BIG_PAGE_MARGINS)
SET(BIG_PAGE_MARGINS 0)
else()
SET(BIG_PAGE_MARGINS ${BIG_PAGE_MARGINS})
endif (NOT DEFINED BIG_PAGE_MARGINS)
ADD_DEFINITIONS( -DBIG_PAGE_MARGINS=${BIG_PAGE_MARGINS} )
if ( WIN32 )
ADD_DEFINITIONS( -DWIN32=1 -D_WIN32=1 -DCR_EMULATE_GETTEXT=1 )
else()
ADD_DEFINITIONS( -DLINUX=1 -D_LINUX=1 )
endif( WIN32 )
if (NOT DEFINED GRAY_BACKBUFFER_BITS)
SET(GRAY_BACKBUFFER_BITS 2)
endif (NOT DEFINED GRAY_BACKBUFFER_BITS)
if (NOT DEFINED ENABLE_DBUS_VIEWER_EVENTS)
SET(ENABLE_DBUS_VIEWER_EVENTS 0)
endif (NOT DEFINED ENABLE_DBUS_VIEWER_EVENTS)
SET (CRGUI_DEFS -DCOLOR_BACKBUFFER=0 -DLDOM_USE_OWN_MEM_MAN=0 -DGRAY_BACKBUFFER_BITS=${GRAY_BACKBUFFER_BITS}
-DENABLE_DBUS_VIEWER_EVENTS=${ENABLE_DBUS_VIEWER_EVENTS})
SET (DESKTOP_DEFS -DCOLOR_BACKBUFFER=1 -DLDOM_USE_OWN_MEM_MAN=1 -DUSE_FREETYPE=1 )
if( ${GUI} STREQUAL QT )
FIND_PACKAGE( Qt4 REQUIRED )
INCLUDE(${QT_USE_FILE})
endif( ${GUI} STREQUAL QT )
if (DEFINED USE_QT_ZLIB)
SET(ZLIB_INCLUDE_DIR ${QT_INCLUDE_DIR}/../src/3rdparty/zlib)
message("Using QT ZLIB ${USE_QT_ZLIB} include dir: ${ZLIB_INCLUDE_DIR}")
# SET(ZLIB_LIBRARIES "")
else()
if (NOT WIN32 AND NOT DEFINED USE_STATIC_ZLIB)
FIND_PACKAGE(ZLIB)
endif (NOT WIN32 AND NOT DEFINED USE_STATIC_ZLIB)
if (NOT ZLIB_FOUND)
message("System ZLIB not found, will build local one")
#to disable #include <qconfig.h>
ADD_DEFINITIONS(-DCR3_PATCH=1)
ADD_SUBDIRECTORY(thirdparty/zlib)
SET(ZLIB_INCLUDE_DIR ${CMAKE_CURRENT_SOURCE_DIR}/thirdparty/zlib)
SET(ZLIB_LIBRARIES z)
endif (NOT ZLIB_FOUND)
endif(DEFINED USE_QT_ZLIB)
if ( NOT ${GUI} STREQUAL FB2PROPS )
if (NOT WIN32)
FIND_PACKAGE(PNG)
endif (NOT WIN32)
if (NOT PNG_FOUND)
message("System LIBPNG not found, will build local one")
#to disable #include <qconfig.h>
ADD_DEFINITIONS(-DCR3_PATCH=1)
INCLUDE_DIRECTORIES(${ZLIB_INCLUDE_DIR})
ADD_SUBDIRECTORY(thirdparty/libpng)
SET(PNG_INCLUDE_DIR ${CMAKE_CURRENT_SOURCE_DIR}/thirdparty/libpng)
SET(PNG_LIBRARIES png)
endif (NOT PNG_FOUND)
if (NOT WIN32)
FIND_PACKAGE(JPEG)
endif (NOT WIN32)
if (NOT JPEG_FOUND)
message("System LIBJPEG not found, will build local one")
ADD_SUBDIRECTORY(thirdparty/libjpeg)
SET(JPEG_INCLUDE_DIR ${CMAKE_CURRENT_SOURCE_DIR}/thirdparty/libjpeg)
SET(JPEG_LIBRARIES jpeg)
endif (NOT JPEG_FOUND)
if (NOT WIN32)
FIND_PACKAGE(Freetype)
endif (NOT WIN32)
if (NOT FREETYPE_FOUND)
message("System FREETYPE not found, will build local one")
ADD_SUBDIRECTORY(thirdparty/freetype)
SET(FREETYPE_INCLUDE_DIRS ${CMAKE_CURRENT_SOURCE_DIR}/thirdparty/freetype/include)
SET(FREETYPE_LIBRARIES freetype)
endif (NOT FREETYPE_FOUND)
message("Will build patched LIBCHM library")
ADD_SUBDIRECTORY(thirdparty/chmlib)
SET(CHM_INCLUDE_DIR ${CMAKE_CURRENT_SOURCE_DIR}/thirdparty/chmlib)
SET(CHM_LIBRARIES chmlib)
ADD_DEFINITIONS(-DCHM_SUPPORT_ENABLED=1)
if (ENABLE_ANTIWORD)
message("Will build patched ANTIWORD library")
ADD_DEFINITIONS(-DCR3_ANTIWORD_PATCH=1)
ADD_SUBDIRECTORY(thirdparty/antiword)
SET(ANTIWORD_INCLUDE_DIR ${CMAKE_CURRENT_SOURCE_DIR}/thirdparty/antiword)
SET(ANTIWORD_LIBRARIES antiword)
ADD_DEFINITIONS(-DENABLE_ANTIWORD=1)
INCLUDE_DIRECTORIES( ${ANTIWORD_INCLUDE_DIR} )
else()
ADD_DEFINITIONS(-DENABLE_ANTIWORD=0)
endif(ENABLE_ANTIWORD)
endif ( NOT ${GUI} STREQUAL FB2PROPS )
INCLUDE_DIRECTORIES(
${PNG_INCLUDE_DIR}
${JPEG_INCLUDE_DIR}
${ZLIB_INCLUDE_DIR}
${FREETYPE_INCLUDE_DIRS}
${CHM_INCLUDE_DIRS}
)
if ( ${GUI} STREQUAL FB2PROPS )
SET(STD_LIBS
${ZLIB_LIBRARIES}
)
else()
SET(STD_LIBS
${JPEG_LIBRARIES}
${FREETYPE_LIBRARIES}
${PNG_LIBRARIES}
${ZLIB_LIBRARIES}
${CHM_LIBRARIES}
)
include_directories(${FT_INCLUDE_PATH})
endif ( ${GUI} STREQUAL FB2PROPS )
include_directories(crengine/include)
if ( NOT ${GUI} STREQUAL FB2PROPS )
include_directories(tinydict)
message("Will make tinydict library - .dict format support")
ADD_SUBDIRECTORY(tinydict)
endif ( NOT ${GUI} STREQUAL FB2PROPS )
include(FindPkgConfig)
if ( ${GUI} STREQUAL CRGUI_XCB )
message("Will make CR3GUI for XCB")
ADD_DEFINITIONS( -DCR_USE_XCB=1 ${CRGUI_DEFS} )
ADD_DEFINITIONS( -DCR_INTERNAL_PAGE_ORIENTATION=0 ${CRGUI_DEFS} )
message("Freetype include dir: ${FREETYPE_INCLUDE_DIRS}")
ADD_SUBDIRECTORY(crengine)
ADD_SUBDIRECTORY(cr3gui)
elseif ( ${GUI} STREQUAL CRGUI_NANOX )
message("Will make CR3GUI for NanoX")
if (ENABLE_DBUS_VIEWER_EVENTS)
message("Will handle DBUS messages")
pkg_check_modules( DBUS REQUIRED dbus-1 )
message("dbus include dir: ${DBUS_INCLUDE_DIRS} path ${DBUS_INCLUDE_PATH}")
include_directories(${DBUS_INCLUDE_DIRS})
endif (ENABLE_DBUS_VIEWER_EVENTS)
ADD_DEFINITIONS( -DLBOOK=1 -DWITH_JINKE=1 -DCR_USE_JINKE=1
-DJINKE_VIEWER ${CRGUI_DEFS} -DENABLE_UPDATE_MODE_SETTING=1 )
ADD_SUBDIRECTORY(crengine)
ADD_SUBDIRECTORY(cr3gui)
elseif ( ${GUI} STREQUAL CRGUI_JINKE_PLUGIN )
message("Will make CR3GUI plugin for Jinke Viewer")
ADD_DEFINITIONS( -DLBOOK=1 -DWITH_JINKE=1 -DWITH_JINKE_APP=1
-DCR_USE_JINKE=1 ${CRGUI_DEFS}
-DENABLE_UPDATE_MODE_SETTING=1 )
ADD_SUBDIRECTORY(crengine)
ADD_SUBDIRECTORY(cr3gui)
elseif ( ${GUI} STREQUAL FB2PROPS )
message("Will make LIBFB2PROPS plugin for Jinke Bookshelf")
ADD_DEFINITIONS( -DLBOOK=1 -DWITH_JINKE=1 -DCR_USE_JINKE=1 -DBUILD_LITE=1 ${CRGUI_DEFS} )
ADD_SUBDIRECTORY(crengine)
ADD_SUBDIRECTORY(fb2props)
elseif ( ${GUI} STREQUAL CRGUI_WIN32 )
message("Will make CR3GUI for Win32")
ADD_DEFINITIONS( ${CRGUI_DEFS} )
ADD_SUBDIRECTORY(crengine)
ADD_SUBDIRECTORY(cr3gui)
elseif ( ${GUI} STREQUAL QT )
message("Will make CR3/QT")
ADD_DEFINITIONS( ${DESKTOP_DEFS} )
ADD_SUBDIRECTORY(crengine)
ADD_SUBDIRECTORY(cr3qt)
elseif ( ${GUI} STREQUAL WX )
message("Will make CR3/WX")
ADD_DEFINITIONS( ${DESKTOP_DEFS} -DCR_WX_SUPPORT=1 )
SET(wxWidgets_USE_LIBS base core )
FIND_PACKAGE(wxWidgets)
IF (wxWidgets_FOUND)
INCLUDE(${wxWidgets_USE_FILE})
include_directories( ${wxWidgets_INCLUDE_DIRS} )
message( "WX include: ${wxWidgets_INCLUDE_DIRS}" )
ELSE (wxWidgets_FOUND)
message("wxWidgets library not found!")
ENDIF (wxWidgets_FOUND)
ADD_SUBDIRECTORY(crengine)
ADD_SUBDIRECTORY(cr3wx)
else ( ${GUI} STREQUAL CRGUI_XCB )
message("Unknown GUI type ${GUI}")
endif ( ${GUI} STREQUAL CRGUI_XCB )