CMakeLists.txt 9.31 KB
Newer Older
Albert Astals Cid's avatar
Albert Astals Cid committed
1
project(okular)
2

3
cmake_minimum_required(VERSION 2.8.12)
Frederik Gladhorn's avatar
Frederik Gladhorn committed
4

5
set(QT_REQUIRED_VERSION "5.2.0")
6
set(KF5_REQUIRED_VERSION "5.16.0")
Frederik Gladhorn's avatar
Frederik Gladhorn committed
7

8
find_package(ECM 5.19.0 CONFIG REQUIRED)
Frederik Gladhorn's avatar
Frederik Gladhorn committed
9
10
11
12
13
set(CMAKE_MODULE_PATH ${CMAKE_MODULE_PATH} ${ECM_MODULE_PATH})

include(ECMInstallIcons)
include(ECMSetupVersion)
include(ECMOptionalAddSubdirectory)
14
15
include(GenerateExportHeader)
include(FeatureSummary)
Laurent Montel's avatar
Laurent Montel committed
16
include(ECMAddAppIcon)
17
include(KDEFrameworkCompilerSettings NO_POLICY_SCOPE)
18
19
include(KDEInstallDirs)
include(KDECMakeSettings)
Vishesh Handa's avatar
Vishesh Handa committed
20
include(ECMAddTests)
21
include(ECMAddAppIcon)
22
23
24
25
include(ECMPackageConfigHelpers)

ecm_setup_version(1.0.0 VARIABLE_PREFIX OKULAR
                        VERSION_HEADER "${CMAKE_CURRENT_BINARY_DIR}/core/version.h"
26
                        PACKAGE_VERSION_FILE "${CMAKE_CURRENT_BINARY_DIR}/Okular5ConfigVersion.cmake")
Frederik Gladhorn's avatar
Frederik Gladhorn committed
27

28
29
find_package(Qt5 ${QT_REQUIRED_VERSION} CONFIG REQUIRED COMPONENTS Core DBus Test Widgets PrintSupport Svg Qml Quick)
find_package(Qt5 ${QT_REQUIRED_VERSION} OPTIONAL_COMPONENTS TextToSpeech)
30
31
32
33
34
35
if (NOT Qt5TextToSpeech_FOUND)
    message(STATUS "Qt5TextToSpeech not found, speech features will be disabled")
else()
    add_definitions(-DHAVE_SPEECH)
endif()

36
find_package(KF5 ${KF5_REQUIRED_VERSION} REQUIRED COMPONENTS
Frederik Gladhorn's avatar
Frederik Gladhorn committed
37
38
39
    Activities
    Archive
    Bookmarks
40
    Completion
Frederik Gladhorn's avatar
Frederik Gladhorn committed
41
42
43
44
    Config
    ConfigWidgets
    CoreAddons
    DBusAddons
45
    IconThemes
Frederik Gladhorn's avatar
Frederik Gladhorn committed
46
47
48
49
50
51
    JS
    KDELibs4Support
    KIO
    Parts
    ThreadWeaver
    Wallet
Vishesh Handa's avatar
Vishesh Handa committed
52
    KHtml
53
    WindowSystem
Frederik Gladhorn's avatar
Frederik Gladhorn committed
54
55
)
find_package(Phonon4Qt5 CONFIG REQUIRED)
56
57
58

set(CMAKE_MODULE_PATH ${CMAKE_MODULE_PATH} ${CMAKE_SOURCE_DIR}/cmake/modules)

59
60
find_package(ZLIB REQUIRED)

61
add_definitions(-DQT_USE_FAST_CONCATENATION -DQT_USE_FAST_OPERATOR_PLUS)
Lukáš Tinkl's avatar
Lukáš Tinkl committed
62
add_definitions(-DTRANSLATION_DOMAIN="okular")
Frederik Gladhorn's avatar
Frederik Gladhorn committed
63

64
include_directories(${CMAKE_CURRENT_SOURCE_DIR} ${PHONON_INCLUDES} core/synctex ${ZLIB_INCLUDE_DIR} ${CMAKE_BINARY_DIR}/core)
65

66
 add_subdirectory( mobile )
67
68
69
70
71
72
73
option(BUILD_COVERAGE "Build the project with gcov support" OFF)

if(BUILD_COVERAGE)
    set(CMAKE_CXX_FLAGS "${CMAKE_CXX_FLAGS} -fprofile-arcs -ftest-coverage")
    set(CMAKE_EXE_LINKER_FLAGS "${CMAKE_EXE_LINKER_FLAGS} -lgcov")
endif()

74
75
76
add_subdirectory( ui )
add_subdirectory( shell )
add_subdirectory( generators )
Laurent Montel's avatar
Laurent Montel committed
77
add_subdirectory( autotests )
78
add_subdirectory( conf/autotests )
Frederik Gladhorn's avatar
Frederik Gladhorn committed
79

80
add_subdirectory(doc)
81

82
83
include(OkularConfigureChecks.cmake)

Christian Ehrlicher's avatar
Christian Ehrlicher committed
84
85
86
87
88
if(NOT WIN32)
 set(MATH_LIB m)
else(NOT WIN32)
 set(MATH_LIB)
endif(NOT WIN32)
89

90
# okularcore
91

92
set(okularcore_SRCS
Pino Toscano's avatar
Pino Toscano committed
93
   core/action.cpp
94
95
   core/annotations.cpp
   core/area.cpp
96
   core/audioplayer.cpp
97
   core/bookmarkmanager.cpp
98
99
   core/chooseenginedialog.cpp
   core/document.cpp
100
   core/documentcommands.cpp
101
   core/fontinfo.cpp
102
   core/form.cpp
103
   core/generator.cpp
104
   core/generator_p.cpp
105
   core/misc.cpp
106
   core/movie.cpp
107
   core/observer.cpp
Frederik Gladhorn's avatar
Frederik Gladhorn committed
108
   core/debug.cpp
109
   core/page.cpp
110
   core/pagecontroller.cpp
111
   core/pagesize.cpp
112
   core/pagetransition.cpp
113
   core/rotationjob.cpp
114
   core/scripter.cpp
115
   core/sound.cpp
116
   core/sourcereference.cpp
117
   core/textdocumentgenerator.cpp
118
   core/textdocumentsettings.cpp
119
   core/textpage.cpp
120
   core/tilesmanager.cpp
121
   core/utils.cpp
122
   core/view.cpp
John Layt's avatar
John Layt committed
123
   core/fileprinter.cpp
124
   core/script/executor_kjs.cpp
125
   core/script/kjs_app.cpp
126
127
128
129
130
131
132
   core/script/kjs_console.cpp
   core/script/kjs_data.cpp
   core/script/kjs_document.cpp
   core/script/kjs_fullscreen.cpp
   core/script/kjs_field.cpp
   core/script/kjs_spell.cpp
   core/script/kjs_util.cpp
133
134
   core/synctex/synctex_parser.c
   core/synctex/synctex_parser_utils.c
135
136
)

137
ki18n_wrap_ui(okularcore_SRCS
138
139
140
   conf/textdocumentsettings.ui
)

141
install( FILES
Pino Toscano's avatar
Pino Toscano committed
142
           core/action.h
143
144
145
           core/annotations.h
           core/area.h
           core/document.h
146
           core/fontinfo.h
147
           core/form.h
148
           core/generator.h
149
           core/global.h
150
           core/page.h
151
           core/pagesize.h
152
153
154
           core/pagetransition.h
           core/sound.h
           core/sourcereference.h
155
           core/textdocumentgenerator.h
156
           core/textdocumentsettings.h
157
           core/textpage.h
158
           core/tile.h
159
           core/utils.h
John Layt's avatar
John Layt committed
160
           core/fileprinter.h
161
           core/observer.h
162
           ${CMAKE_CURRENT_BINARY_DIR}/core/version.h
163
           ${CMAKE_CURRENT_BINARY_DIR}/core/okularcore_export.h
164
           ${CMAKE_CURRENT_BINARY_DIR}/settings_core.h
Laurent Montel's avatar
Laurent Montel committed
165
         DESTINATION ${KDE_INSTALL_INCLUDEDIR}/okular/core COMPONENT Devel)
166
167
168
169
170

install( FILES
           interfaces/configinterface.h
           interfaces/guiinterface.h
           interfaces/printinterface.h
171
           interfaces/saveinterface.h
172
           interfaces/viewerinterface.h
Laurent Montel's avatar
Laurent Montel committed
173
         DESTINATION ${KDE_INSTALL_INCLUDEDIR}/okular/interfaces COMPONENT Devel)
174

175
ki18n_wrap_ui(okularcore_SRCS
176
   core/chooseenginewidget.ui
177
178
)

179
kconfig_add_kcfg_files(okularcore_SRCS conf/settings_core.kcfgc )
180

Laurent Montel's avatar
Minor    
Laurent Montel committed
181
add_library(okularcore SHARED ${okularcore_SRCS})
182
generate_export_header(okularcore BASE_NAME okularcore EXPORT_FILE_NAME "${CMAKE_CURRENT_BINARY_DIR}/core/okularcore_export.h")
183

184
185
186
187
188
# Special handling for linking okularcore on OSX/Apple
IF(APPLE)
    SET(OKULAR_IOKIT "-framework IOKit" CACHE STRING "Apple IOKit framework")
ENDIF(APPLE)

Frederik Gladhorn's avatar
Frederik Gladhorn committed
189
target_link_libraries(okularcore
190
PRIVATE
Frederik Gladhorn's avatar
Frederik Gladhorn committed
191
192
193
194
195
    ${OKULAR_IOKIT}
    KF5::Archive
    KF5::JS
    KF5::JSApi
    KF5::KIOCore
196
197
    KF5::KIOWidgets
    KF5::I18n
Frederik Gladhorn's avatar
Frederik Gladhorn committed
198
199
    KF5::ThreadWeaver
    KF5::Wallet
200
    KF5::Bookmarks
Frederik Gladhorn's avatar
Frederik Gladhorn committed
201
202
    Phonon::phonon4qt5
    ${MATH_LIB}
203
    ${ZLIB_LIBRARIES}
204
205
206
207
208
209
PUBLIC  # these are included from the installed headers
    KF5::CoreAddons
    KF5::XmlGui
    KF5::ConfigGui
    Qt5::PrintSupport
    Qt5::Widgets
Frederik Gladhorn's avatar
Frederik Gladhorn committed
210
)
211

212
set_target_properties(okularcore PROPERTIES VERSION 7.0.0 SOVERSION 7 OUTPUT_NAME Okular5Core EXPORT_NAME Core)
213

214
install(TARGETS okularcore EXPORT Okular5Targets ${KDE_INSTALL_TARGETS_DEFAULT_ARGS})
215

Laurent Montel's avatar
Laurent Montel committed
216
217
218
install(FILES conf/okular.kcfg DESTINATION ${KDE_INSTALL_KCFGDIR})
install(FILES conf/okular_core.kcfg DESTINATION ${KDE_INSTALL_KCFGDIR})
install(FILES core/okularGenerator.desktop DESTINATION ${KDE_INSTALL_KSERVICETYPES5DIR})
219

220
221
# okularpart

222
set(okularpart_conf_SRCS
223
224
   conf/preferencesdialog.cpp
   conf/dlgaccessibility.cpp
225
   conf/dlgdebug.cpp
226
   conf/dlgeditor.cpp
227
   conf/dlggeneral.cpp
228
   conf/dlgannotations.cpp
229
230
   conf/dlgperformance.cpp
   conf/dlgpresentation.cpp
231
232
   conf/editannottooldialog.cpp
   conf/editdrawingtooldialog.cpp
233
   conf/widgetannottools.cpp
234
235
236
237
238
239
240
241
   conf/widgetconfigurationtoolsbase.cpp
   conf/widgetdrawingtools.cpp
)

set(okularpart_SRCS
   ${okularpart_conf_SRCS}
   part.cpp
   extensions.cpp
242
   ui/embeddedfilesdialog.cpp
243
   ui/annotwindow.cpp
244
   ui/annotationmodel.cpp
245
   ui/annotationpopup.cpp
246
   ui/annotationpropertiesdialog.cpp
247
   ui/annotationproxymodels.cpp
248
   ui/annotationtools.cpp
Pino Toscano's avatar
Pino Toscano committed
249
   ui/annotationwidgets.cpp
250
   ui/bookmarklist.cpp
Frederik Gladhorn's avatar
Frederik Gladhorn committed
251
   ui/debug_ui.cpp
252
   ui/drawingtoolactions.cpp
253
   ui/fileprinterpreview.cpp
254
   ui/findbar.cpp
255
   ui/formwidgets.cpp
Pino Toscano's avatar
Pino Toscano committed
256
   ui/guiutils.cpp
257
   ui/ktreeviewsearchline.cpp
258
   ui/latexrenderer.cpp
259
   ui/minibar.cpp
260
   ui/pageitemdelegate.cpp
261
   ui/pagepainter.cpp
Albert Astals Cid's avatar
Albert Astals Cid committed
262
   ui/pagesizelabel.cpp
263
264
   ui/pageviewannotator.cpp
   ui/pageview.cpp
Michal Humpula's avatar
Michal Humpula committed
265
   ui/magnifierview.cpp
266
   ui/pageviewutils.cpp
267
   ui/presentationsearchbar.cpp
268
269
   ui/presentationwidget.cpp
   ui/propertiesdialog.cpp
270
   ui/searchlineedit.cpp
271
   ui/searchwidget.cpp
Pino Toscano's avatar
Pino Toscano committed
272
   ui/sidebar.cpp
273
   ui/side_reviews.cpp
274
   ui/snapshottaker.cpp
275
276
   ui/thumbnaillist.cpp
   ui/toc.cpp
277
   ui/tocmodel.cpp
278
   ui/toolaction.cpp
279
   ui/videowidget.cpp
280
   ui/layers.cpp
281
)
282

283
284
285
286
287
if (Qt5TextToSpeech_FOUND)
   set(okularpart_SRCS ${okularpart_SRCS}
      ui/tts.cpp)
endif()

288
ki18n_wrap_ui(okularpart_SRCS
289
   conf/dlgaccessibilitybase.ui
290
   conf/dlgeditorbase.ui
291
   conf/dlggeneralbase.ui
292
   conf/dlgannotationsbase.ui
293
294
295
296
   conf/dlgperformancebase.ui
   conf/dlgpresentationbase.ui
)

297
kconfig_add_kcfg_files(okularpart_SRCS conf/settings.kcfgc )
298

299
add_library(okularpart SHARED ${okularpart_SRCS})
300
generate_export_header(okularpart BASE_NAME okularpart)
301

302
303
304
305
306
target_link_libraries(okularpart okularcore
    ${MATH_LIB}
    Qt5::Svg
    Phonon::phonon4qt5
    KF5::Archive
307
    KF5::Bookmarks
308
    KF5::I18n
309
    KF5::IconThemes
Olivier Churlaud's avatar
Olivier Churlaud committed
310
    KF5::ItemViews
311
312
313
314
315
316
317
    KF5::KDELibs4Support
    KF5::Parts
    KF5::Solid
    KF5::Wallet
    KF5::WindowSystem
)

318
set_target_properties(okularpart PROPERTIES PREFIX "")
319

320
321
322
if (Qt5TextToSpeech_FOUND)
   target_link_libraries(okularpart Qt5::TextToSpeech)
endif()
Laurent Montel's avatar
Laurent Montel committed
323
install(TARGETS okularpart DESTINATION ${KDE_INSTALL_PLUGINDIR})
324
325
326
327


########### install files ###############

Laurent Montel's avatar
Laurent Montel committed
328
install(FILES okular.upd DESTINATION ${KDE_INSTALL_DATADIR}/kconf_update)
329

Laurent Montel's avatar
Laurent Montel committed
330
331
install( FILES okular_part.desktop  DESTINATION  ${KDE_INSTALL_KSERVICES5DIR} )
install( FILES part.rc part-viewermode.rc DESTINATION ${KDE_INSTALL_KXMLGUI5DIR}/okular )
332

333
334
install( FILES okular.categories DESTINATION ${KDE_INSTALL_CONFDIR} )

335
336
########### cmake files #################

337
set(CMAKECONFIG_INSTALL_DIR "${KDE_INSTALL_CMAKEPACKAGEDIR}/Okular5")
338
ecm_configure_package_config_file(
339
340
  "${CMAKE_CURRENT_SOURCE_DIR}/Okular5Config.cmake.in"
  "${CMAKE_CURRENT_BINARY_DIR}/Okular5Config.cmake"
341
342
343
344
345
  INSTALL_DESTINATION  ${CMAKECONFIG_INSTALL_DIR}
  PATH_VARS  INCLUDE_INSTALL_DIR CMAKE_INSTALL_PREFIX
)

install(FILES
346
347
  "${CMAKE_CURRENT_BINARY_DIR}/Okular5Config.cmake"
  "${CMAKE_CURRENT_BINARY_DIR}/Okular5ConfigVersion.cmake"
348
349
350
351
  DESTINATION "${CMAKECONFIG_INSTALL_DIR}"
  COMPONENT Devel
)

352
install(EXPORT Okular5Targets DESTINATION "${CMAKECONFIG_INSTALL_DIR}" FILE Okular5Targets.cmake NAMESPACE Okular::)
353

354
########### summary #################
355

Frederik Gladhorn's avatar
Frederik Gladhorn committed
356
feature_summary(WHAT ALL FATAL_ON_MISSING_REQUIRED_PACKAGES)
357