CMakeLists.txt 9.69 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

Albert Astals Cid's avatar
Albert Astals Cid committed
5
set(QT_REQUIRED_VERSION "5.6.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
set(CMAKE_MODULE_PATH ${CMAKE_MODULE_PATH} ${ECM_MODULE_PATH})

Aleix Pol Gonzalez's avatar
Aleix Pol Gonzalez committed
11
12
13
# KDE Application Version, managed by release script
set (KDE_APPLICATIONS_VERSION_MAJOR "16")
set (KDE_APPLICATIONS_VERSION_MINOR "11")
14
set (KDE_APPLICATIONS_VERSION_MICRO "80")
Aleix Pol Gonzalez's avatar
Aleix Pol Gonzalez committed
15
16
set (KDE_APPLICATIONS_VERSION "${KDE_APPLICATIONS_VERSION_MAJOR}.${KDE_APPLICATIONS_VERSION_MINOR}.${KDE_APPLICATIONS_VERSION_MICRO}")

Frederik Gladhorn's avatar
Frederik Gladhorn committed
17
18
19
include(ECMInstallIcons)
include(ECMSetupVersion)
include(ECMOptionalAddSubdirectory)
20
21
include(GenerateExportHeader)
include(FeatureSummary)
Laurent Montel's avatar
Laurent Montel committed
22
include(ECMAddAppIcon)
23
include(KDECompilerSettings NO_POLICY_SCOPE)
24
25
include(KDEInstallDirs)
include(KDECMakeSettings)
Vishesh Handa's avatar
Vishesh Handa committed
26
include(ECMAddTests)
27
include(ECMAddAppIcon)
28
29
include(ECMPackageConfigHelpers)

Aleix Pol Gonzalez's avatar
Aleix Pol Gonzalez committed
30
31
32
33
ecm_setup_version(0.99.${KDE_APPLICATIONS_VERSION_MICRO}
                  VARIABLE_PREFIX OKULAR
                  VERSION_HEADER "${CMAKE_CURRENT_BINARY_DIR}/core/version.h"
                  PACKAGE_VERSION_FILE "${CMAKE_CURRENT_BINARY_DIR}/Okular5ConfigVersion.cmake")
Frederik Gladhorn's avatar
Frederik Gladhorn committed
34

35
36
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)
37
38
39
40
41
42
if (NOT Qt5TextToSpeech_FOUND)
    message(STATUS "Qt5TextToSpeech not found, speech features will be disabled")
else()
    add_definitions(-DHAVE_SPEECH)
endif()

43
find_package(KF5 ${KF5_REQUIRED_VERSION} REQUIRED COMPONENTS
Frederik Gladhorn's avatar
Frederik Gladhorn committed
44
45
46
    Activities
    Archive
    Bookmarks
47
    Completion
Frederik Gladhorn's avatar
Frederik Gladhorn committed
48
49
50
51
    Config
    ConfigWidgets
    CoreAddons
    DBusAddons
52
    DocTools
53
    IconThemes
Frederik Gladhorn's avatar
Frederik Gladhorn committed
54
55
56
57
58
    JS
    KIO
    Parts
    ThreadWeaver
    Wallet
Vishesh Handa's avatar
Vishesh Handa committed
59
    KHtml
60
    WindowSystem
Frederik Gladhorn's avatar
Frederik Gladhorn committed
61
62
)
find_package(Phonon4Qt5 CONFIG REQUIRED)
63
64
65

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

66
67
find_package(ZLIB REQUIRED)

68
add_definitions(-DQT_USE_FAST_CONCATENATION -DQT_USE_FAST_OPERATOR_PLUS)
Lukáš Tinkl's avatar
Lukáš Tinkl committed
69
add_definitions(-DTRANSLATION_DOMAIN="okular")
Frederik Gladhorn's avatar
Frederik Gladhorn committed
70

71
include_directories(${CMAKE_CURRENT_SOURCE_DIR} ${PHONON_INCLUDES} core/synctex ${ZLIB_INCLUDE_DIR} ${CMAKE_BINARY_DIR}/core)
72

73
add_subdirectory( mobile )
74
75
76
77
78
79
80
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()

81
82
83
add_subdirectory( ui )
add_subdirectory( shell )
add_subdirectory( generators )
Laurent Montel's avatar
Laurent Montel committed
84
add_subdirectory( autotests )
85
add_subdirectory( conf/autotests )
Frederik Gladhorn's avatar
Frederik Gladhorn committed
86

87
add_subdirectory(doc)
88

89
90
include(OkularConfigureChecks.cmake)

Christian Ehrlicher's avatar
Christian Ehrlicher committed
91
92
93
94
95
if(NOT WIN32)
 set(MATH_LIB m)
else(NOT WIN32)
 set(MATH_LIB)
endif(NOT WIN32)
96

97
# okularcore
98

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

144
ki18n_wrap_ui(okularcore_SRCS
145
146
147
   conf/textdocumentsettings.ui
)

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

install( FILES
           interfaces/configinterface.h
           interfaces/guiinterface.h
           interfaces/printinterface.h
178
           interfaces/saveinterface.h
179
           interfaces/viewerinterface.h
Laurent Montel's avatar
Laurent Montel committed
180
         DESTINATION ${KDE_INSTALL_INCLUDEDIR}/okular/interfaces COMPONENT Devel)
181

182
ki18n_wrap_ui(okularcore_SRCS
183
   core/chooseenginewidget.ui
184
185
)

186
kconfig_add_kcfg_files(okularcore_SRCS conf/settings_core.kcfgc )
187

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

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

219
set_target_properties(okularcore PROPERTIES VERSION 7.0.0 SOVERSION 7 OUTPUT_NAME Okular5Core EXPORT_NAME Core)
220

221
install(TARGETS okularcore EXPORT Okular5Targets ${KDE_INSTALL_TARGETS_DEFAULT_ARGS})
222

Laurent Montel's avatar
Laurent Montel committed
223
224
225
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})
226

227
228
# okularpart

229
set(okularpart_conf_SRCS
230
231
   conf/preferencesdialog.cpp
   conf/dlgaccessibility.cpp
232
   conf/dlgdebug.cpp
233
   conf/dlgeditor.cpp
234
   conf/dlggeneral.cpp
235
   conf/dlgannotations.cpp
236
237
   conf/dlgperformance.cpp
   conf/dlgpresentation.cpp
238
239
   conf/editannottooldialog.cpp
   conf/editdrawingtooldialog.cpp
240
   conf/widgetannottools.cpp
241
242
243
244
245
246
247
248
   conf/widgetconfigurationtoolsbase.cpp
   conf/widgetdrawingtools.cpp
)

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

290
291
292
293
294
if (Qt5TextToSpeech_FOUND)
   set(okularpart_SRCS ${okularpart_SRCS}
      ui/tts.cpp)
endif()

295
ki18n_wrap_ui(okularpart_SRCS
296
   conf/dlgaccessibilitybase.ui
297
   conf/dlgeditorbase.ui
298
   conf/dlggeneralbase.ui
299
   conf/dlgannotationsbase.ui
300
301
302
303
   conf/dlgperformancebase.ui
   conf/dlgpresentationbase.ui
)

304
kconfig_add_kcfg_files(okularpart_SRCS conf/settings.kcfgc )
305

306
add_library(okularpart SHARED ${okularpart_SRCS})
307
generate_export_header(okularpart BASE_NAME okularpart)
308

309
310
311
312
313
target_link_libraries(okularpart okularcore
    ${MATH_LIB}
    Qt5::Svg
    Phonon::phonon4qt5
    KF5::Archive
314
    KF5::Bookmarks
315
    KF5::I18n
316
    KF5::IconThemes
Olivier Churlaud's avatar
Olivier Churlaud committed
317
    KF5::ItemViews
Olivier Churlaud's avatar
Olivier Churlaud committed
318
319
320
321
    KF5::KIOCore
    KF5::KIOFileWidgets
    KF5::KIOWidgets
    KF5::KIONTLM
322
323
324
325
326
327
    KF5::Parts
    KF5::Solid
    KF5::Wallet
    KF5::WindowSystem
)

328
set_target_properties(okularpart PROPERTIES PREFIX "")
329

330
331
332
if (Qt5TextToSpeech_FOUND)
   target_link_libraries(okularpart Qt5::TextToSpeech)
endif()
Laurent Montel's avatar
Laurent Montel committed
333
install(TARGETS okularpart DESTINATION ${KDE_INSTALL_PLUGINDIR})
334
335
336
337


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

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

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

343
344
install( FILES okular.categories DESTINATION ${KDE_INSTALL_CONFDIR} )

345
346
########### cmake files #################

347
set(CMAKECONFIG_INSTALL_DIR "${KDE_INSTALL_CMAKEPACKAGEDIR}/Okular5")
348
ecm_configure_package_config_file(
349
350
  "${CMAKE_CURRENT_SOURCE_DIR}/Okular5Config.cmake.in"
  "${CMAKE_CURRENT_BINARY_DIR}/Okular5Config.cmake"
351
352
353
354
355
  INSTALL_DESTINATION  ${CMAKECONFIG_INSTALL_DIR}
  PATH_VARS  INCLUDE_INSTALL_DIR CMAKE_INSTALL_PREFIX
)

install(FILES
356
357
  "${CMAKE_CURRENT_BINARY_DIR}/Okular5Config.cmake"
  "${CMAKE_CURRENT_BINARY_DIR}/Okular5ConfigVersion.cmake"
358
359
360
361
  DESTINATION "${CMAKECONFIG_INSTALL_DIR}"
  COMPONENT Devel
)

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

364
########### summary #################
365

Frederik Gladhorn's avatar
Frederik Gladhorn committed
366
feature_summary(WHAT ALL FATAL_ON_MISSING_REQUIRED_PACKAGES)
367