CMakeLists.txt 10 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
# KDE Application Version, managed by release script
12
set (KDE_APPLICATIONS_VERSION_MAJOR "17")
13 14
set (KDE_APPLICATIONS_VERSION_MINOR "04")
set (KDE_APPLICATIONS_VERSION_MICRO "0")
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)

Albert Astals Cid's avatar
Albert Astals Cid committed
30
ecm_setup_version(1.1.${KDE_APPLICATIONS_VERSION_MICRO}
Aleix Pol Gonzalez's avatar
Aleix Pol Gonzalez committed
31 32 33
                  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
    Archive
    Bookmarks
46
    Completion
Frederik Gladhorn's avatar
Frederik Gladhorn committed
47 48 49 50
    Config
    ConfigWidgets
    CoreAddons
    DBusAddons
51
    DocTools
52
    IconThemes
Frederik Gladhorn's avatar
Frederik Gladhorn committed
53 54 55 56 57
    JS
    KIO
    Parts
    ThreadWeaver
    Wallet
58
    WindowSystem
Frederik Gladhorn's avatar
Frederik Gladhorn committed
59
)
60 61 62 63 64
if(NOT WIN32)
    find_package(KF5 ${KF5_REQUIRED_VERSION} REQUIRED COMPONENTS
        Activities
    )
endif()
Frederik Gladhorn's avatar
Frederik Gladhorn committed
65
find_package(Phonon4Qt5 CONFIG REQUIRED)
66 67 68

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

69 70
find_package(ZLIB REQUIRED)

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

74
include_directories(${CMAKE_CURRENT_SOURCE_DIR} ${PHONON_INCLUDES} core/synctex ${ZLIB_INCLUDE_DIR} ${CMAKE_BINARY_DIR}/core)
75

76
add_subdirectory( mobile )
77 78
option(BUILD_COVERAGE "Build the project with gcov support" OFF)

Albert Astals Cid's avatar
Albert Astals Cid committed
79 80 81 82 83 84
if (CMAKE_CXX_COMPILER_ID STREQUAL "GNU")
    if (NOT CMAKE_CXX_COMPILER_VERSION VERSION_LESS "5.0.0")
        set(CMAKE_CXX_FLAGS "${CMAKE_CXX_FLAGS} -Wsuggest-override" )
    endif()
endif()

85 86 87 88 89
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()

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

96
add_subdirectory(doc)
97

98 99
include(OkularConfigureChecks.cmake)

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

106
# okularcore
107

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

153
ki18n_wrap_ui(okularcore_SRCS
154 155 156
   conf/textdocumentsettings.ui
)

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

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

191
ki18n_wrap_ui(okularcore_SRCS
192
   core/chooseenginewidget.ui
193 194
)

195
kconfig_add_kcfg_files(okularcore_SRCS conf/settings_core.kcfgc )
196

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

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

228
set_target_properties(okularcore PROPERTIES VERSION 7.0.0 SOVERSION 7 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/okmenutitle.cpp
277
   ui/pageitemdelegate.cpp
278
   ui/pagepainter.cpp
Albert Astals Cid's avatar
Albert Astals Cid committed
279
   ui/pagesizelabel.cpp
280
   ui/pageviewannotator.cpp
281
   ui/pageviewmouseannotation.cpp
282
   ui/pageview.cpp
Michal Humpula's avatar
Michal Humpula committed
283
   ui/magnifierview.cpp
284
   ui/pageviewutils.cpp
285
   ui/presentationsearchbar.cpp
286 287
   ui/presentationwidget.cpp
   ui/propertiesdialog.cpp
288
   ui/searchlineedit.cpp
289
   ui/searchwidget.cpp
Pino Toscano's avatar
Pino Toscano committed
290
   ui/sidebar.cpp
291
   ui/side_reviews.cpp
292
   ui/snapshottaker.cpp
293 294
   ui/thumbnaillist.cpp
   ui/toc.cpp
295
   ui/tocmodel.cpp
296
   ui/toolaction.cpp
297
   ui/videowidget.cpp
298
   ui/layers.cpp
299
)
300

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

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

315
kconfig_add_kcfg_files(okularpart_SRCS conf/settings.kcfgc )
316

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

320 321 322 323 324
target_link_libraries(okularpart okularcore
    ${MATH_LIB}
    Qt5::Svg
    Phonon::phonon4qt5
    KF5::Archive
325
    KF5::Bookmarks
326
    KF5::I18n
327
    KF5::IconThemes
Olivier Churlaud's avatar
Olivier Churlaud committed
328
    KF5::ItemViews
Olivier Churlaud's avatar
Olivier Churlaud committed
329 330 331 332
    KF5::KIOCore
    KF5::KIOFileWidgets
    KF5::KIOWidgets
    KF5::KIONTLM
333 334 335 336 337 338
    KF5::Parts
    KF5::Solid
    KF5::Wallet
    KF5::WindowSystem
)

339
set_target_properties(okularpart PROPERTIES PREFIX "")
340

341 342 343
if (Qt5TextToSpeech_FOUND)
   target_link_libraries(okularpart Qt5::TextToSpeech)
endif()
Laurent Montel's avatar
Laurent Montel committed
344
install(TARGETS okularpart DESTINATION ${KDE_INSTALL_PLUGINDIR})
345 346 347 348


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

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

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

354 355
install( FILES okular.categories DESTINATION ${KDE_INSTALL_CONFDIR} )

356 357
########### cmake files #################

358
set(CMAKECONFIG_INSTALL_DIR "${KDE_INSTALL_CMAKEPACKAGEDIR}/Okular5")
359
ecm_configure_package_config_file(
360 361
  "${CMAKE_CURRENT_SOURCE_DIR}/Okular5Config.cmake.in"
  "${CMAKE_CURRENT_BINARY_DIR}/Okular5Config.cmake"
362 363 364 365 366
  INSTALL_DESTINATION  ${CMAKECONFIG_INSTALL_DIR}
  PATH_VARS  INCLUDE_INSTALL_DIR CMAKE_INSTALL_PREFIX
)

install(FILES
367 368
  "${CMAKE_CURRENT_BINARY_DIR}/Okular5Config.cmake"
  "${CMAKE_CURRENT_BINARY_DIR}/Okular5ConfigVersion.cmake"
369 370 371 372
  DESTINATION "${CMAKECONFIG_INSTALL_DIR}"
  COMPONENT Devel
)

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

375
########### summary #################
376

Frederik Gladhorn's avatar
Frederik Gladhorn committed
377
feature_summary(WHAT ALL FATAL_ON_MISSING_REQUIRED_PACKAGES)
378