CMakeLists.txt 12.7 KB
Newer Older
1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 28 29 30 31 32 33 34 35 36 37 38 39 40 41 42 43 44 45 46 47 48 49 50 51 52 53 54 55 56 57 58 59 60 61 62 63 64 65 66 67 68 69 70 71 72 73 74 75 76 77 78 79 80 81 82 83 84 85 86 87


add_definitions( -DQT_NO_CAST_FROM_ASCII )
add_definitions( -DQT_NO_CAST_TO_ASCII )


add_definitions(-DTRANSLATION_DOMAIN=\"libmessageviewer\")

# KCFG files:
# The main messageviewer.kcfg is configured by CMake and put in the build directory.

if(KDEPIM_ENTERPRISE_BUILD)
  set(LEGACY_MANGLE_FROM_TO_HEADERS true)
  set(LEGACY_BODY_INVITES true)
  set(EXCHANGE_COMPATIBLE_INVITATIONS true)
  set(OUTLOOK_COMPATIBLE_INVITATION_REPLY_COMMENTS true)
else()
  set(LEGACY_MANGLE_FROM_TO_HEADERS false)
  set(LEGACY_BODY_INVITES false)
  set(EXCHANGE_COMPATIBLE_INVITATIONS false)
  set(OUTLOOK_COMPATIBLE_INVITATION_REPLY_COMMENTS false)
endif()

configure_file(settings/messageviewer.kcfg.cmake ${CMAKE_CURRENT_BINARY_DIR}/messageviewer.kcfg)
include(CheckIncludeFiles)
check_include_files(sys/inotify.h SYS_INOTIFY_H_FOUND)
macro_bool_to_01(SYS_INOTIFY_H_FOUND HAVE_SYS_INOTIFY_H)
configure_file(config-messageviewer.h.cmake ${CMAKE_CURRENT_BINARY_DIR}/config-messageviewer.h)

# target_include_directories does not handle empty include paths
include_directories(${GPGME_INCLUDES})

if(BUILD_TESTING)
   add_subdirectory(scamdetection/autotests)
   add_subdirectory(findbar/autotests)
   add_subdirectory(scamdetection/tests)
   add_subdirectory(adblock/tests/)
   add_subdirectory(viewerplugins/tests/)
endif()
add_subdirectory(pics)
add_subdirectory(kconf_update)
add_subdirectory(about)

if(DEBUG_SIGNATURE)
   add_definitions(-DDEBUG_SIGNATURE)
endif()

set(_mailwebview_cpp viewer/mailwebview.cpp 
                       adblock/networkaccessmanager.cpp 
                       adblock/webpage.cpp
                       adblock/adblockelementhiding.cpp
                       adblock/adblockhostmatcher.cpp
                       adblock/adblockmanager.cpp
                       adblock/adblockrule.cpp
                       adblock/adblockrulefallbackimpl.cpp
                       adblock/adblockrulenullimpl.cpp
                       adblock/adblockruletextmatchimpl.cpp
                       adblock/adblocksettingwidget.cpp
                       adblock/adblockutil.cpp
                       adblock/adblockaddsubscriptiondialog.cpp
                       adblock/adblocklistwidget.cpp
                       adblock/adblocksyntaxhighlighter.cpp
                       adblock/adblockshowlistdialog.cpp
                       adblock/adblockblockableitemsdialog.cpp
                       adblock/adblockcreatefilterdialog.cpp
                       adblock/adblockblockableitemswidget.cpp
                       )

set(libmessageviewer_viewer_SRCS
  viewer/attachmentstrategy.cpp
  viewer/bodypartformatter.cpp
  viewer/bodypartformatterfactory.cpp
  viewer/cryptohelper.cpp
  viewer/csshelper.cpp
  viewer/csshelperbase.cpp
  viewer/editorwatcher.cpp
  viewer/htmlquotecolorer.cpp
  viewer/mimeparttree/mimetreemodel.cpp
  viewer/nodehelper.cpp
  viewer/objecttreeemptysource.cpp
  viewer/objecttreeparser.cpp
  viewer/objecttreeviewersource.cpp
  viewer/messagepart.cpp
  viewer/partnodebodypart.cpp
  viewer/pluginloaderbase.cpp
  viewer/viewer.cpp
  viewer/viewer_p.cpp
88
  viewer/webviewaccesskey.cpp
89 90 91 92 93 94 95 96 97 98 99 100 101 102 103 104 105 106 107 108 109 110 111 112 113 114 115 116 117 118 119 120 121 122 123 124 125 126 127 128 129 130 131 132 133 134 135 136 137 138 139 140 141 142 143 144 145 146 147 148 149 150 151 152 153 154 155 156 157 158 159 160 161 162 163 164 165 166 167 168 169 170 171 172 173 174 175 176 177 178 179 180 181 182 183 184 185 186 187 188 189 190 191 192 193 194 195 196 197 198 199 200 201 202 203 204 205 206 207 208 209 210 211 212 213 214 215 216 217 218 219 220 221 222 223 224 225
  viewer/messagedisplayformatattribute.cpp
  viewer/urlhandlermanager.cpp
  viewer/mimeparttree/mimeparttreeview.cpp
  viewer/converthtmltoplaintext.cpp
  viewer/memento/cryptobodypartmemento.cpp
  viewer/memento/decryptverifybodypartmemento.cpp
  viewer/memento/verifydetachedbodypartmemento.cpp
  viewer/memento/verifyopaquebodypartmemento.cpp
)

set(libmessageviewer_widgets_SRCS
  widgets/customheadersettingdialog.cpp
  widgets/attachmentdialog.cpp
  widgets/configurewidget.cpp
  widgets/printingsettings.cpp
  widgets/htmlstatusbar.cpp
  widgets/vcardviewer.cpp
  widgets/invitationsettings.cpp
  widgets/openattachmentfolderwidget.cpp
  widgets/mailsourceviewer.cpp
  widgets/mailsourceviewtextbrowserwidget.cpp
  widgets/zoomactionmenu.cpp
  widgets/customheadersettingwidget.cpp
)

set(libmessageviewer_header_SRCS
  header/contactdisplaymessagememento.cpp
  header/headerstrategy.cpp
  header/richheaderstrategy.cpp
  header/headerstyle.cpp
  header/grantleeheaderstyle.cpp
  header/plainheaderstyle.cpp
  header/headerstyle_util.cpp
  header/grantleeheaderformatter.cpp
  header/grantleeheaderteststyle.cpp
  header/kxface.cpp
  header/headerstyleplugin.cpp
  header/headerstylepluginmanager.cpp
  header/headerstyleinterface.cpp
  header/headerstylemenumanager.cpp
)

set(libmessageviewer_scamdetection_SRCS
  scamdetection/scamdetectionwarningwidget.cpp
  scamdetection/scamdetection.cpp
  scamdetection/scamdetectiondetailsdialog.cpp
  scamdetection/scamattribute.cpp
  scamdetection/scamcheckshorturl.cpp
)

set(libmessageviewer_findbar_SRCS
  findbar/findbarbase.cpp
  findbar/findbarmailwebview.cpp
  findbar/findbarsourceview.cpp
)

set(libmessageviewer_utils_SRCS
  utils/iconnamecache.cpp
  utils/markmessagereadhandler.cpp
  utils/messageviewerutil.cpp
)

set(libmessageviewer_htmlwriter_SRCS
  htmlwriter/filehtmlwriter.cpp
  htmlwriter/queuehtmlwriter.cpp
  htmlwriter/teehtmlwriter.cpp
  htmlwriter/webkitparthtmlwriter.cpp
)

set(libmessageviewer_antispam_SRCS
  antispam/spamheaderanalyzer.cpp
  antispam/antispamconfig.cpp
)

set(libmessageviewer_job_SRCS
  job/createtodojob.cpp
  job/createeventjob.cpp
  job/createnotejob.cpp
  job/attachmenteditjob.cpp
  job/modifymessagedisplayformatjob.cpp
  job/kleojobexecutor.cpp
)

set(libmessageviewer_viewerplugins_SRCS
   viewerplugins/viewerpluginmanager.cpp
   viewerplugins/viewerplugin.cpp
   viewerplugins/viewerplugininterface.cpp
   viewerplugins/viewerplugintoolmanager.cpp
)

set(libmessageviewer_SRCS
  ${libmessageviewer_viewer_SRCS}
  ${libmessageviewer_widgets_SRCS}
  ${libmessageviewer_header_SRCS}
  ${libmessageviewer_scamdetection_SRCS}
  ${libmessageviewer_findbar_SRCS}
  ${libmessageviewer_utils_SRCS}
  ${libmessageviewer_htmlwriter_SRCS}
  ${libmessageviewer_antispam_SRCS}
  ${libmessageviewer_job_SRCS}
  ${libmessageviewer_viewerplugins_SRCS}
  settings/messageviewersettings.cpp
  ${_mailwebview_cpp}
)

ecm_qt_declare_logging_category(libmessageviewer_SRCS HEADER messageviewer_debug.h IDENTIFIER MESSAGEVIEWER_LOG CATEGORY_NAME log_messageviewer)

kconfig_add_kcfg_files(libmessageviewer_SRCS
  settings/globalsettings_messageviewer.kcfgc
)

ki18n_wrap_ui(libmessageviewer_SRCS
  ui/settings.ui
  ui/invitationsettings.ui
  ui/printingsettings.ui
  adblock/ui/settings_adblock.ui
  adblock/ui/adblockcreatefilterwidget.ui
)


add_library(KF5MessageViewer ${libmessageviewer_SRCS})
generate_export_header(KF5MessageViewer BASE_NAME messageviewer)
add_library(KF5::MessageViewer ALIAS KF5MessageViewer)

target_include_directories(KF5MessageViewer INTERFACE "$<INSTALL_INTERFACE:${KDE_INSTALL_INCLUDEDIR_KF5}/MessageViewer/;${KDE_INSTALL_INCLUDEDIR_KF5}/messageviewer>")
target_include_directories(KF5MessageViewer PUBLIC "$<BUILD_INTERFACE:${MessageViewer_SOURCE_DIR}/src;${MessageViewer_BINARY_DIR}/src;>")

target_link_libraries(KF5MessageViewer
PUBLIC
  KF5::MessageCore
  KF5::PimCommon
  KF5::AkonadiCore
  KF5::AkonadiMime
  KF5::Contacts
  KF5::Libkleo
PRIVATE
  KF5::ItemViews
Laurent Montel's avatar
Laurent Montel committed
226 227
  KF5::WebKit 
  Qt5::WebKitWidgets
228 229 230 231 232 233 234 235 236 237 238 239 240 241 242 243 244 245 246 247 248 249 250 251 252 253 254 255 256 257 258 259 260 261 262 263 264 265 266 267 268 269 270 271 272 273 274
  KF5::Libkdepim
  KF5::GrantleeTheme
  KF5::KaddressbookGrantlee
  Grantlee5::TextDocument
  Grantlee5::Templates
  KF5::MailTransport
  KF5::Mime
  KF5::Mbox
  KF5::KDELibs4Support
  KF5::AkonadiNotes
  KF5::PimTextEdit
  KF5::CalendarCore
  KF5::Gravatar
)
if (WIN32)
  target_link_libraries(KF5MessageViewer PUBLIC KF5::Gpgmepp)
else()
  target_link_libraries(KF5MessageViewer PUBLIC KF5::Gpgmepp-pthread)
endif()

target_include_directories(KF5MessageViewer PUBLIC $<TARGET_PROPERTY:KF5::WebKit,INTERFACE_INCLUDE_DIRECTORIES>)

set_target_properties(KF5MessageViewer PROPERTIES
    VERSION ${MESSAGEVIEWER_VERSION_STRING}
    SOVERSION ${MESSAGEVIEWER_SOVERSION}
    EXPORT_NAME MessageViewer
)

install(TARGETS
    KF5MessageViewer
    EXPORT KF5MessageViewerTargets ${KF5_INSTALL_TARGETS_DEFAULT_ARGS} ${LIBRARY_NAMELINK}
)

ecm_generate_headers(MessageViewer_Camelcaseviewer_HEADERS
  HEADER_NAMES
  Viewer
  CSSHelper
  PartMetaData
  ObjectTreeParser
  ObjectTreeEmptySource
  AttachmentStrategy
  NodeHelper
  EditorWatcher
  Stl_Util
  CSSHelperBase
  MailWebView
  MessagePart
275
  WebViewAccessKey
276 277 278 279 280 281 282 283 284 285 286 287 288 289 290 291 292 293 294 295 296 297 298 299 300 301 302 303 304 305 306 307 308 309 310 311 312 313 314 315 316 317 318 319 320 321 322 323 324 325 326 327 328 329 330 331 332 333 334 335 336 337 338 339 340 341 342 343 344 345 346 347 348 349 350 351 352 353 354 355 356 357 358 359 360 361 362 363 364 365 366 367
  REQUIRED_HEADERS MessageViewer_viewer_HEADERS
  PREFIX MessageViewer
  RELATIVE viewer
)

ecm_generate_headers(MessageViewer_Camelcasemain_HEADERS
  HEADER_NAMES
  ObjectTreeSourceIf
  REQUIRED_HEADERS MessageViewer_main_HEADERS
  PREFIX MessageViewer
)


ecm_generate_headers(MessageViewer_Camelcasewidgets_HEADERS
  HEADER_NAMES
  InvitationSettings
  PrintingSettings
  ConfigureWidget
  REQUIRED_HEADERS MessageViewer_widgets_HEADERS
  PREFIX MessageViewer
  RELATIVE widgets
)

ecm_generate_headers(MessageViewer_Camelcaseutils_HEADERS
  HEADER_NAMES
  MessageViewerUtil
  MarkMessageReadHandler
  REQUIRED_HEADERS MessageViewer_utils_HEADERS
  PREFIX MessageViewer
  RELATIVE utils
)

ecm_generate_headers(MessageViewer_Camelcaseantispam_HEADERS
  HEADER_NAMES
  SpamHeaderAnalyzer
  REQUIRED_HEADERS MessageViewer_antispam_HEADERS
  PREFIX MessageViewer
  RELATIVE antispam
)

ecm_generate_headers(MessageViewer_Camelcaseinterfaces_HEADERS
  HEADER_NAMES
  BodyPartFormatter
  BodyPart
  BodyPartURLHandler
  HtmlWriter
  URLHandler
  REQUIRED_HEADERS MessageViewer_interfaces_HEADERS
  PREFIX MessageViewer
  RELATIVE interfaces
)

ecm_generate_headers(MessageViewer_Camelcasesettings_HEADERS
  HEADER_NAMES
  MessageViewerSettings
  REQUIRED_HEADERS MessageViewer_settings_HEADERS
  PREFIX MessageViewer
  RELATIVE settings
)


ecm_generate_headers(MessageViewer_Camelcaseheader_HEADERS
  HEADER_NAMES
  HeaderStrategy
  GrantleeHeaderTestStyle
  GrantleeHeaderStyle
  HeaderStyle
  KXFace
  HeaderStyle_Util
  HeaderStylePlugin
  HeaderStyleInterface
  PlainHeaderStyle
  RichHeaderStrategy
  HeaderStylePluginManager
  HeaderStyleMenuManager
  REQUIRED_HEADERS MessageViewer_header_HEADERS
  PREFIX MessageViewer
  RELATIVE header
)

ecm_generate_headers(MessageViewer_Camelcasehtmlwriter_HEADERS
  HEADER_NAMES
  WebKitPartHtmlWriter
  REQUIRED_HEADERS MessageViewer_htmlwriter_HEADERS
  PREFIX MessageViewer
  RELATIVE htmlwriter
)

ecm_generate_headers(MessageViewer_Camelcaseadblock_HEADERS
  HEADER_NAMES
  AdBlockSettingWidget  
  AdBlockListWidget
Laurent Montel's avatar
Laurent Montel committed
368
  WebPage
369 370 371 372 373 374 375 376 377 378 379 380 381 382 383 384 385 386 387 388 389 390 391 392 393 394 395 396 397 398 399 400
  REQUIRED_HEADERS MessageViewer_adblock_HEADERS
  PREFIX MessageViewer
  RELATIVE adblock
)

ecm_generate_headers(MessageViewer_Camelcaseviewerplugin_HEADERS
  HEADER_NAMES
  ViewerPluginManager
  ViewerPlugin
  ViewerPluginInterface
  ViewerPluginToolManager
  REQUIRED_HEADERS MessageViewer_viewerplugin_HEADERS
  PREFIX MessageViewer
  RELATIVE viewerplugins 
)

ecm_generate_headers(MessageViewer_Camelcaseviewerjob_HEADERS
  HEADER_NAMES
  CreateTodoJob
  CreateNoteJob
  CreateEventJob
  REQUIRED_HEADERS MessageViewer_viewerjob_HEADERS
  PREFIX MessageViewer
  RELATIVE job 
)


ecm_generate_pri_file(BASE_NAME MessageViewer
    LIB_NAME KF5MessageViewer
    DEPS "PimCommon MessageCore AkonadiCore AkonadiMime Contacts Libkleo" FILENAME_VAR PRI_FILENAME INCLUDE_INSTALL_DIR ${KDE_INSTALL_INCLUDEDIR_KF5}/MessageViewer
)

Laurent Montel's avatar
Laurent Montel committed
401

402 403 404 405 406 407 408 409 410 411 412 413 414 415 416 417 418 419 420 421 422 423 424 425 426 427 428 429 430 431 432 433 434 435 436 437 438 439 440 441 442 443 444 445 446 447 448 449 450 451
install(FILES
    ${MessageViewer_Camelcaseheader_HEADERS}
    ${MessageViewer_Camelcaseviewerplugin_HEADERS}
    ${MessageViewer_Camelcasesettings_HEADERS}
    ${MessageViewer_Camelcaseadblock_HEADERS}
    ${MessageViewer_Camelcasehtmlwriter_HEADERS}
    ${MessageViewer_Camelcaseutils_HEADERS}
    ${MessageViewer_Camelcaseinterfaces_HEADERS}
    ${MessageViewer_Camelcaseviewer_HEADERS}
    ${MessageViewer_Camelcasewidgets_HEADERS}
    ${MessageViewer_Camelcasemain_HEADERS}
    ${MessageViewer_Camelcaseviewerjob_HEADERS}
    ${MessageViewer_Camelcaseantispam_HEADERS}
    DESTINATION ${KDE_INSTALL_INCLUDEDIR_KF5}/MessageViewer
    COMPONENT Devel
)

install(FILES
    ${MessageViewer_viewerplugin_HEADERS}
    ${MessageViewer_settings_HEADERS}
    ${MessageViewer_adblock_HEADERS}
    ${MessageViewer_htmlwriter_HEADERS}
    ${MessageViewer_header_HEADERS}
    ${MessageViewer_utils_HEADERS}
    ${MessageViewer_interfaces_HEADERS}
    ${MessageViewer_HEADERS}
    ${MessageViewer_viewer_HEADERS}
    ${MessageViewer_main_HEADERS}
    ${MessageViewer_widgets_HEADERS}
    ${MessageViewer_viewerjob_HEADERS}
    ${MessageViewer_antispam_HEADERS}
    ${CMAKE_CURRENT_BINARY_DIR}/messageviewer_export.h
    ${CMAKE_CURRENT_BINARY_DIR}/globalsettings_messageviewer.h
    ${CMAKE_CURRENT_BINARY_DIR}/messageviewer_debug.h
    ${CMAKE_CURRENT_BINARY_DIR}/ui_settings_adblock.h

    DESTINATION ${KDE_INSTALL_INCLUDEDIR_KF5}/messageviewer
    COMPONENT Devel
)

install(FILES
    ${PRI_FILENAME}
    DESTINATION ${ECM_MKSPECS_INSTALL_DIR})


install(FILES header/data/messageviewer_header_themes.knsrc DESTINATION ${KDE_INSTALL_CONFDIR} )

install(FILES notify/messageviewer.notifyrc DESTINATION ${KDE_INSTALL_KNOTIFY5RCDIR} )
install(FILES scamdetection/data/longurlServices.json DESTINATION ${KDE_INSTALL_DATADIR}/messageviewer )