CMakeLists.txt 8.6 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
6
set(QT_REQUIRED_VERSION "5.2.0")
set(KF5_REQUIRED_VERSION "5.8.0")
Frederik Gladhorn's avatar
Frederik Gladhorn committed
7

Laurent Montel's avatar
Laurent Montel committed
8
find_package(ECM 1.7.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
18
19
include(KDEFrameworkCompilerSettings)
include(KDEInstallDirs)
include(KDECMakeSettings)
Vishesh Handa's avatar
Vishesh Handa committed
20
include(ECMAddTests)
Laurent Montel's avatar
Laurent Montel committed
21
include(ECMAddAppIcon) 
Frederik Gladhorn's avatar
Frederik Gladhorn committed
22

23
24
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)
25
26
27
28
29
30
if (NOT Qt5TextToSpeech_FOUND)
    message(STATUS "Qt5TextToSpeech not found, speech features will be disabled")
else()
    add_definitions(-DHAVE_SPEECH)
endif()

31
find_package(KF5 ${KF5_REQUIRED_VERSION} REQUIRED COMPONENTS
Frederik Gladhorn's avatar
Frederik Gladhorn committed
32
33
34
35
36
37
38
39
40
41
42
43
44
    Activities
    Archive
    Bookmarks
    Config
    ConfigWidgets
    CoreAddons
    DBusAddons
    JS
    KDELibs4Support
    KIO
    Parts
    ThreadWeaver
    Wallet
Vishesh Handa's avatar
Vishesh Handa committed
45
    KHtml
Frederik Gladhorn's avatar
Frederik Gladhorn committed
46
47
)
find_package(Phonon4Qt5 CONFIG REQUIRED)
48
49
50

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

51
52
find_package(ZLIB REQUIRED)

Frederik Gladhorn's avatar
Frederik Gladhorn committed
53
54
55
56
57
58
59
# 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.")
60

61
find_package(KF5Screen)
Frederik Gladhorn's avatar
Frederik Gladhorn committed
62
63
64
65
66
set_package_properties("LibKScreen" PROPERTIES
        DESCRIPTION "KDE screen management library"
        URL "https://projects.kde.org/projects/kdereview/libkscreen"
        TYPE RECOMMENDED
        PURPOSE "DPI detection support")
67

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})
72

73
add_subdirectory( active )
74
75
76
add_subdirectory( ui )
add_subdirectory( shell )
add_subdirectory( generators )
Laurent Montel's avatar
Laurent Montel committed
77
add_subdirectory( autotests )
Frederik Gladhorn's avatar
Frederik Gladhorn committed
78

Arnold Dumas's avatar
Arnold Dumas committed
79
add_subdirectory(doc)
80

81
82
include(OkularConfigureChecks.cmake)

Christian Ehrlicher's avatar
Christian Ehrlicher committed
83
84
85
86
87
if(NOT WIN32)
 set(MATH_LIB m)
else(NOT WIN32)
 set(MATH_LIB)
endif(NOT WIN32)
88

89
# okularcore
90

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

136
ki18n_wrap_ui(okularcore_SRCS
137
138
139
   conf/textdocumentsettings.ui
)

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

install( FILES
           interfaces/configinterface.h
           interfaces/guiinterface.h
           interfaces/printinterface.h
170
           interfaces/saveinterface.h
171
           interfaces/viewerinterface.h
Laurent Montel's avatar
Laurent Montel committed
172
         DESTINATION ${KDE_INSTALL_INCLUDEDIR}/okular/interfaces COMPONENT Devel)
173

174
ki18n_wrap_ui(okularcore_SRCS
175
   core/chooseenginewidget.ui
176
177
)

178
kconfig_add_kcfg_files(okularcore_SRCS conf/settings_core.kcfgc )
179

Laurent Montel's avatar
Minor    
Laurent Montel committed
180
add_library(okularcore SHARED ${okularcore_SRCS})
181
generate_export_header(okularcore BASE_NAME okularcore)
182
target_include_directories(okularcore INTERFACE "$<INSTALL_INTERFACE:${KDE_INSTALL_INCLUDEDIR}>")
183

184
185
186
187
188
# 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
189
target_link_libraries(okularcore
190
PRIVATE
Frederik Gladhorn's avatar
Frederik Gladhorn committed
191
192
193
194
195
196
197
198
199
200
    ${OKULAR_IOKIT}
    KF5::Archive
    KF5::JS
    KF5::JSApi
    KF5::KDELibs4Support
    KF5::KIOCore
    KF5::ThreadWeaver
    KF5::Wallet
    Phonon::phonon4qt5
    ${MATH_LIB}
201
    ${ZLIB_LIBRARIES}
202
203
204
205
206
207
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
208
)
209

210
if(LibKScreen_FOUND)
211
212
    message("KF5: port code to KScreen")
    #target_link_libraries(okularcore KF5::LibKScreen)
213
214
endif(LibKScreen_FOUND)

215
set_target_properties(okularcore PROPERTIES VERSION 6.0.0 SOVERSION 6 )
216

Laurent Montel's avatar
Laurent Montel committed
217
install(TARGETS okularcore ${KDE_INSTALL_TARGETS_DEFAULT_ARGS} )
218

Laurent Montel's avatar
Laurent Montel committed
219
220
221
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})
222

223
224
225
226
# okularpart

set(okularpart_SRCS
   part.cpp
227
   extensions.cpp
228
229
   conf/preferencesdialog.cpp
   conf/dlgaccessibility.cpp
230
   conf/dlgdebug.cpp
231
   conf/dlgeditor.cpp
232
   conf/dlggeneral.cpp
233
   conf/dlgannotations.cpp
234
235
   conf/dlgperformance.cpp
   conf/dlgpresentation.cpp
236
   conf/widgetannottools.cpp
237
   ui/embeddedfilesdialog.cpp
238
   ui/annotwindow.cpp
239
   ui/annotationmodel.cpp
240
   ui/annotationpopup.cpp
241
   ui/annotationpropertiesdialog.cpp
242
   ui/annotationproxymodels.cpp
243
   ui/annotationtools.cpp
Pino Toscano's avatar
Pino Toscano committed
244
   ui/annotationwidgets.cpp
245
   ui/bookmarklist.cpp
Frederik Gladhorn's avatar
Frederik Gladhorn committed
246
   ui/debug_ui.cpp
247
   ui/fileprinterpreview.cpp
248
   ui/findbar.cpp
249
   ui/formwidgets.cpp
Pino Toscano's avatar
Pino Toscano committed
250
   ui/guiutils.cpp
251
   ui/ktreeviewsearchline.cpp
252
   ui/latexrenderer.cpp
253
   ui/minibar.cpp
254
   ui/pageitemdelegate.cpp
255
   ui/pagepainter.cpp
Albert Astals Cid's avatar
Albert Astals Cid committed
256
   ui/pagesizelabel.cpp
257
258
   ui/pageviewannotator.cpp
   ui/pageview.cpp
Michal Humpula's avatar
Michal Humpula committed
259
   ui/magnifierview.cpp
260
   ui/pageviewutils.cpp
261
   ui/presentationsearchbar.cpp
262
263
   ui/presentationwidget.cpp
   ui/propertiesdialog.cpp
264
   ui/searchlineedit.cpp
265
   ui/searchwidget.cpp
Pino Toscano's avatar
Pino Toscano committed
266
   ui/sidebar.cpp
267
   ui/side_reviews.cpp
268
   ui/snapshottaker.cpp
269
270
   ui/thumbnaillist.cpp
   ui/toc.cpp
271
   ui/tocmodel.cpp
272
   ui/toolaction.cpp
273
   ui/videowidget.cpp
274
)
275

276
277
278
279
280
if (Qt5TextToSpeech_FOUND)
   set(okularpart_SRCS ${okularpart_SRCS}
      ui/tts.cpp)
endif()

281
ki18n_wrap_ui(okularpart_SRCS
282
   conf/dlgaccessibilitybase.ui
283
   conf/dlgeditorbase.ui
284
   conf/dlggeneralbase.ui
285
   conf/dlgannotationsbase.ui
286
287
288
289
   conf/dlgperformancebase.ui
   conf/dlgpresentationbase.ui
)

290
kconfig_add_kcfg_files(okularpart_SRCS conf/settings.kcfgc )
291

Laurent Montel's avatar
Minor    
Laurent Montel committed
292
#qt5_add_dbus_interfaces(okularpart_SRCS ${KDE4_DBUS_INTERFACES_DIR}/org.kde.KSpeech.xml)
293

294
add_library(okularpart MODULE ${okularpart_SRCS})
295
generate_export_header(okularpart BASE_NAME okularpart)
296

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

299
300
301
if (Qt5TextToSpeech_FOUND)
   target_link_libraries(okularpart Qt5::TextToSpeech)
endif()
Laurent Montel's avatar
Laurent Montel committed
302
install(TARGETS okularpart DESTINATION ${KDE_INSTALL_PLUGINDIR})
303
304
305
306


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

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

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

312
313
########### cmake files #################

Frederik Gladhorn's avatar
Frederik Gladhorn committed
314
include(WriteBasicConfigVersionFile)
Frederik Gladhorn's avatar
Frederik Gladhorn committed
315
write_basic_config_version_file(${CMAKE_CURRENT_BINARY_DIR}/OkularConfigVersion.cmake VERSION 1.0.0 COMPATIBILITY AnyNewerVersion)
316
317
318

install(FILES ${CMAKE_CURRENT_SOURCE_DIR}/OkularConfig.cmake
              ${CMAKE_CURRENT_BINARY_DIR}/OkularConfigVersion.cmake
Laurent Montel's avatar
Laurent Montel committed
319
        DESTINATION ${KDE_INSTALL_LIBDIR}/cmake/Okular )
320

Frederik Gladhorn's avatar
Frederik Gladhorn committed
321
feature_summary(WHAT ALL FATAL_ON_MISSING_REQUIRED_PACKAGES)
322