2 # The Qt5's qt5_use_modules is only available on 2.8.9 or later -- sweet, isn't it?
3 cmake_minimum_required(VERSION 2.8.9)
5 cmake_minimum_required(VERSION 2.8.7)
8 set(CMAKE_MODULE_PATH ${CMAKE_SOURCE_DIR}/cmake)
10 include(FindCXXFeatures)
11 if(NOT CXXFeatures_auto_FOUND)
12 message(SEND_ERROR "Your compiler doesn't support C++11's auto")
14 set(CMAKE_CXX_FLAGS "${CMAKE_CXX_FLAGS} ${CXX11_COMPILER_FLAGS}")
17 set(BUILD_DESKTOP_GUI false)
18 set(BUILD_HARMATTAN true)
19 set(WITHOUT_TESTS true)
20 message(STATUS "Building version for MeeGo Harmattan")
22 set(BUILD_DESKTOP_GUI true)
23 set(BUILD_HARMATTAN false)
24 message(STATUS "Building the desktop version")
28 message(STATUS "Building the Qt5 version")
29 find_package(Qt5Gui REQUIRED)
30 find_package(Qt5Network REQUIRED)
31 find_package(Qt5Sql REQUIRED)
32 find_package(Qt5WebKitWidgets REQUIRED)
33 find_package(Qt5Widgets REQUIRED)
34 find_package(Qt5LinguistTools)
36 find_package(Qt5Test REQUIRED)
38 set(CMAKE_CXX_FLAGS "${CMAKE_CXX_FLAGS} ${Qt5Widgets_EXECUTABLE_COMPILE_FLAGS}")
39 if(Qt5LinguistTools_FOUND)
40 find_package(Qt5LinguistForTrojita)
43 message(STATUS "Building the Qt4 version")
44 set(QT_USE_QTNETWORK 1)
46 set(QT_USE_QTWEBKIT 1)
51 set(QT_USE_QTDECLARATIVE 1)
53 find_package(Qt4 4.6 REQUIRED)
54 include(${QT_USE_FILE})
55 add_definitions(${QT_DEFINITIONS})
56 find_package(LinguistForTrojita)
60 if(WIN32 AND WITH_NSIS)
62 find_program(MAKENSIS makensis)
64 message(STATUS "makensis not found")
66 message(STATUS "Found makensis: ${MAKENSIS}")
68 mark_as_advanced(MAKENSIS)
72 # Add support for Mingw RC compiler
75 include(CMakeDetermineRCCompiler)
78 set(CMAKE_RC_COMPILER_INIT windres)
79 set(CMAKE_RC_COMPILE_OBJECT "<CMAKE_RC_COMPILER> <FLAGS> -O coff <DEFINES> -i <SOURCE> -o <OBJECT>")
83 if(NOT WIN32 AND NOT MSVC)
84 # Check if we are NOT on Windows and don't use MSVC since -g is not supported by VC
85 # and Wall makes the build very noisy.
86 set(CMAKE_CXX_FLAGS "${CMAKE_CXX_FLAGS} -Wall -g")
87 #set(CMAKE_CXX_FLAGS "${CMAKE_CXX_FLAGS} -Wall -Wextra -Wnon-virtual-dtor -Wold-style-cast -Woverloaded-virtual")
88 endif(NOT WIN32 AND NOT MSVC)
90 include_directories(${CMAKE_CURRENT_SOURCE_DIR}/src)
91 # The following is required so that the moc_*.cpp and ui_*.h are found
92 include_directories(${CMAKE_CURRENT_BINARY_DIR})
93 add_definitions(-DQT_STRICT_ITERATORS)
95 if(NOT WITH_QT5 AND CMAKE_VERSION VERSION_LESS 2.8.10)
96 set(SUPPORTS_TARGET_INCLUDES 0)
98 ${QT_MKSPECS_DIR}/default
99 ${CMAKE_CURRENT_SOURCE_DIR}/src/Gui/
100 ${CMAKE_CURRENT_SOURCE_DIR}/src/mimetypes-qt4/io/
101 ${CMAKE_CURRENT_SOURCE_DIR}/src/Harmattan/qmlapplicationviewer
102 ${CMAKE_CURRENT_SOURCE_DIR}/tests
103 ${CMAKE_CURRENT_SOURCE_DIR}/tests/test_LibMailboxSync)
105 set(SUPPORTS_TARGET_INCLUDES 1)
108 set(CMAKE_AUTOMOC True)
111 find_package(RagelForTrojita)
116 if(NOT WIN32) # Check if we are NOT on Windows
119 # On win32, qt can statically link to zlib and export their symbols.
120 # We check if we can find the string " zlib " in the QT_CONFIG list in
121 # ${QT_MKSPECS_DIR}/qconfig.pri and include on success ${QT_QTCORE_LIBRARY}
122 # and ${QTDIR}/src/3rdparty/zlib as lib and include folder
124 message(STATUS "We are on Windows with Qt. Checking if zlib is built into Qt")
126 if(EXISTS "${QT_MKSPECS_DIR}/qconfig.pri")
127 file(READ ${QT_MKSPECS_DIR}/qconfig.pri _qconfig_FILE_contents_ZLIB_CHECK)
128 string(REGEX MATCH "QT_CONFIG[^\n]+" QT_CONFIG_ZLIB_CHECK ${_qconfig_FILE_contents_ZLIB_CHECK})
130 set(ENV_QTDIR $ENV{QTDIR})
131 if(NOT DEFINED ENV_QTDIR)
132 message(STATUS "QTDIR not specified in environment, will not use zlib")
133 elseif(QT_CONFIG_ZLIB_CHECK)
134 if(QT_CONFIG_ZLIB_CHECK MATCHES " zlib ")
135 message(STATUS "Found zlib in QT_QCONFIG. zlib seems to be built into Qt")
136 set(ZLIB_LIBRARY_RELEASE ${QT_QTCORE_LIBRARY_RELEASE})
137 set(ZLIB_LIBRARY_DEBUG ${QT_QTCORE_LIBRARY_DEBUG})
138 set(ZLIB_LIBRARY ${QT_QTCORE_LIBRARY})
140 string(REGEX REPLACE "\\\\" "/" QTDIR ${ENV_QTDIR})
141 set(ZLIB_INCLUDE_DIR "${QTDIR}/src/3rdparty/zlib")
144 set(ZLIB_LIBRARIES ${ZLIB_LIBRARY} )
145 mark_as_advanced(ZLIB_LIBRARY ZLIB_INCLUDE_DIR ZLIB_FOUND)
146 else(QT_CONFIG_ZLIB_CHECK MATCHES " zlib ")
147 message(STATUS "Could not determine if Qt was built with zlib support.")
148 endif(QT_CONFIG_ZLIB_CHECK MATCHES " zlib ")
151 endif(EXISTS "${QT_MKSPECS_DIR}/qconfig.pri")
152 endif(QT_QTCORE_FOUND)
157 set(TROJITA_HAVE_ZLIB True)
158 message(STATUS "Support for COMPRESS=DEFLATE enabled")
160 set(TROJITA_HAVE_ZLIB False)
161 message(STATUS "Disabling COMPRESS=DEFLATE, zlib is not available")
164 configure_file(${CMAKE_CURRENT_SOURCE_DIR}/src/configure.cmake.in
165 ${CMAKE_CURRENT_BINARY_DIR}/configure.cmake.h)
167 set(path_Common ${CMAKE_CURRENT_SOURCE_DIR}/src/Common)
168 set(libCommon_HEADERS
169 ${path_Common}/Application.h
170 ${path_Common}/ConnectionId.h
171 ${path_Common}/DeleteAfter.h
172 ${path_Common}/FileLogger.h
173 ${path_Common}/Paths.h
174 ${path_Common}/SettingsNames.h
176 set(libCommon_SOURCES
177 ${path_Common}/Application.cpp
178 ${path_Common}/ConnectionId.cpp
179 ${path_Common}/DeleteAfter.cpp
180 ${path_Common}/FileLogger.cpp
181 ${path_Common}/Paths.cpp
182 ${path_Common}/SettingsNames.cpp
185 set(path_Composer ${CMAKE_CURRENT_SOURCE_DIR}/src/Composer)
186 set(libComposer_HEADERS
187 ${path_Composer}/ComposerAttachments.h
188 ${path_Composer}/MessageComposer.h
189 ${path_Composer}/PlainTextFormatter.h
190 ${path_Composer}/Recipients.h
191 ${path_Composer}/ReplaceSignature.h
192 ${path_Composer}/SenderIdentitiesModel.h
193 ${path_Composer}/SubjectMangling.h
194 ${path_Composer}/Submission.h
196 set(libComposer_SOURCES
197 ${path_Composer}/ComposerAttachments.cpp
198 ${path_Composer}/MessageComposer.cpp
199 ${path_Composer}/PlainTextFormatter.cpp
200 ${path_Composer}/Recipients.cpp
201 ${path_Composer}/ReplaceSignature.cpp
202 ${path_Composer}/SenderIdentitiesModel.cpp
203 ${path_Composer}/SubjectMangling.cpp
204 ${path_Composer}/Submission.cpp
207 set(path_MSA ${CMAKE_CURRENT_SOURCE_DIR}/src/MSA)
209 ${path_MSA}/AbstractMSA.h
210 ${path_MSA}/FakeMSA.h
211 ${path_MSA}/ImapSubmit.h
213 ${path_MSA}/Sendmail.h
216 ${path_MSA}/AbstractMSA.cpp
217 ${path_MSA}/FakeMSA.cpp
218 ${path_MSA}/ImapSubmit.cpp
220 ${path_MSA}/Sendmail.cpp
223 set(path_Streams ${CMAKE_CURRENT_SOURCE_DIR}/src/Streams)
224 set(libStreams_HEADERS
225 ${path_Streams}/DeletionWatcher.h
226 ${path_Streams}/FakeSocket.h
227 ${path_Streams}/IODeviceSocket.h
228 ${path_Streams}/Socket.h
229 ${path_Streams}/SocketFactory.h
231 set(libStreams_SOURCES
232 ${path_Streams}/DeletionWatcher.cpp
233 ${path_Streams}/FakeSocket.cpp
234 ${path_Streams}/IODeviceSocket.cpp
235 ${path_Streams}/Socket.cpp
236 ${path_Streams}/SocketFactory.cpp
240 set(libStreams_SOURCES ${libStreams_SOURCES}
241 ${path_Streams}/3rdparty/rfc1951.cpp)
242 include_directories(${ZLIB_INCLUDE_DIR})
245 set(path_mimetypesqt4 ${CMAKE_CURRENT_SOURCE_DIR}/src/mimetypes-qt4)
246 set(libMimetypesQt4_HEADERS
247 ${path_mimetypesqt4}/io/qstandardpaths.h
248 ${path_mimetypesqt4}/mimetypes/qmimedatabase_p.h
249 ${path_mimetypesqt4}/mimetypes/qmimeglobpattern_p.h
250 ${path_mimetypesqt4}/mimetypes/qmimemagicrule_p.h
251 ${path_mimetypesqt4}/mimetypes/qmimemagicrulematcher_p.h
252 ${path_mimetypesqt4}/mimetypes/qmimeprovider_p.h
253 ${path_mimetypesqt4}/mimetypes/qmimetype_p.h
254 ${path_mimetypesqt4}/mimetypes/qmimetypeparser_p.h
255 ${path_mimetypesqt4}/mimetypes/qmimetype.h
256 ${path_mimetypesqt4}/mimetypes/qmimedatabase.h
258 set(libMimetypesQt4_SOURCES
259 ${path_mimetypesqt4}/io/qstandardpaths.cpp
260 ${path_mimetypesqt4}/mimetypes/qmimedatabase.cpp
261 ${path_mimetypesqt4}/mimetypes/qmimeglobpattern.cpp
262 ${path_mimetypesqt4}/mimetypes/qmimemagicrule.cpp
263 ${path_mimetypesqt4}/mimetypes/qmimemagicrulematcher.cpp
264 ${path_mimetypesqt4}/mimetypes/qmimetype.cpp
265 ${path_mimetypesqt4}/mimetypes/qmimetypeparser.cpp
266 ${path_mimetypesqt4}/mimetypes/qmimeprovider.cpp
269 set(libMimetypesQt4_SOURCES ${libMimetypesQt4_SOURCES}
270 ${path_mimetypesqt4}/io/qstandardpaths_win.cpp)
272 set(libMimetypesQt4_SOURCES ${libMimetypesQt4_SOURCES}
273 ${path_mimetypesqt4}/io/qstandardpaths_mac.cpp)
275 set(libMimetypesQt4_SOURCES ${libMimetypesQt4_SOURCES}
276 ${path_mimetypesqt4}/io/qstandardpaths_os2.cpp)
278 set(libMimetypesQt4_SOURCES ${libMimetypesQt4_SOURCES}
279 ${path_mimetypesqt4}/io/qstandardpaths_unix.cpp)
281 message(FATAL_ERROR "Unsupported platform -- mimetypes-Qt4 support only Unix, MacOSX, Windows and OS/2")
284 set(path_DesktopGui ${CMAKE_CURRENT_SOURCE_DIR}/src/Gui)
285 set(libDesktopGui_HEADERS
286 ${path_DesktopGui}/AttachmentView.h
287 ${path_DesktopGui}/AutoCompletion.h
288 ${path_DesktopGui}/CompleteMessageWidget.h
289 ${path_DesktopGui}/ComposeWidget.h
290 ${path_DesktopGui}/ComposerAttachmentsList.h
291 ${path_DesktopGui}/ComposerTextEdit.h
292 ${path_DesktopGui}/EmbeddedWebView.h
293 ${path_DesktopGui}/EnvelopeView.h
294 ${path_DesktopGui}/ExternalElementsWidget.h
295 ${path_DesktopGui}/FindBar.h
296 ${path_DesktopGui}/FlowLayout.h
297 ${path_DesktopGui}/FromAddressProxyModel.h
298 ${path_DesktopGui}/LineEdit.h
299 ${path_DesktopGui}/LoadablePartWidget.h
300 ${path_DesktopGui}/MailBoxTreeView.h
301 ${path_DesktopGui}/MessageListWidget.h
302 ${path_DesktopGui}/MessageSourceWidget.h
303 ${path_DesktopGui}/MessageView.h
304 ${path_DesktopGui}/MsgListView.h
305 ${path_DesktopGui}/OnePanelAtTimeWidget.h
306 ${path_DesktopGui}/OverlayWidget.h
307 ${path_DesktopGui}/PartWidget.h
308 ${path_DesktopGui}/PartWidgetFactory.h
309 ${path_DesktopGui}/PasswordDialog.h
310 ${path_DesktopGui}/ProgressPopUp.h
311 ${path_DesktopGui}/ProtocolLoggerWidget.h
312 ${path_DesktopGui}/ReplaceCharValidator.h
313 ${path_DesktopGui}/SettingsDialog.h
314 ${path_DesktopGui}/SimplePartWidget.h
315 ${path_DesktopGui}/Spinner.h
316 ${path_DesktopGui}/TagListWidget.h
317 ${path_DesktopGui}/TagWidget.h
318 ${path_DesktopGui}/TaskProgressIndicator.h
319 ${path_DesktopGui}/UserAgentWebPage.h
320 ${path_DesktopGui}/Util.h
321 ${path_DesktopGui}/Window.h
322 ${path_DesktopGui}/ShortcutHandler/ShortcutConfigDialog.h
323 ${path_DesktopGui}/ShortcutHandler/ShortcutConfigWidget.h
324 ${path_DesktopGui}/ShortcutHandler/ShortcutHandler.h
326 set(libDesktopGui_SOURCES
327 ${path_DesktopGui}/AttachmentView.cpp
328 ${path_DesktopGui}/AutoCompletion.cpp
329 ${path_DesktopGui}/CompleteMessageWidget.cpp
330 ${path_DesktopGui}/ComposeWidget.cpp
331 ${path_DesktopGui}/ComposerAttachmentsList.cpp
332 ${path_DesktopGui}/ComposerTextEdit.cpp
333 ${path_DesktopGui}/EmbeddedWebView.cpp
334 ${path_DesktopGui}/EnvelopeView.cpp
335 ${path_DesktopGui}/ExternalElementsWidget.cpp
336 ${path_DesktopGui}/FindBar.cpp
337 ${path_DesktopGui}/FlowLayout.cpp
338 ${path_DesktopGui}/FromAddressProxyModel.cpp
339 ${path_DesktopGui}/LineEdit.cpp
340 ${path_DesktopGui}/LoadablePartWidget.cpp
341 ${path_DesktopGui}/MailBoxTreeView.cpp
342 ${path_DesktopGui}/MessageListWidget.cpp
343 ${path_DesktopGui}/MessageSourceWidget.cpp
344 ${path_DesktopGui}/MessageView.cpp
345 ${path_DesktopGui}/MsgListView.cpp
346 ${path_DesktopGui}/OnePanelAtTimeWidget.cpp
347 ${path_DesktopGui}/OverlayWidget.cpp
348 ${path_DesktopGui}/PartWidget.cpp
349 ${path_DesktopGui}/PartWidgetFactory.cpp
350 ${path_DesktopGui}/PasswordDialog.cpp
351 ${path_DesktopGui}/ProgressPopUp.cpp
352 ${path_DesktopGui}/ProtocolLoggerWidget.cpp
353 ${path_DesktopGui}/ReplaceCharValidator.cpp
354 ${path_DesktopGui}/SettingsDialog.cpp
355 ${path_DesktopGui}/SimplePartWidget.cpp
356 ${path_DesktopGui}/Spinner.cpp
357 ${path_DesktopGui}/TagListWidget.cpp
358 ${path_DesktopGui}/TagWidget.cpp
359 ${path_DesktopGui}/TaskProgressIndicator.cpp
360 ${path_DesktopGui}/UserAgentWebPage.cpp
361 ${path_DesktopGui}/Util.cpp
362 ${path_DesktopGui}/Window.cpp
363 ${path_DesktopGui}/ShortcutHandler/ShortcutConfigDialog.cpp
364 ${path_DesktopGui}/ShortcutHandler/ShortcutConfigWidget.cpp
365 ${path_DesktopGui}/ShortcutHandler/ShortcutHandler.cpp
368 ${path_DesktopGui}/CreateMailboxDialog.ui
369 ${path_DesktopGui}/SettingsOutgoingPage.ui
370 ${path_DesktopGui}/SettingsGeneralPage.ui
371 ${path_DesktopGui}/ComposeWidget.ui
372 ${path_DesktopGui}/ProgressPopUpOld.ui
373 ${path_DesktopGui}/ShortcutHandler/ShortcutConfigWidget.ui
374 ${path_DesktopGui}/SettingsImapPage.ui
375 ${path_DesktopGui}/PasswordDialog.ui
376 ${path_DesktopGui}/SettingsCachePage.ui
377 ${path_DesktopGui}/EditIdentity.ui
378 ${path_DesktopGui}/ProgressPopUp.ui
380 set(libDesktopGui_RESOURCES
381 ${CMAKE_CURRENT_SOURCE_DIR}/src/icons.qrc
384 set(libqwwsmtpclient_HEADERS ${CMAKE_CURRENT_SOURCE_DIR}/src/qwwsmtpclient/qwwsmtpclient.h)
385 set(libqwwsmtpclient_SOURCES ${CMAKE_CURRENT_SOURCE_DIR}/src/qwwsmtpclient/qwwsmtpclient.cpp)
387 set(libAppVersion_HEADERS ${CMAKE_CURRENT_SOURCE_DIR}/src/AppVersion/SetCoreApplication.h)
388 set(libAppVersion_SOURCES ${CMAKE_CURRENT_SOURCE_DIR}/src/AppVersion/SetCoreApplication.cpp)
390 set(path_Imap ${CMAKE_CURRENT_SOURCE_DIR}/src/Imap)
392 ${path_Imap}/ConnectionState.h
393 ${path_Imap}/Exceptions.h
394 ${path_Imap}/Encoders.h
395 ${path_Imap}/Parser/3rdparty/kcodecs.h
396 ${path_Imap}/Parser/3rdparty/rfccodecs.h
398 ${path_Imap}/Parser/Command.h
399 ${path_Imap}/Parser/Data.h
400 ${path_Imap}/Parser/LowLevelParser.h
401 ${path_Imap}/Parser/MailAddress.h
402 ${path_Imap}/Parser/Message.h
403 ${path_Imap}/Parser/Parser.h
404 ${path_Imap}/Parser/Response.h
405 ${path_Imap}/Parser/Rfc5322HeaderParser.h
406 ${path_Imap}/Parser/Sequence.h
407 ${path_Imap}/Parser/ThreadingNode.h
409 ${path_Imap}/Network/FileDownloadManager.h
410 ${path_Imap}/Network/ForbiddenReply.h
411 ${path_Imap}/Network/MsgPartNetAccessManager.h
412 ${path_Imap}/Network/MsgPartNetworkReply.h
414 ${path_Imap}/Model/Cache.h
415 ${path_Imap}/Model/CatenateData.h
416 ${path_Imap}/Model/CombinedCache.h
417 ${path_Imap}/Model/CopyMoveOperation.h
418 ${path_Imap}/Model/DelayedPopulation.h
419 ${path_Imap}/Model/DiskPartCache.h
420 ${path_Imap}/Model/FindInterestingPart.h
421 ${path_Imap}/Model/FlagsOperation.h
422 ${path_Imap}/Model/FullMessageCombiner.h
423 ${path_Imap}/Model/ItemRoles.h
424 ${path_Imap}/Model/MailboxMetadata.h
425 ${path_Imap}/Model/MailboxModel.h
426 ${path_Imap}/Model/MailboxTree.h
427 ${path_Imap}/Model/MemoryCache.h
428 ${path_Imap}/Model/Model.h
429 ${path_Imap}/Model/ModelTest/modeltest.h
430 ${path_Imap}/Model/ModelWatcher.h
431 ${path_Imap}/Model/MsgListModel.h
432 ${path_Imap}/Model/OneMessageModel.h
433 ${path_Imap}/Model/ParserState.h
434 ${path_Imap}/Model/PrettyMailboxModel.h
435 ${path_Imap}/Model/PrettyMsgListModel.h
436 ${path_Imap}/Model/QAIM_reset.h
437 ${path_Imap}/Model/SQLCache.h
438 ${path_Imap}/Model/SubscribeUnSubscribeOperation.h
439 ${path_Imap}/Model/SubtreeModel.h
440 ${path_Imap}/Model/TaskFactory.h
441 ${path_Imap}/Model/TaskPresentationModel.h
442 ${path_Imap}/Model/ThreadingMsgListModel.h
443 ${path_Imap}/Model/UidSubmitData.h
444 ${path_Imap}/Model/Utils.h
445 ${path_Imap}/Model/VisibleTasksModel.h
447 ${path_Imap}/Model/kdeui-itemviews/kbihash_p.h
448 # this file is left out intentionally; otherwise cmake's automoc won't work with it
449 #${path_Imap}/Model/kdeui-itemviews/kdescendantsproxymodel.h
451 ${path_Imap}/Tasks/AppendTask.h
452 ${path_Imap}/Tasks/CopyMoveMessagesTask.h
453 ${path_Imap}/Tasks/CreateMailboxTask.h
454 ${path_Imap}/Tasks/DeleteMailboxTask.h
455 ${path_Imap}/Tasks/EnableTask.h
456 ${path_Imap}/Tasks/ExpungeMailboxTask.h
457 ${path_Imap}/Tasks/ExpungeMessagesTask.h
458 ${path_Imap}/Tasks/Fake_ListChildMailboxesTask.h
459 ${path_Imap}/Tasks/Fake_OpenConnectionTask.h
460 ${path_Imap}/Tasks/FetchMsgMetadataTask.h
461 ${path_Imap}/Tasks/FetchMsgPartTask.h
462 ${path_Imap}/Tasks/GenUrlAuthTask.h
463 ${path_Imap}/Tasks/GetAnyConnectionTask.h
464 ${path_Imap}/Tasks/IdTask.h
465 ${path_Imap}/Tasks/IdleLauncher.h
466 ${path_Imap}/Tasks/ImapTask.h
467 ${path_Imap}/Tasks/KeepMailboxOpenTask.h
468 ${path_Imap}/Tasks/ListChildMailboxesTask.h
469 ${path_Imap}/Tasks/NoopTask.h
470 ${path_Imap}/Tasks/NumberOfMessagesTask.h
471 ${path_Imap}/Tasks/ObtainSynchronizedMailboxTask.h
472 ${path_Imap}/Tasks/OfflineConnectionTask.h
473 ${path_Imap}/Tasks/OpenConnectionTask.h
474 ${path_Imap}/Tasks/SortTask.h
475 ${path_Imap}/Tasks/SubscribeUnsubscribeTask.h
476 ${path_Imap}/Tasks/ThreadTask.h
477 ${path_Imap}/Tasks/UidSubmitTask.h
478 ${path_Imap}/Tasks/UnSelectTask.h
479 ${path_Imap}/Tasks/UpdateFlagsTask.h
480 ${path_Imap}/Tasks/UpdateFlagsOfAllMessagesTask.h
483 ${path_Imap}/ConnectionState.cpp
484 ${path_Imap}/Encoders.cpp
485 ${path_Imap}/Exceptions.cpp
486 ${path_Imap}/Parser/3rdparty/kcodecs.cpp
487 ${path_Imap}/Parser/3rdparty/rfccodecs.cpp
489 ${path_Imap}/Parser/Command.cpp
490 ${path_Imap}/Parser/Data.cpp
491 ${path_Imap}/Parser/LowLevelParser.cpp
492 ${path_Imap}/Parser/MailAddress.cpp
493 ${path_Imap}/Parser/Message.cpp
494 ${path_Imap}/Parser/Parser.cpp
495 ${path_Imap}/Parser/Response.cpp
496 ${path_Imap}/Parser/Sequence.cpp
497 ${path_Imap}/Parser/ThreadingNode.cpp
499 ${path_Imap}/Network/FileDownloadManager.cpp
500 ${path_Imap}/Network/ForbiddenReply.cpp
501 ${path_Imap}/Network/MsgPartNetAccessManager.cpp
502 ${path_Imap}/Network/MsgPartNetworkReply.cpp
504 ${path_Imap}/Model/Cache.cpp
505 ${path_Imap}/Model/CombinedCache.cpp
506 ${path_Imap}/Model/DelayedPopulation.cpp
507 ${path_Imap}/Model/DiskPartCache.cpp
508 ${path_Imap}/Model/FindInterestingPart.cpp
509 ${path_Imap}/Model/FlagsOperation.cpp
510 ${path_Imap}/Model/FullMessageCombiner.cpp
511 ${path_Imap}/Model/MailboxMetadata.cpp
512 ${path_Imap}/Model/MailboxModel.cpp
513 ${path_Imap}/Model/MailboxTree.cpp
514 ${path_Imap}/Model/MemoryCache.cpp
515 ${path_Imap}/Model/Model.cpp
516 ${path_Imap}/Model/ModelWatcher.cpp
517 ${path_Imap}/Model/MsgListModel.cpp
518 ${path_Imap}/Model/OneMessageModel.cpp
519 ${path_Imap}/Model/ParserState.cpp
520 ${path_Imap}/Model/PrettyMailboxModel.cpp
521 ${path_Imap}/Model/PrettyMsgListModel.cpp
522 ${path_Imap}/Model/SQLCache.cpp
523 ${path_Imap}/Model/SubtreeModel.cpp
524 ${path_Imap}/Model/TaskFactory.cpp
525 ${path_Imap}/Model/TaskPresentationModel.cpp
526 ${path_Imap}/Model/ThreadingMsgListModel.cpp
527 ${path_Imap}/Model/Utils.cpp
528 ${path_Imap}/Model/VisibleTasksModel.cpp
530 ${path_Imap}/Model/ModelTest/modeltest.cpp
531 ${path_Imap}/Model/kdeui-itemviews/kdescendantsproxymodel.cpp
533 ${path_Imap}/Tasks/AppendTask.cpp
534 ${path_Imap}/Tasks/CopyMoveMessagesTask.cpp
535 ${path_Imap}/Tasks/CreateMailboxTask.cpp
536 ${path_Imap}/Tasks/DeleteMailboxTask.cpp
537 ${path_Imap}/Tasks/EnableTask.cpp
538 ${path_Imap}/Tasks/ExpungeMailboxTask.cpp
539 ${path_Imap}/Tasks/ExpungeMessagesTask.cpp
540 ${path_Imap}/Tasks/Fake_ListChildMailboxesTask.cpp
541 ${path_Imap}/Tasks/Fake_OpenConnectionTask.cpp
542 ${path_Imap}/Tasks/FetchMsgMetadataTask.cpp
543 ${path_Imap}/Tasks/FetchMsgPartTask.cpp
544 ${path_Imap}/Tasks/GenUrlAuthTask.cpp
545 ${path_Imap}/Tasks/GetAnyConnectionTask.cpp
546 ${path_Imap}/Tasks/IdTask.cpp
547 ${path_Imap}/Tasks/IdleLauncher.cpp
548 ${path_Imap}/Tasks/ImapTask.cpp
549 ${path_Imap}/Tasks/KeepMailboxOpenTask.cpp
550 ${path_Imap}/Tasks/ListChildMailboxesTask.cpp
551 ${path_Imap}/Tasks/NoopTask.cpp
552 ${path_Imap}/Tasks/NumberOfMessagesTask.cpp
553 ${path_Imap}/Tasks/ObtainSynchronizedMailboxTask.cpp
554 ${path_Imap}/Tasks/OfflineConnectionTask.cpp
555 ${path_Imap}/Tasks/OpenConnectionTask.cpp
556 ${path_Imap}/Tasks/SortTask.cpp
557 ${path_Imap}/Tasks/SubscribeUnsubscribeTask.cpp
558 ${path_Imap}/Tasks/ThreadTask.cpp
559 ${path_Imap}/Tasks/UidSubmitTask.cpp
560 ${path_Imap}/Tasks/UnSelectTask.cpp
561 ${path_Imap}/Tasks/UpdateFlagsTask.cpp
562 ${path_Imap}/Tasks/UpdateFlagsOfAllMessagesTask.cpp
565 if(WITH_RAGEL AND RAGEL_FOUND)
566 message(STATUS "Using Ragel for the RFC 5322 parser")
567 ragel_parser(${path_Imap}/Parser/Rfc5322HeaderParser.cpp)
568 set(libImap_SOURCES ${libImap_SOURCES}
569 ${CMAKE_CURRENT_BINARY_DIR}/Rfc5322HeaderParser.generated.cpp)
571 message(STATUS "Using pregenerated RFC 5322 parser")
572 set(libImap_SOURCES ${libImap_SOURCES}
573 ${path_Imap}/Parser/Rfc5322HeaderParser.generated.cpp)
576 set(path_AbookAddressbook ${CMAKE_CURRENT_SOURCE_DIR}/src/AbookAddressbook)
577 set(libAbookAddressbook_HEADERS
578 ${path_AbookAddressbook}/AbookAddressbook.h
579 ${path_AbookAddressbook}/be-contacts.h
581 set(libAbookAddressbook_SOURCES
582 ${path_AbookAddressbook}/AbookAddressbook.cpp
583 ${path_AbookAddressbook}/be-contacts.cpp
585 set(libAbookAddressbook_UI
586 ${path_AbookAddressbook}/be-contacts.ui
587 ${path_AbookAddressbook}/onecontact.ui
590 set(trojita_desktop_SOURCES
591 ${path_DesktopGui}/main.cpp
595 list(APPEND trojita_desktop_SOURCES ${CMAKE_CURRENT_SOURCE_DIR}/src/trojita_win32.rc)
598 set(be_contacts_SOURCES
599 ${CMAKE_CURRENT_SOURCE_DIR}/src/be.contacts/main.cpp
602 set(libQmlModelGlue_SOURCES
603 ${CMAKE_CURRENT_SOURCE_DIR}/src/QmlSupport/ModelGlue/ImapAccess.cpp
605 set(libQmlModelGlue_HEADERS
606 ${CMAKE_CURRENT_SOURCE_DIR}/src/QmlSupport/ModelGlue/ImapAccess.h
609 set(libQNAMWebView_SOURCES
610 ${CMAKE_CURRENT_SOURCE_DIR}/src/QmlSupport/QNAMWebView/plugin.cpp
611 ${CMAKE_CURRENT_SOURCE_DIR}/src/QmlSupport/QNAMWebView/qdeclarativewebview.cpp
613 set(libQNAMWebView_HEADERS
614 ${CMAKE_CURRENT_SOURCE_DIR}/src/QmlSupport/QNAMWebView/plugin.h
615 ${CMAKE_CURRENT_SOURCE_DIR}/src/QmlSupport/QNAMWebView/qdeclarativewebview_p.h
618 set(trojitaHarmattan_SOURCES
619 ${CMAKE_CURRENT_SOURCE_DIR}/src/Harmattan/main.cpp
620 ${CMAKE_CURRENT_SOURCE_DIR}/src/Harmattan/qmlapplicationviewer/qmlapplicationviewer.cpp
624 file(GLOB_RECURSE lang_PO "${CMAKE_CURRENT_SOURCE_DIR}/po/trojita_common_*.po")
626 qt5_wrap_po(trojita_QM ${lang_PO})
628 qt4_wrap_po(trojita_QM ${lang_PO})
630 set(language_summary "")
631 foreach(po ${lang_PO})
632 string(REGEX REPLACE "^(.*)/trojita_common_(.*).po" "\\2" lang ${po})
633 list(APPEND language_summary ${lang})
635 list(SORT language_summary)
636 list(LENGTH language_summary num_languages)
638 message(STATUS "Available languages: ${language_summary}")
639 if(BUILD_DESKTOP_GUI)
640 install(DIRECTORY ${CMAKE_CURRENT_BINARY_DIR}/locale/ DESTINATION share/trojita/locale FILES_MATCHING PATTERN *.qm)
643 message(STATUS "No .po files found, will not install any languages")
646 message(STATUS "Qt Linguist (lupdate/lrelease/lconvert) not found, disabling localization support")
649 set(version_files ${CMAKE_CURRENT_BINARY_DIR}/trojita-version.h ${CMAKE_CURRENT_BINARY_DIR}/trojita-git-version.h)
650 if(WIN32 AND WITH_NSIS AND MAKENSIS)
651 set(version_files ${version_files} ${CMAKE_CURRENT_BINARY_DIR}/trojita-version.nsi)
655 add_custom_target(version DEPENDS version_fake_file)
656 add_custom_command(OUTPUT version_fake_file ${version_files}
657 COMMAND ${CMAKE_COMMAND} -DGIT_EXECUTABLE=${GIT_EXECUTABLE} -DNSIS=${NSIS} -DSOURCE_DIR=${CMAKE_CURRENT_SOURCE_DIR} -P ${CMAKE_CURRENT_SOURCE_DIR}/cmake/TrojitaVersion.cmake)
658 set_source_files_properties(${version_files}
659 PROPERTIES GENERATED TRUE
660 HEADER_FILE_ONLY TRUE)
662 add_library(Common ${libCommon_SOURCES})
663 add_dependencies(Common version)
664 target_link_libraries(Common ${QT_QTGUI_LIBRARY} ${QT_QTCORE_LIBRARY})
666 add_library(AppVersion ${libAppVersion_SOURCES})
667 add_dependencies(AppVersion version)
668 target_link_libraries(AppVersion Common ${QT_QTCORE_LIBRARY})
670 add_library(Streams ${libStreams_SOURCES})
671 target_link_libraries(Streams ${QT_QTNETWORK_LIBRARY} ${QT_QTCORE_LIBRARY})
673 target_link_libraries(Streams ${ZLIB_LIBRARIES})
676 add_library(qwwsmtpclient ${libqwwsmtpclient_SOURCES})
677 target_link_libraries(qwwsmtpclient ${QT_QTNETWORK_LIBRARY} ${QT_QTCORE_LIBRARY})
679 add_library(MSA ${libMSA_SOURCES})
680 target_link_libraries(MSA Imap Streams qwwsmtpclient ${QT_QTCORE_LIBRARY})
682 add_library(Composer ${libComposer_SOURCES})
683 target_link_libraries(Composer Common MSA Streams qwwsmtpclient ${QT_QTGUI_LIBRARY} ${QT_QTCORE_LIBRARY})
685 target_link_libraries(Composer MimetypesQt4)
688 add_library(Imap ${libImap_SOURCES})
689 target_link_libraries(Imap Common Streams ${QT_QTNETWORK_LIBRARY} ${QT_QTSQL_LIBRARY} ${QT_QTGUI_LIBRARY} ${QT_QTCORE_LIBRARY})
691 target_link_libraries(Imap ${ZLIB_LIBRARIES})
695 add_library(MimetypesQt4 ${libMimetypesQt4_SOURCES})
696 if(SUPPORTS_TARGET_INCLUDES)
697 set_property(TARGET MimetypesQt4 APPEND PROPERTY INCLUDE_DIRECTORIES
698 ${QT_MKSPECS_DIR}/default ${path_mimetypesqt4}/io/)
700 target_link_libraries(MimetypesQt4 ${QT_QTCORE_LIBRARY})
703 if(BUILD_DESKTOP_GUI)
705 qt5_wrap_ui(libAbookAddressbook_UI_OUT ${libAbookAddressbook_UI})
706 qt5_wrap_ui(libDesktopGui_UI_OUT ${libDesktopGui_UI})
707 qt5_add_resources(libDesktopGui_RESOURCES_OUT ${libDesktopGui_RESOURCES})
709 qt4_wrap_ui(libAbookAddressbook_UI_OUT ${libAbookAddressbook_UI})
710 qt4_wrap_ui(libDesktopGui_UI_OUT ${libDesktopGui_UI})
711 qt4_add_resources(libDesktopGui_RESOURCES_OUT ${libDesktopGui_RESOURCES})
714 add_library(AbookAddressbook ${libAbookAddressbook_SOURCES} ${libAbookAddressbook_UI_OUT})
715 target_link_libraries(AbookAddressbook ${QT_QTGUI_LIBRARY} ${QT_QTCORE_LIBRARY})
717 add_library(DesktopGui ${libDesktopGui_SOURCES} ${libDesktopGui_UI_OUT} ${libDesktopGui_RESOURCES_OUT})
718 # The following is needed for the LineEdit widget within the .ui files.
719 # The ${path_DesktopGui} is needed so that the generated ui_*.h file can find the headers of the custom widgets
720 if(SUPPORTS_TARGET_INCLUDES)
721 set_property(TARGET DesktopGui APPEND PROPERTY INCLUDE_DIRECTORIES ${path_DesktopGui})
723 target_link_libraries(DesktopGui Common Composer Imap MSA Streams qwwsmtpclient AbookAddressbook ${QT_QTWEBKIT_LIBRARY} ${QT_QTGUI_LIBRARY} ${QT_QTCORE_LIBRARY})
725 # On Windows build a real Win32 GUI application without console window
726 # On other platforms WIN32 flag is ignored
727 add_executable(trojita WIN32 ${trojita_desktop_SOURCES} ${trojita_QM})
728 target_link_libraries(trojita AppVersion Common DesktopGui ${QT_QTMAIN_LIBRARY} ${QT_QTGUI_LIBRARY} ${QT_QTCORE_LIBRARY})
730 target_link_libraries(trojita MimetypesQt4)
733 target_link_libraries(trojita ${ZLIB_LIBRARIES})
736 add_executable(be.contacts ${be_contacts_SOURCES})
737 target_link_libraries(be.contacts AbookAddressbook ${QT_QTGUI_LIBRARY} ${QT_QTCORE_LIBRARY})
738 elseif(BUILD_HARMATTAN)
739 add_library(QmlModelGlue ${libQmlModelGlue_SOURCES})
740 add_library(trojitaqnamwebviewplugin SHARED ${libQNAMWebView_SOURCES})
741 add_executable(trojita-tp ${trojitaHarmattan_SOURCES})
742 if(SUPPORTS_TARGET_INCLUDES)
743 set_property(TARGET trojita-tp APPEND PROPERTY INCLUDE_DIRECTORIES
744 ${QT_MKSPECS_DIR}/default ${CMAKE_CURRENT_SOURCE_DIR}/src/Harmattan/qmlapplicationviewer)
746 target_link_libraries(trojita-tp QmlModelGlue AppVersion Imap MSA Streams qwwsmtpclient Common Composer MimetypesQt4
747 ${QT_QTSQL_LIBRARY} ${QT_QTNETWORK_LIBRARY} ${QT_QTWEBKIT_LIBRARY} ${QT_QTDECLARATIVE_LIBRARY})
751 qt5_use_modules(AppVersion Core)
752 qt5_use_modules(Common Core)
753 qt5_use_modules(Streams Network)
754 qt5_use_modules(qwwsmtpclient Network)
755 qt5_use_modules(MSA Network)
756 qt5_use_modules(Composer Gui Network)
757 qt5_use_modules(Imap Gui Network Sql)
758 qt5_use_modules(DesktopGui Network WebKitWidgets)
759 qt5_use_modules(AbookAddressbook Widgets)
760 qt5_use_modules(be.contacts Widgets)
761 qt5_use_modules(trojita Widgets)
764 if(BUILD_DESKTOP_GUI)
765 install(TARGETS trojita be.contacts RUNTIME DESTINATION bin)
766 install(FILES ${CMAKE_CURRENT_SOURCE_DIR}/src/Gui/trojita.desktop DESTINATION share/applications/)
767 install(FILES ${CMAKE_CURRENT_SOURCE_DIR}/src/icons/trojita.png DESTINATION share/icons/hicolor/32x32/apps/)
768 install(FILES ${CMAKE_CURRENT_SOURCE_DIR}/src/icons/trojita.svg DESTINATION share/icons/hicolor/scalable/apps/)
769 elseif(BUILD_HARMATTAN)
770 set(trojita_harmattan_path ${CMAKE_CURRENT_SOURCE_DIR}/src/Harmattan)
771 install(TARGETS trojita-tp RUNTIME DESTINATION opt/trojita-tp/bin)
772 install(TARGETS trojitaqnamwebviewplugin LIBRARY DESTINATION opt/trojita-tp/bin/net/flaska/QNAMWebView)
773 install(FILES ${CMAKE_CURRENT_SOURCE_DIR}/src/QmlSupport/QNAMWebView/qmldir DESTINATION opt/trojita-tp/bin/net/flaska/QNAMWebView)
774 install(DIRECTORY ${trojita_harmattan_path}/qml DESTINATION opt/trojita-tp/)
775 install(FILES ${trojita_harmattan_path}/trojita-tp.desktop DESTINATION usr/share/applications/)
776 install(FILES ${trojita_harmattan_path}/trojita-tp80.png DESTINATION usr/share/icons/hicolor/80x80/apps/)
779 if(WIN32 AND WITH_NSIS AND MAKENSIS)
780 if(CMAKE_SIZEOF_VOID_P STREQUAL 4)
781 set(MAKENSIS_OUTPUT Trojita-installer.exe)
783 set(MAKENSIS_FLAGS -DX86_64 ${MAKENSIS_FLAGS})
784 set(MAKENSIS_OUTPUT Trojita-installer-x86_64.exe)
787 if(NOT CMAKE_VERBOSE_MAKEFILE)
788 set(MAKENSIS_FLAGS -V2 -DQUIET ${MAKENSIS_FLAGS})
791 set(MAKENSIS_FLAGS ${MAKENSIS_FLAGS} -NOCD)
793 add_custom_command(OUTPUT ${MAKENSIS_OUTPUT}
795 ARGS ${MAKENSIS_FLAGS} ${CMAKE_CURRENT_SOURCE_DIR}/packaging/trojita.nsi
796 DEPENDS ${CMAKE_CURRENT_SOURCE_DIR}/packaging/trojita.nsi ${CMAKE_CURRENT_BINARY_DIR}/trojita.exe version)
797 add_custom_target(installer ALL DEPENDS ${MAKENSIS_OUTPUT})
801 if(NOT WITHOUT_TESTS)
802 set(test_LibMailboxSync_SOURCES
803 tests/Utils/ModelEvents.cpp
804 tests/Utils/LibMailboxSync.cpp
806 add_library(test_LibMailboxSync ${test_LibMailboxSync_SOURCES})
808 qt5_use_modules(test_LibMailboxSync Test Network)
810 if(SUPPORTS_TARGET_INCLUDES)
811 set_property(TARGET test_LibMailboxSync APPEND PROPERTY INCLUDE_DIRECTORIES
812 ${CMAKE_CURRENT_SOURCE_DIR}/tests
813 ${CMAKE_CURRENT_SOURCE_DIR}/tests/Utils)
815 target_link_libraries(test_LibMailboxSync Imap MSA Streams Common Composer ${QT_QTTEST_LIBRARY} ${QT_QTCORE_LIBRARY})
817 macro(trojita_test dir fname)
818 set(test_${fname}_SOURCES tests/${dir}/test_${fname}.cpp)
819 add_executable(test_${fname} ${test_${fname}_SOURCES})
820 target_link_libraries(test_${fname} Imap MSA Streams Common Composer test_LibMailboxSync)
822 qt5_use_modules(test_${fname} Network Sql Test Widgets)
824 target_link_libraries(test_${fname} ${QT_QTSQL_LIBRARY} ${QT_QTTEST_LIBRARY} ${QT_QTGUI_LIBRARY} ${QT_QTCORE_LIBRARY} ${QT_QTNETWORK_LIBRARY})
827 target_link_libraries(test_${fname} ${ZLIB_LIBRARIES})
829 add_test(test_${fname} test_${fname})
830 if(SUPPORTS_TARGET_INCLUDES)
831 set_property(TARGET test_${fname} APPEND PROPERTY INCLUDE_DIRECTORIES ${CMAKE_CURRENT_SOURCE_DIR}/tests)
836 trojita_test(Composer Composer_Submission)
837 trojita_test(Composer Composer_responses)
838 trojita_test(Composer Html_formatting)
840 qt5_use_modules(test_Composer_responses WebKitWidgets)
841 qt5_use_modules(test_Html_formatting WebKitWidgets)
843 target_link_libraries(test_Html_formatting ${QT_QTWEBKIT_LIBRARY})
845 trojita_test(Imap Imap_DisappearingMailboxes)
846 trojita_test(Imap Imap_Idle)
847 trojita_test(Imap Imap_LowLevelParser)
848 trojita_test(Imap Imap_Message)
849 trojita_test(Imap Imap_Model)
850 trojita_test(Imap Imap_Parser_parse)
851 trojita_test(Imap Imap_Responses)
852 trojita_test(Imap Imap_SelectedMailboxUpdates)
853 trojita_test(Imap Imap_Tasks_CreateMailbox)
854 trojita_test(Imap Imap_Tasks_DeleteMailbox)
855 trojita_test(Imap Imap_Tasks_ListChildMailboxes)
856 trojita_test(Imap Imap_Tasks_ObtainSynchronizedMailbox)
857 trojita_test(Imap Imap_Tasks_OpenConnection)
858 trojita_test(Imap Imap_Threading)
859 trojita_test(Misc Rfc5322)
860 trojita_test(Misc RingBuffer)
861 trojita_test(Misc SenderIdentitiesModel)
862 trojita_test(Misc SqlCache)
863 trojita_test(Misc algorithms)
864 trojita_test(Misc rfccodecs)
867 if(WIN32) # Check if we are on Windows
868 if(MSVC10) # Check if we are using the Visual Studio compiler 2010
869 # Because of linker errors (see http://stackoverflow.com/questions/5625884/conversion-of-stdwstring-to-qstring-throws-linker-error)
870 set(CMAKE_CXX_FLAGS "${CMAKE_CXX_FLAGS} /Zc:wchar_t-")
873 message(WARNING "You are using a compiler which we have not tested yet (not MSVC10 or MINGW).")
874 message(WARNING "Please let us know how well it works.")
878 # FIXME: fix build warnings