-
Notifications
You must be signed in to change notification settings - Fork 100
/
CMakeLists.txt
474 lines (413 loc) · 17.5 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
256
257
258
259
260
261
262
263
264
265
266
267
268
269
270
271
272
273
274
275
276
277
278
279
280
281
282
283
284
285
286
287
288
289
290
291
292
293
294
295
296
297
298
299
300
301
302
303
304
305
306
307
308
309
310
311
312
313
314
315
316
317
318
319
320
321
322
323
324
325
326
327
328
329
330
331
332
333
334
335
336
337
338
339
340
341
342
343
344
345
346
347
348
349
350
351
352
353
354
355
356
357
358
359
360
361
362
363
364
365
366
367
368
369
370
371
372
373
374
375
376
377
378
379
380
381
382
383
384
385
386
387
388
389
390
391
392
393
394
395
396
397
398
399
400
401
402
403
404
405
406
407
408
409
410
411
412
413
414
415
416
417
418
419
420
421
422
423
424
425
426
427
428
429
430
431
432
433
434
435
436
437
438
439
440
441
442
443
444
445
446
447
448
449
450
451
452
453
454
455
456
457
458
459
460
461
462
463
464
465
466
467
468
469
470
471
472
473
474
PROJECT(cr3)
cmake_minimum_required(VERSION 3.0)
set(CMAKE_MODULE_PATH "${CMAKE_SOURCE_DIR}/cmake/modules/")
#INCLUDE(CPack)
if( ${CMAKE_SYSTEM} MATCHES "Darwin" )
message("MAC OSX build")
SET(MAC 1)
endif( ${CMAKE_SYSTEM} MATCHES "Darwin" )
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)
option(USE_DEBUG_EXTRA_OPTS "Add extra debug flags and technique" OFF)
if(USE_DEBUG_EXTRA_OPTS)
add_definitions(-D_GLIBCXX_DEBUG -D_GLIBCXX_DEBUG_PEDANTIC)
set(DEBUG_EXTRA_FLAGS "-fstack-check -fstack-protector -fno-omit-frame-pointer -Wshift-overflow=2")
if ("${CMAKE_SYSTEM_NAME}" STREQUAL "Linux")
set (DEBUG_EXTRA_FLAGS "${DEBUG_EXTRA_FLAGS} -fsanitize=address -fsanitize=undefined -fno-sanitize-recover")
set(CMAKE_EXE_LINKER_FLAGS_DEBUG "${CMAKE_EXE_LINKER_FLAGS_DEBUG} -fsanitize=address -fsanitize=undefined -fno-sanitize-recover -fstack-check -fstack-protector")
set(CMAKE_SHARED_LINKER_FLAGS_DEBUG "${CMAKE_EXE_LINKER_FLAGS_DEBUG} -fsanitize=address -fsanitize=undefined -fno-sanitize-recover -fstack-check -fstack-protector")
endif ("${CMAKE_SYSTEM_NAME}" STREQUAL "Linux")
set(CMAKE_C_FLAGS_DEBUG "${CMAKE_C_FLAGS_DEBUG} ${DEBUG_EXTRA_FLAGS}")
set(CMAKE_CXX_FLAGS_DEBUG "${CMAKE_CXX_FLAGS_DEBUG} ${DEBUG_EXTRA_FLAGS}")
endif(USE_DEBUG_EXTRA_OPTS)
if(MSVC)
# Force to always compile with W4
if(CMAKE_CXX_FLAGS MATCHES "/W[0-4]")
string(REGEX REPLACE "/W[0-4]" "/W4" CMAKE_CXX_FLAGS "${CMAKE_CXX_FLAGS}")
else()
set(CMAKE_CXX_FLAGS "${CMAKE_CXX_FLAGS} /W4")
endif()
elseif(CMAKE_COMPILER_IS_GNUCC OR CMAKE_COMPILER_IS_GNUCXX)
# Update if necessary
set(CMAKE_C_FLAGS "${CMAKE_C_FLAGS} -Wall -Wno-long-long -pedantic -std=gnu11 -fPIC -Wno-misleading-indentation")
set(CMAKE_CXX_FLAGS "${CMAKE_CXX_FLAGS} -Wall -Wno-long-long -pedantic -std=c++11 -fPIC -Wno-misleading-indentation -Wno-reorder -Wno-format-overflow")
set(CMAKE_C_FLAGS_RELEASE "${CMAKE_C_FLAGS_RELEASE} -fomit-frame-pointer")
set(CMAKE_CXX_FLAGS_RELEASE "${CMAKE_CXX_FLAGS_RELEASE} -fomit-frame-pointer")
endif()
if (NOT DEFINED GUI)
SET(GUI QT5)
message("GUI type is not specified!\n")
message("Using ${GUI} as default\n")
message("Add cmake parameter -D GUI={QT|QT5|WX|CRGUI_XCB|CRGUI_NANOX|CRGUI_PB|CRGUI_QT|CRGUI_JINKE_PLUGIN|CRGUI_WIN32|FB2PROPS} to use another GUI frontend\n")
else ()
message("Using GUI frontend ${GUI}\n")
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} )
# big page margins support
if (NOT DEFINED MAX_IMAGE_SCALE_MUL)
SET(MAX_IMAGE_SCALE_MUL 0)
else()
SET(MAX_IMAGE_SCALE_MUL ${MAX_IMAGE_SCALE_MUL})
endif (NOT DEFINED MAX_IMAGE_SCALE_MUL)
ADD_DEFINITIONS( -DMAX_IMAGE_SCALE_MUL=${MAX_IMAGE_SCALE_MUL} )
message("using MAX_IMAGE_SCALE_MUL=${MAX_IMAGE_SCALE_MUL}")
if(MAC)
ADD_DEFINITIONS( -DMAC=1 -DLINUX=1 -D_LINUX=1 -DCR_EMULATE_GETTEXT=1 )
elseif ( WIN32 )
ADD_DEFINITIONS( -DWIN32=1 -D_WIN32=1 -DCR_EMULATE_GETTEXT=1 -DNOMINMAX=1 -D_CRT_SECURE_NO_WARNINGS )
else()
ADD_DEFINITIONS( -DLINUX=1 -D_LINUX=1 )
endif(MAC)
# Large files support
ADD_DEFINITIONS( -D_LARGEFILE64_SOURCE=1 -D_FILE_OFFSET_BITS=64 -DLVLONG_FILE_SUPPORT=1 )
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 )
# Uncomment to test e-ink style color palette on Desktop
#SET (DESKTOP_DEFS -DCOLOR_BACKBUFFER=0 -DGRAY_BACKBUFFER_BITS=4 -DLDOM_USE_OWN_MEM_MAN=1 -DUSE_FREETYPE=1 )
if( ${GUI} STREQUAL QT )
FIND_PACKAGE( Qt4 REQUIRED )
INCLUDE(${QT_USE_FILE})
SET(QT_3RDPARTY_DIR ${QT_INCLUDE_DIR}/../src/3rdparty)
endif( ${GUI} STREQUAL QT )
if( ${GUI} STREQUAL QT5 )
FIND_PACKAGE( Qt5Core REQUIRED )
FIND_PACKAGE( Qt5Widgets REQUIRED )
FIND_PACKAGE( Qt5LinguistTools REQUIRED )
include_directories(${Qt5Widgets_INCLUDE_DIRS})
add_definitions(${Qt5Widgets_DEFINITIONS})
include_directories(${Qt5Core_INCLUDE_DIRS})
add_definitions(${Qt5Core_DEFINITIONS})
endif( ${GUI} STREQUAL QT5 )
# thirdparty sources definitions
include("${CMAKE_SOURCE_DIR}/thirdparty_repo/repo_srcdirs.cmake")
#UNRAR support (not implemented yet)
if(DEFINED USE_UNRAR)
ADD_DEFINITIONS(-DUSE_UNRAR=1)
endif(DEFINED USE_UNRAR)
find_path(NANOSVG_INCLUDE_DIR nanosvg.h DOC "Path to NanoSVG include dir")
if (NOT NANOSVG_INCLUDE_DIR)
SET(NANOSVG_INCLUDE_DIR ${CMAKE_SOURCE_DIR}/thirdparty_unman/nanosvg/src)
endif(NOT NANOSVG_INCLUDE_DIR)
ADD_DEFINITIONS(-DUSE_NANOSVG=1)
INCLUDE_DIRECTORIES(${NANOSVG_INCLUDE_DIR})
if (MAC)
message("will use zlib, libpng, libjpeg, freetype from Qt static library")
SET(ZLIB_INCLUDE_DIR ${QT_3RDPARTY_DIR}/zlib)
SET(ZLIB_LIBRARIES )
SET(PNG_INCLUDE_DIR ${QT_3RDPARTY_DIR}/libpng)
SET(PNG_LIBRARIES )
SET(FREETYPE_INCLUDE_DIRS ${QT_3RDPARTY_DIR}/freetype/include)
SET(FREETYPE_LIBRARIES )
SET(JPEG_INCLUDE_DIR ${QT_3RDPARTY_DIR}/libjpeg)
SET(JPEG_LIBRARIES )
endif(MAC)
if (NOT MAC)
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}\n")
# SET(ZLIB_LIBRARIES "")
else()
if (NOT MSVC AND NOT DEFINED USE_STATIC_ZLIB)
FIND_PACKAGE(ZLIB)
endif (NOT MSVC AND NOT DEFINED USE_STATIC_ZLIB)
if (NOT ZLIB_FOUND)
message("System ZLIB not found, will build local one\n")
ADD_SUBDIRECTORY(thirdparty/${REPO_ZLIB_SRCDIR})
SET(ZLIB_INCLUDE_DIR ${CMAKE_SOURCE_DIR}/thirdparty/${REPO_ZLIB_SRCDIR} ${CMAKE_BINARY_DIR}/thirdparty/${REPO_ZLIB_SRCDIR} CACHE PATH "" FORCE)
SET(ZLIB_LIBRARIES zlibstatic)
endif (NOT ZLIB_FOUND)
endif(DEFINED USE_QT_ZLIB)
endif(NOT MAC)
if (NOT ${GUI} STREQUAL FB2PROPS )
if (NOT MAC)
if (NOT MSVC AND NOT CR3_PNG)
FIND_PACKAGE(PNG)
endif (NOT MSVC AND NOT CR3_PNG)
if (NOT PNG_FOUND)
message("System LIBPNG not found, will build local one\n")
INCLUDE_DIRECTORIES(${ZLIB_INCLUDE_DIR})
SET(ZLIB_LIBRARY ${ZLIB_LIBRARIES})
ADD_SUBDIRECTORY(thirdparty/${REPO_LIBPNG_SRCDIR})
SET(PNG_INCLUDE_DIR ${CMAKE_SOURCE_DIR}/thirdparty/${REPO_LIBPNG_SRCDIR} ${CMAKE_BINARY_DIR}/thirdparty/${REPO_LIBPNG_SRCDIR} CACHE PATH "" FORCE)
SET(PNG_LIBRARIES png)
endif (NOT PNG_FOUND)
if (NOT MSVC AND NOT CR3_JPEG)
FIND_PACKAGE(JPEG)
endif (NOT MSVC AND NOT CR3_JPEG)
if (NOT JPEG_FOUND)
message("System LIBJPEG not found, will build local one\n")
ADD_SUBDIRECTORY(thirdparty/${REPO_LIBJPEG_SRCDIR})
SET(JPEG_INCLUDE_DIR ${CMAKE_CURRENT_SOURCE_DIR}/thirdparty/${REPO_LIBJPEG_SRCDIR} CACHE PATH "" FORCE)
SET(JPEG_LIBRARIES jpeg)
endif (NOT JPEG_FOUND)
if (NOT MSVC AND NOT CR3_FREETYPE)
FIND_PACKAGE(Freetype 2.10.0)
FIND_PACKAGE(HarfBuzz 2.6.0)
endif (NOT MSVC AND NOT CR3_FREETYPE)
ADD_SUBDIRECTORY(thirdparty_unman/qimagescale)
if (NOT FREETYPE_FOUND)
message("System FREETYPE not found, will build local one\n")
if (NOT HarfBuzz_FOUND)
SET(HarfBuzz_INCLUDE_DIR ${CMAKE_CURRENT_SOURCE_DIR}/thirdparty/${REPO_HARFBUZZ_SRCDIR}/src CACHE PATH "" FORCE)
SET(HarfBuzz_INCLUDE_DIRS ${HarfBuzz_INCLUDE_DIR} CACHE PATH "" FORCE)
SET(HarfBuzz_LIBRARIES harfbuzz CACHE PATH "" FORCE)
SET(HARFBUZZ_INCLUDE_DIR ${HarfBuzz_INCLUDE_DIR} CACHE PATH "" FORCE)
SET(HARFBUZZ_INCLUDE_DIRS ${HarfBuzz_INCLUDE_DIRS} CACHE PATH "" FORCE)
SET(HARFBUZZ_LIBRARIES ${HarfBuzz_LIBRARIES} CACHE PATH "" FORCE)
endif (NOT HarfBuzz_FOUND)
SET(FT_WITH_ZLIB ON CACHE BOOL "Use system zlib instead of internal library." FORCE)
SET(FT_WITH_PNG ON CACHE BOOL "Support PNG compressed OpenType embedded bitmaps." FORCE)
SET(ZLIB_LIBRARY ${ZLIB_LIBRARIES})
SET(PNG_PNG_INCLUDE_DIR ${PNG_INCLUDE_DIR} CACHE PATH "" FORCE)
SET(PNG_LIBRARY ${PNG_LIBRARIES})
SET(SKIP_INSTALL_ALL ON CACHE BOOL "Don't install anything" FORCE)
ADD_SUBDIRECTORY(thirdparty/${REPO_FREETYPE_SRCDIR})
SET(FREETYPE_INCLUDE_DIRS ${CMAKE_CURRENT_SOURCE_DIR}/thirdparty/${REPO_FREETYPE_SRCDIR}/include CACHE PATH "" FORCE)
SET(FREETYPE_LIBRARIES freetype)
endif (NOT FREETYPE_FOUND)
if (NOT HarfBuzz_FOUND)
message("System HarfBuzz not found, will build local one\n")
SET(HB_HAVE_FREETYPE ON CACHE BOOL "Enable freetype interop helpers" FORCE)
SET(HB_BUILD_TESTS OFF CACHE BOOL "Build harfbuzz tests" FORCE)
SET(FREETYPE_LIBRARY ${FREETYPE_LIBRARIES})
SET(SKIP_INSTALL_ALL ON CACHE BOOL "Don't install anything" FORCE)
ADD_SUBDIRECTORY(thirdparty/${REPO_HARFBUZZ_SRCDIR})
SET(HarfBuzz_INCLUDE_DIRS ${CMAKE_CURRENT_SOURCE_DIR}/thirdparty/${REPO_HARFBUZZ_SRCDIR}/src CACHE PATH "" FORCE)
SET(HarfBuzz_LIBRARY harfbuzz)
endif (NOT HarfBuzz_FOUND)
if (NOT MSVC)
find_package(FontConfig 2.11.0)
endif(NOT MSVC)
if (FONTCONFIG_FOUND)
set(DESKTOP_DEFS ${DESKTOP_DEFS} -DUSE_FONTCONFIG=1)
else()
set(DESKTOP_DEFS ${DESKTOP_DEFS} -DUSE_FONTCONFIG=0)
endif (FONTCONFIG_FOUND)
if (NOT MSVC)
find_package(FriBidi 1.0.0)
if (NOT FRIBIDI_FOUND)
message("System FriBidi not found, will build local one\n")
ADD_SUBDIRECTORY(thirdparty/${REPO_FRIBIDI_SRCDIR})
SET(FRIBIDI_INCLUDE_DIR ${CMAKE_SOURCE_DIR}/thirdparty/${REPO_FRIBIDI_SRCDIR}/lib CACHE PATH "" FORCE)
SET(FRIBIDI_LIBRARIES fribidi)
set(DESKTOP_DEFS ${DESKTOP_DEFS} -DBUNDLED_FRIBIDI=1 -I${CMAKE_BINARY_DIR}/thirdparty/${REPO_FRIBIDI_SRCDIR})
endif (NOT FRIBIDI_FOUND)
endif(NOT MSVC)
if (NOT MSVC)
find_package(libunibreak 4.0)
endif(NOT MSVC)
if (NOT LIBUNIBREAK_FOUND)
message("System libunibreak not found, will build local one\n")
ADD_SUBDIRECTORY(thirdparty/${REPO_LIBUNIBREAK_SRCDIR})
SET(LIBUNIBREAK_INCLUDE_DIR ${CMAKE_SOURCE_DIR}/thirdparty/${REPO_LIBUNIBREAK_SRCDIR}/src CACHE PATH "" FORCE)
SET(LIBUNIBREAK_LIBRARIES unibreak)
endif (NOT LIBUNIBREAK_FOUND)
find_package(ZSTD 1.4.0)
if (NOT ZSTD_FOUND)
message("\nSystem zstd not found, will build local one\n")
set(ZSTD_LEGACY_SUPPORT OFF CACHE BOOL "LEGACY SUPPORT" FORCE)
set(ZSTD_MULTITHREAD_SUPPORT OFF CACHE BOOL "MULTITHREADING SUPPORT" FORCE)
set(ZSTD_BUILD_PROGRAMS OFF CACHE BOOL "BUILD PROGRAMS" FORCE)
set(ZSTD_BUILD_CONTRIB OFF CACHE BOOL "BUILD CONTRIB" FORCE)
set(ZSTD_BUILD_TESTS OFF CACHE BOOL "BUILD TESTS" FORCE)
set(ZSTD_BUILD_STATIC ON CACHE BOOL "BUILD STATIC LIBRARIES" FORCE)
set(ZSTD_BUILD_SHARED OFF CACHE BOOL "BUILD SHARED LIBRARIES" FORCE)
add_subdirectory(thirdparty/${REPO_ZSTD_SRCDIR}/build/cmake)
SET(ZSTD_INCLUDE_DIRS ${CMAKE_CURRENT_SOURCE_DIR}/thirdparty/${REPO_ZSTD_SRCDIR}/lib CACHE PATH "Include directories needed to use ZSTD" FORCE)
SET(ZSTD_LIBRARIES libzstd_static CACHE FILEPATH "Libraries needed to link to ZSTD" FORCE)
endif(NOT ZSTD_FOUND)
find_package(utf8proc)
if (UTF8PROC_FOUND)
set(DESKTOP_DEFS ${DESKTOP_DEFS} -DUSE_UTF8PROC=1)
else()
set(DESKTOP_DEFS ${DESKTOP_DEFS} -DUSE_UTF8PROC=0)
endif (UTF8PROC_FOUND)
endif (NOT MAC)
#if (ENABLE_CHM)
message("Will build patched LIBCHM library\n")
ADD_SUBDIRECTORY(thirdparty_unman/chmlib)
SET(CHM_INCLUDE_DIR ${CMAKE_CURRENT_SOURCE_DIR}/thirdparty_unman/chmlib/src)
SET(CHM_LIBRARIES chmlib)
ADD_DEFINITIONS(-DCHM_SUPPORT_ENABLED=1)
#else()
#ADD_DEFINITIONS(-DCHM_SUPPORT_ENABLED=0)
#endif(ENABLE_CHM)
message("Will build patched ANTIWORD library\n")
ADD_DEFINITIONS(-DCR3_ANTIWORD_PATCH=1)
ADD_SUBDIRECTORY(thirdparty_unman/antiword)
SET(ANTIWORD_INCLUDE_DIR ${CMAKE_CURRENT_SOURCE_DIR}/thirdparty_unman/antiword)
SET(ANTIWORD_LIBRARIES antiword)
ADD_DEFINITIONS(-DENABLE_ANTIWORD=1)
INCLUDE_DIRECTORIES( ${ANTIWORD_INCLUDE_DIR} )
endif ( NOT ${GUI} STREQUAL FB2PROPS )
INCLUDE_DIRECTORIES(
${PNG_INCLUDE_DIR}
${JPEG_INCLUDE_DIR}
${ZLIB_INCLUDE_DIR}
${FREETYPE_INCLUDE_DIRS}
${HarfBuzz_INCLUDE_DIRS}
${ANTIWORD_INCLUDE_DIR}
${CHM_INCLUDE_DIR}
${FRIBIDI_INCLUDE_DIR}
${LIBUNIBREAK_INCLUDE_DIR}
${ZSTD_INCLUDE_DIRS}
)
if ( ${GUI} STREQUAL FB2PROPS )
SET(STD_LIBS
${ZLIB_LIBRARIES}
)
else()
SET(STD_LIBS
${JPEG_LIBRARIES}
${FREETYPE_LIBRARIES}
${HarfBuzz_LIBRARY}
${PNG_LIBRARIES}
${ZLIB_LIBRARIES}
${CHM_LIBRARIES}
${ZLIB_LIBRARIES}
${ANTIWORD_LIBRARIES}
${FRIBIDI_LIBRARIES}
${LIBUNIBREAK_LIBRARIES}
${ZSTD_LIBRARIES}
qimagescale
)
if (FONTCONFIG_FOUND)
set(STD_LIBS ${STD_LIBS} ${FONTCONFIG_LIBRARIES})
endif (FONTCONFIG_FOUND)
if (UTF8PROC_FOUND)
set(STD_LIBS ${STD_LIBS} ${UTF8PROC_LIBRARIES})
endif (UTF8PROC_FOUND)
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 )
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 QT5 )
message("Will make CR3/QT5")
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 2.8 REQUIRED)
INCLUDE(${wxWidgets_USE_FILE})
include_directories( ${wxWidgets_INCLUDE_DIRS} )
message( "WX include: ${wxWidgets_INCLUDE_DIRS}" )
ADD_SUBDIRECTORY(crengine)
ADD_SUBDIRECTORY(cr3wx)
elseif ( ${GUI} STREQUAL CRGUI_PB )
message("Will make CR3GUI for PocketBook")
ADD_DEFINITIONS( -DLBOOK=1 -DCR_POCKETBOOK=1
${CRGUI_DEFS} -DCR_USE_INVERT_FOR_SELECTION_MARKS=1 -DENABLE_UPDATE_MODE_SETTING=1)
ADD_DEFINITIONS( -DCR_INTERNAL_PAGE_ORIENTATION=0 )
ADD_SUBDIRECTORY(crengine)
ADD_SUBDIRECTORY(cr3gui)
FIND_PATH (INKVIEW_INCLUDE_DIR inkview.h)
IF (INKVIEW_INCLUDE_DIR)
include_directories(${INKVIEW_INCLUDE_DIR})
ELSE (INKVIEW_INCLUDE_DIR)
message("inkview.h not found")
ENDIF (INKVIEW_INCLUDE_DIR)
elseif ( ${GUI} STREQUAL CRGUI_QT )
message("Will make CR3GUI with Qt backend")
ADD_DEFINITIONS( -DCR_USE_QT=1 -DCRGUI_QT=1 -DCR_USE_INVERT_FOR_SELECTION_MARKS=1)
ADD_DEFINITIONS( -DCR_INTERNAL_PAGE_ORIENTATION=0 ${CRGUI_DEFS} )
ADD_SUBDIRECTORY(crengine)
ADD_SUBDIRECTORY(cr3gui)
else ( ${GUI} STREQUAL CRGUI_XCB )
message("Unknown GUI type ${GUI}")
endif ( ${GUI} STREQUAL CRGUI_XCB )