CMakeLists.txt 9.77 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.8.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
19
20
include(KDEFrameworkCompilerSettings)
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
41
42
43
44
45
46
47
48
49
50
    Activities
    Archive
    Bookmarks
    Config
    ConfigWidgets
    CoreAddons
    DBusAddons
    JS
    KDELibs4Support
    KIO
    Parts
    ThreadWeaver
    Wallet
Vishesh Handa's avatar
Vishesh Handa committed
51
    KHtml
Frederik Gladhorn's avatar
Frederik Gladhorn committed
52
53
)
find_package(Phonon4Qt5 CONFIG REQUIRED)
54
55
56

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

57
58
find_package(ZLIB REQUIRED)

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

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

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

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

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

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

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

95
96
include(OkularConfigureChecks.cmake)

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

103
# okularcore
104

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

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

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

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

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

192
kconfig_add_kcfg_files(okularcore_SRCS conf/settings_core.kcfgc )
193

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

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

223
if(LibKScreen_FOUND)
224
225
    message("KF5: port code to KScreen")
    #target_link_libraries(okularcore KF5::LibKScreen)
226
227
endif(LibKScreen_FOUND)

228
set_target_properties(okularcore PROPERTIES VERSION 6.0.0 SOVERSION 6 OUTPUT_NAME Okular5Core EXPORT_NAME Core)
229

230
install(TARGETS okularcore EXPORT Okular5Targets ${KDE_INSTALL_TARGETS_DEFAULT_ARGS})
231

Laurent Montel's avatar
Laurent Montel committed
232
233
234
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})
235

236
237
# okularpart

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

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

299
300
301
302
303
if (Qt5TextToSpeech_FOUND)
   set(okularpart_SRCS ${okularpart_SRCS}
      ui/tts.cpp)
endif()

304
ki18n_wrap_ui(okularpart_SRCS
305
   conf/dlgaccessibilitybase.ui
306
   conf/dlgeditorbase.ui
307
   conf/dlggeneralbase.ui
308
   conf/dlgannotationsbase.ui
309
310
311
312
   conf/dlgperformancebase.ui
   conf/dlgpresentationbase.ui
)

313
kconfig_add_kcfg_files(okularpart_SRCS conf/settings.kcfgc )
314

315
add_library(okularpart SHARED ${okularpart_SRCS})
316
generate_export_header(okularpart BASE_NAME okularpart)
317

318
target_link_libraries(okularpart okularcore Qt5::Svg KF5::Parts ${MATH_LIB} Phonon::phonon4qt5 KF5::Solid KF5::KDELibs4Support KF5::Wallet KF5::Archive)
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