CMakeLists.txt 9.61 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)

Frederik Gladhorn's avatar
Frederik Gladhorn committed
61
62
63
64
65
66
67
# There was no Qt 5 version at the time of porting
#find_package(QImageBlitz)
#set_package_properties("QImageBlitz" PROPERTIES
#        DESCRIPTION "An image effects library"
#        URL "http://sourceforge.net/projects/qimageblitz"
#        TYPE RECOMMENDED
#        PURPOSE "Required to build Okular.")
68

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

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

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

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

88
add_subdirectory(doc)
89

90
91
include(OkularConfigureChecks.cmake)

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

98
# okularcore
99

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

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

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

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

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

187
kconfig_add_kcfg_files(okularcore_SRCS conf/settings_core.kcfgc )
188

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

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

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

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

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

228
229
# okularpart

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

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

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

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

305
kconfig_add_kcfg_files(okularpart_SRCS conf/settings.kcfgc )
306

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

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

326
set_target_properties(okularpart PROPERTIES PREFIX "")
327

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


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

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

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

341
342
install( FILES okular.categories DESTINATION ${KDE_INSTALL_CONFDIR} )

343
344
########### cmake files #################

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

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

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

362
########### summary #################
363

Frederik Gladhorn's avatar
Frederik Gladhorn committed
364
feature_summary(WHAT ALL FATAL_ON_MISSING_REQUIRED_PACKAGES)
365