CMakeLists.txt 9.83 KB
Newer Older
1
cmake_minimum_required(VERSION 2.8.9)
Albert Astals Cid's avatar
Albert Astals Cid committed
2
project(okular)
3

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

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

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

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

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

29
30
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)
31
32
33
34
35
36
if (NOT Qt5TextToSpeech_FOUND)
    message(STATUS "Qt5TextToSpeech not found, speech features will be disabled")
else()
    add_definitions(-DHAVE_SPEECH)
endif()

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

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

58
59
find_package(ZLIB REQUIRED)

Frederik Gladhorn's avatar
Frederik Gladhorn committed
60
61
62
63
64
65
66
# 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.")
67

68
find_package(KF5Screen)
Frederik Gladhorn's avatar
Frederik Gladhorn committed
69
70
71
72
73
set_package_properties("LibKScreen" PROPERTIES
        DESCRIPTION "KDE screen management library"
        URL "https://projects.kde.org/projects/kdereview/libkscreen"
        TYPE RECOMMENDED
        PURPOSE "DPI detection support")
74

75
add_definitions(-DQT_USE_FAST_CONCATENATION -DQT_USE_FAST_OPERATOR_PLUS)
Lukáš Tinkl's avatar
Lukáš Tinkl committed
76
add_definitions(-DTRANSLATION_DOMAIN="okular")
Frederik Gladhorn's avatar
Frederik Gladhorn committed
77

78
include_directories(${CMAKE_CURRENT_SOURCE_DIR} ${PHONON_INCLUDES} core/synctex ${ZLIB_INCLUDE_DIR} ${CMAKE_BINARY_DIR}/core)
79

Marco Martin's avatar
Marco Martin committed
80
add_subdirectory( mobile )
81
82
83
84
85
86
87
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()

88
89
90
add_subdirectory( ui )
add_subdirectory( shell )
add_subdirectory( generators )
Laurent Montel's avatar
Laurent Montel committed
91
add_subdirectory( autotests )
92
add_subdirectory( conf/autotests )
Frederik Gladhorn's avatar
Frederik Gladhorn committed
93

Marco Martin's avatar
Marco Martin committed
94
add_subdirectory(doc)
95

96
97
include(OkularConfigureChecks.cmake)

Christian Ehrlicher's avatar
Christian Ehrlicher committed
98
99
100
101
102
if(NOT WIN32)
 set(MATH_LIB m)
else(NOT WIN32)
 set(MATH_LIB)
endif(NOT WIN32)
103

104
# okularcore
105

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

151
ki18n_wrap_ui(okularcore_SRCS
152
153
154
   conf/textdocumentsettings.ui
)

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

install( FILES
           interfaces/configinterface.h
           interfaces/guiinterface.h
           interfaces/printinterface.h
185
           interfaces/saveinterface.h
186
           interfaces/viewerinterface.h
Laurent Montel's avatar
Laurent Montel committed
187
         DESTINATION ${KDE_INSTALL_INCLUDEDIR}/okular/interfaces COMPONENT Devel)
188

189
ki18n_wrap_ui(okularcore_SRCS
190
   core/chooseenginewidget.ui
191
192
)

193
kconfig_add_kcfg_files(okularcore_SRCS conf/settings_core.kcfgc )
194

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

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

226
if(LibKScreen_FOUND)
227
228
    message("KF5: port code to KScreen")
    #target_link_libraries(okularcore KF5::LibKScreen)
229
230
endif(LibKScreen_FOUND)

231
set_target_properties(okularcore PROPERTIES VERSION 6.0.0 SOVERSION 6 OUTPUT_NAME Okular5Core EXPORT_NAME Core)
232

233
install(TARGETS okularcore EXPORT Okular5Targets ${KDE_INSTALL_TARGETS_DEFAULT_ARGS})
234

Laurent Montel's avatar
Laurent Montel committed
235
236
237
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})
238

239
240
# okularpart

241
set(okularpart_conf_SRCS
242
243
   conf/preferencesdialog.cpp
   conf/dlgaccessibility.cpp
244
   conf/dlgdebug.cpp
245
   conf/dlgeditor.cpp
246
   conf/dlggeneral.cpp
247
   conf/dlgannotations.cpp
248
249
   conf/dlgperformance.cpp
   conf/dlgpresentation.cpp
250
251
   conf/editannottooldialog.cpp
   conf/editdrawingtooldialog.cpp
252
   conf/widgetannottools.cpp
253
254
255
256
257
258
259
260
   conf/widgetconfigurationtoolsbase.cpp
   conf/widgetdrawingtools.cpp
)

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

302
303
304
305
306
if (Qt5TextToSpeech_FOUND)
   set(okularpart_SRCS ${okularpart_SRCS}
      ui/tts.cpp)
endif()

307
ki18n_wrap_ui(okularpart_SRCS
308
   conf/dlgaccessibilitybase.ui
309
   conf/dlgeditorbase.ui
310
   conf/dlggeneralbase.ui
311
   conf/dlgannotationsbase.ui
312
313
314
315
   conf/dlgperformancebase.ui
   conf/dlgpresentationbase.ui
)

316
kconfig_add_kcfg_files(okularpart_SRCS conf/settings.kcfgc )
317

318
add_library(okularpart SHARED ${okularpart_SRCS})
319
generate_export_header(okularpart BASE_NAME okularpart)
320

321
target_link_libraries(okularpart okularcore Qt5::Svg KF5::Parts ${MATH_LIB} Phonon::phonon4qt5 KF5::Solid KF5::KDELibs4Support KF5::Wallet KF5::Archive)
322

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


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

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

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

336
337
install( FILES okular.categories DESTINATION ${KDE_INSTALL_CONFDIR} )

338
339
########### cmake files #################

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

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

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

357
########### summary #################
358

Frederik Gladhorn's avatar
Frederik Gladhorn committed
359
feature_summary(WHAT ALL FATAL_ON_MISSING_REQUIRED_PACKAGES)
360