CMakeLists.txt 9.32 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
    DocTools
46
    IconThemes
Frederik Gladhorn's avatar
Frederik Gladhorn committed
47
48
49
50
51
52
    JS
    KDELibs4Support
    KIO
    Parts
    ThreadWeaver
    Wallet
Vishesh Handa's avatar
Vishesh Handa committed
53
    KHtml
54
    WindowSystem
Frederik Gladhorn's avatar
Frederik Gladhorn committed
55
56
)
find_package(Phonon4Qt5 CONFIG REQUIRED)
57
58
59

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

60
61
find_package(ZLIB REQUIRED)

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

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

67
 add_subdirectory( mobile )
68
69
70
71
72
73
74
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()

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

81
add_subdirectory(doc)
82

83
84
include(OkularConfigureChecks.cmake)

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

91
# okularcore
92

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

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

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

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

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

180
kconfig_add_kcfg_files(okularcore_SRCS conf/settings_core.kcfgc )
181

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

185
186
187
188
189
# 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
190
target_link_libraries(okularcore
191
PRIVATE
Frederik Gladhorn's avatar
Frederik Gladhorn committed
192
193
194
195
196
    ${OKULAR_IOKIT}
    KF5::Archive
    KF5::JS
    KF5::JSApi
    KF5::KIOCore
197
198
    KF5::KIOWidgets
    KF5::I18n
Frederik Gladhorn's avatar
Frederik Gladhorn committed
199
200
    KF5::ThreadWeaver
    KF5::Wallet
201
    KF5::Bookmarks
Frederik Gladhorn's avatar
Frederik Gladhorn committed
202
203
    Phonon::phonon4qt5
    ${MATH_LIB}
204
    ${ZLIB_LIBRARIES}
205
206
207
208
209
210
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
211
)
212

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

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

Laurent Montel's avatar
Laurent Montel committed
217
218
219
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})
220

221
222
# okularpart

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

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

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

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

298
kconfig_add_kcfg_files(okularpart_SRCS conf/settings.kcfgc )
299

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

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

319
set_target_properties(okularpart PROPERTIES PREFIX "")
320

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


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

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

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

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

336
337
########### cmake files #################

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

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

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

355
########### summary #################
356

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