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)
11 set(BUILD_DESKTOP_GUI false)
12 set(BUILD_HARMATTAN true)
13 set(WITHOUT_TESTS true)
14 message(STATUS "Building version for MeeGo Harmattan")
16 set(BUILD_DESKTOP_GUI true)
17 set(BUILD_HARMATTAN false)
18 message(STATUS "Building the desktop version")
22 message(STATUS "Building the Qt5 version")
23 find_package(Qt5Gui REQUIRED)
24 find_package(Qt5Network REQUIRED)
25 find_package(Qt5Sql REQUIRED)
26 find_package(Qt5WebKitWidgets REQUIRED)
27 find_package(Qt5Widgets REQUIRED)
28 find_package(Qt5LinguistTools)
30 find_package(Qt5Test REQUIRED)
32 set(CMAKE_CXX_FLAGS "${CMAKE_CXX_FLAGS} ${Qt5Widgets_EXECUTABLE_COMPILE_FLAGS}")
33 if(Qt5LinguistTools_FOUND)
34 find_package(Qt5LinguistForTrojita)
37 message(STATUS "Building the Qt4 version")
38 set(QT_USE_QTNETWORK 1)
40 set(QT_USE_QTWEBKIT 1)
45 set(QT_USE_QTDECLARATIVE 1)
47 find_package(Qt4 4.6 REQUIRED)
48 include(${QT_USE_FILE})
49 add_definitions(${QT_DEFINITIONS})
50 find_package(LinguistForTrojita)
54 if(NOT WIN32 AND NOT MSVC)
55 # Check if we are NOT on Windows and don't use MSVC since -g is not supported by VC
56 # and Wall makes the build very noisy.
57 set(CMAKE_CXX_FLAGS "${CMAKE_CXX_FLAGS} -Wall -g")
58 #set(CMAKE_CXX_FLAGS "${CMAKE_CXX_FLAGS} -Wall -Wextra -Wnon-virtual-dtor -Wold-style-cast -Woverloaded-virtual")
59 endif(NOT WIN32 AND NOT MSVC)
61 include_directories(${CMAKE_CURRENT_SOURCE_DIR}/src)
62 # The following is required so that the moc_*.cpp and ui_*.h are found
63 include_directories(${CMAKE_CURRENT_BINARY_DIR})
64 add_definitions(-DQT_STRICT_ITERATORS)
66 if(NOT WITH_QT5 AND CMAKE_VERSION VERSION_LESS 2.8.10)
67 set(SUPPORTS_TARGET_INCLUDES 0)
69 ${QT_MKSPECS_DIR}/default
70 ${CMAKE_CURRENT_SOURCE_DIR}/src/Gui/
71 ${CMAKE_CURRENT_SOURCE_DIR}/src/mimetypes-qt4/io/
72 ${CMAKE_CURRENT_SOURCE_DIR}/src/Harmattan/qmlapplicationviewer
73 ${CMAKE_CURRENT_SOURCE_DIR}/tests
74 ${CMAKE_CURRENT_SOURCE_DIR}/tests/test_LibMailboxSync)
76 set(SUPPORTS_TARGET_INCLUDES 1)
79 set(CMAKE_AUTOMOC True)
82 find_package(RagelForTrojita)
87 if(NOT WIN32) # Check if we are NOT on Windows
90 # On win32, qt can statically link to zlib and export their symbols.
91 # We check if we can find the string " zlib " in the QT_CONFIG list in
92 # ${QT_MKSPECS_DIR}/qconfig.pri and include on success ${QT_QTCORE_LIBRARY}
93 # and ${QTDIR}/src/3rdparty/zlib as lib and include folder
95 message(STATUS "We are on Windows with Qt. Checking if zlib is built into Qt")
97 if(EXISTS "${QT_MKSPECS_DIR}/qconfig.pri")
98 file(READ ${QT_MKSPECS_DIR}/qconfig.pri _qconfig_FILE_contents_ZLIB_CHECK)
99 string(REGEX MATCH "QT_CONFIG[^\n]+" QT_CONFIG_ZLIB_CHECK ${_qconfig_FILE_contents_ZLIB_CHECK})
101 if(QT_CONFIG_ZLIB_CHECK)
102 if(QT_CONFIG_ZLIB_CHECK MATCHES " zlib ")
103 message(STATUS "Found zlib in QT_QCONFIG. zlib seems to be built into Qt")
104 set(ZLIB_LIBRARY_RELEASE ${QT_QTCORE_LIBRARY_RELEASE})
105 set(ZLIB_LIBRARY_DEBUG ${QT_QTCORE_LIBRARY_DEBUG})
106 set(ZLIB_LIBRARY ${QT_QTCORE_LIBRARY})
108 string(REGEX REPLACE "\\\\" "/" QTDIR $ENV{QTDIR})
109 set(ZLIB_INCLUDE_DIR "${QTDIR}/src/3rdparty/zlib")
112 set(ZLIB_LIBRARIES ${ZLIB_LIBRARY} )
113 mark_as_advanced(ZLIB_LIBRARY ZLIB_INCLUDE_DIR ZLIB_FOUND)
114 else(QT_CONFIG_ZLIB_CHECK MATCHES " zlib ")
115 message(STATUS "Could not determine if Qt was built with zlib support.")
116 endif(QT_CONFIG_ZLIB_CHECK MATCHES " zlib ")
118 endif(QT_CONFIG_ZLIB_CHECK)
119 endif(EXISTS "${QT_MKSPECS_DIR}/qconfig.pri")
120 endif(QT_QTCORE_FOUND)
125 set(TROJITA_HAVE_ZLIB True)
126 message(STATUS "Support for COMPRESS=DEFLATE enabled")
128 set(TROJITA_HAVE_ZLIB False)
129 message(STATUS "Disabling COMPRESS=DEFLATE, zlib is not available")
132 configure_file(${CMAKE_CURRENT_SOURCE_DIR}/src/configure.cmake.in
133 ${CMAKE_CURRENT_BINARY_DIR}/configure.cmake.h)
135 set(path_Common ${CMAKE_CURRENT_SOURCE_DIR}/src/Common)
136 set(libCommon_HEADERS
137 ${path_Common}/ConnectionId.h
138 ${path_Common}/DeleteAfter.h
139 ${path_Common}/FileLogger.h
140 ${path_Common}/SettingsNames.h
142 set(libCommon_SOURCES
143 ${path_Common}/ConnectionId.cpp
144 ${path_Common}/DeleteAfter.cpp
145 ${path_Common}/FileLogger.cpp
146 ${path_Common}/SettingsNames.cpp
149 set(path_Composer ${CMAKE_CURRENT_SOURCE_DIR}/src/Composer)
150 set(libComposer_HEADERS
151 ${path_Composer}/ComposerAttachments.h
152 ${path_Composer}/MessageComposer.h
153 ${path_Composer}/PlainTextFormatter.h
154 ${path_Composer}/Recipients.h
155 ${path_Composer}/ReplaceSignature.h
156 ${path_Composer}/SenderIdentitiesModel.h
157 ${path_Composer}/SubjectMangling.h
158 ${path_Composer}/Submission.h
160 set(libComposer_SOURCES
161 ${path_Composer}/ComposerAttachments.cpp
162 ${path_Composer}/MessageComposer.cpp
163 ${path_Composer}/PlainTextFormatter.cpp
164 ${path_Composer}/Recipients.cpp
165 ${path_Composer}/ReplaceSignature.cpp
166 ${path_Composer}/SenderIdentitiesModel.cpp
167 ${path_Composer}/SubjectMangling.cpp
168 ${path_Composer}/Submission.cpp
171 set(path_MSA ${CMAKE_CURRENT_SOURCE_DIR}/src/MSA)
173 ${path_MSA}/AbstractMSA.h
174 ${path_MSA}/FakeMSA.h
175 ${path_MSA}/ImapSubmit.h
177 ${path_MSA}/Sendmail.h
180 ${path_MSA}/AbstractMSA.cpp
181 ${path_MSA}/FakeMSA.cpp
182 ${path_MSA}/ImapSubmit.cpp
184 ${path_MSA}/Sendmail.cpp
187 set(path_Streams ${CMAKE_CURRENT_SOURCE_DIR}/src/Streams)
188 set(libStreams_HEADERS
189 ${path_Streams}/DeletionWatcher.h
190 ${path_Streams}/FakeSocket.h
191 ${path_Streams}/IODeviceSocket.h
192 ${path_Streams}/Socket.h
193 ${path_Streams}/SocketFactory.h
195 set(libStreams_SOURCES
196 ${path_Streams}/DeletionWatcher.cpp
197 ${path_Streams}/FakeSocket.cpp
198 ${path_Streams}/IODeviceSocket.cpp
199 ${path_Streams}/Socket.cpp
200 ${path_Streams}/SocketFactory.cpp
204 set(libStreams_SOURCES ${libStreams_SOURCES}
205 ${path_Streams}/3rdparty/rfc1951.cpp)
206 include_directories(${ZLIB_INCLUDE_DIR})
209 set(path_mimetypesqt4 ${CMAKE_CURRENT_SOURCE_DIR}/src/mimetypes-qt4)
210 set(libMimetypesQt4_HEADERS
211 ${path_mimetypesqt4}/io/qstandardpaths.h
212 ${path_mimetypesqt4}/mimetypes/qmimedatabase_p.h
213 ${path_mimetypesqt4}/mimetypes/qmimeglobpattern_p.h
214 ${path_mimetypesqt4}/mimetypes/qmimemagicrule_p.h
215 ${path_mimetypesqt4}/mimetypes/qmimemagicrulematcher_p.h
216 ${path_mimetypesqt4}/mimetypes/qmimeprovider_p.h
217 ${path_mimetypesqt4}/mimetypes/qmimetype_p.h
218 ${path_mimetypesqt4}/mimetypes/qmimetypeparser_p.h
219 ${path_mimetypesqt4}/mimetypes/qmimetype.h
220 ${path_mimetypesqt4}/mimetypes/qmimedatabase.h
222 set(libMimetypesQt4_SOURCES
223 ${path_mimetypesqt4}/io/qstandardpaths.cpp
224 ${path_mimetypesqt4}/mimetypes/qmimedatabase.cpp
225 ${path_mimetypesqt4}/mimetypes/qmimeglobpattern.cpp
226 ${path_mimetypesqt4}/mimetypes/qmimemagicrule.cpp
227 ${path_mimetypesqt4}/mimetypes/qmimemagicrulematcher.cpp
228 ${path_mimetypesqt4}/mimetypes/qmimetype.cpp
229 ${path_mimetypesqt4}/mimetypes/qmimetypeparser.cpp
230 ${path_mimetypesqt4}/mimetypes/qmimeprovider.cpp
233 set(libMimetypesQt4_SOURCES ${libMimetypesQt4_SOURCES}
234 ${path_mimetypesqt4}/io/qstandardpaths_win.cpp)
236 set(libMimetypesQt4_SOURCES ${libMimetypesQt4_SOURCES}
237 ${path_mimetypesqt4}/io/qstandardpaths_mac.cpp)
239 set(libMimetypesQt4_SOURCES ${libMimetypesQt4_SOURCES}
240 ${path_mimetypesqt4}/io/qstandardpaths_os2.cpp)
242 set(libMimetypesQt4_SOURCES ${libMimetypesQt4_SOURCES}
243 ${path_mimetypesqt4}/io/qstandardpaths_unix.cpp)
245 message(FATAL_ERROR "Unsupported platform -- mimetypes-Qt4 support only Unix, MacOSX, Windows and OS/2")
248 set(path_DesktopGui ${CMAKE_CURRENT_SOURCE_DIR}/src/Gui)
249 set(libDesktopGui_HEADERS
250 ${path_DesktopGui}/AttachmentView.h
251 ${path_DesktopGui}/AutoCompletion.h
252 ${path_DesktopGui}/CompleteMessageWidget.h
253 ${path_DesktopGui}/ComposeWidget.h
254 ${path_DesktopGui}/ComposerAttachmentsList.h
255 ${path_DesktopGui}/ComposerTextEdit.h
256 ${path_DesktopGui}/EmbeddedWebView.h
257 ${path_DesktopGui}/EnvelopeView.h
258 ${path_DesktopGui}/ExternalElementsWidget.h
259 ${path_DesktopGui}/FindBar.h
260 ${path_DesktopGui}/FlowLayout.h
261 ${path_DesktopGui}/FromAddressProxyModel.h
262 ${path_DesktopGui}/LineEdit.h
263 ${path_DesktopGui}/LoadablePartWidget.h
264 ${path_DesktopGui}/MailBoxTreeView.h
265 ${path_DesktopGui}/MessageListWidget.h
266 ${path_DesktopGui}/MessageSourceWidget.h
267 ${path_DesktopGui}/MessageView.h
268 ${path_DesktopGui}/MsgListView.h
269 ${path_DesktopGui}/OnePanelAtTimeWidget.h
270 ${path_DesktopGui}/OverlayWidget.h
271 ${path_DesktopGui}/PartWidget.h
272 ${path_DesktopGui}/PartWidgetFactory.h
273 ${path_DesktopGui}/PasswordDialog.h
274 ${path_DesktopGui}/ProgressPopUp.h
275 ${path_DesktopGui}/ProtocolLoggerWidget.h
276 ${path_DesktopGui}/ReplaceCharValidator.h
277 ${path_DesktopGui}/SettingsDialog.h
278 ${path_DesktopGui}/SimplePartWidget.h
279 ${path_DesktopGui}/Spinner.h
280 ${path_DesktopGui}/TagListWidget.h
281 ${path_DesktopGui}/TagWidget.h
282 ${path_DesktopGui}/TaskProgressIndicator.h
283 ${path_DesktopGui}/UserAgentWebPage.h
284 ${path_DesktopGui}/Util.h
285 ${path_DesktopGui}/Window.h
286 ${path_DesktopGui}/ShortcutHandler/ShortcutConfigDialog.h
287 ${path_DesktopGui}/ShortcutHandler/ShortcutConfigWidget.h
288 ${path_DesktopGui}/ShortcutHandler/ShortcutHandler.h
290 set(libDesktopGui_SOURCES
291 ${path_DesktopGui}/AttachmentView.cpp
292 ${path_DesktopGui}/AutoCompletion.cpp
293 ${path_DesktopGui}/CompleteMessageWidget.cpp
294 ${path_DesktopGui}/ComposeWidget.cpp
295 ${path_DesktopGui}/ComposerAttachmentsList.cpp
296 ${path_DesktopGui}/ComposerTextEdit.cpp
297 ${path_DesktopGui}/EmbeddedWebView.cpp
298 ${path_DesktopGui}/EnvelopeView.cpp
299 ${path_DesktopGui}/ExternalElementsWidget.cpp
300 ${path_DesktopGui}/FindBar.cpp
301 ${path_DesktopGui}/FlowLayout.cpp
302 ${path_DesktopGui}/FromAddressProxyModel.cpp
303 ${path_DesktopGui}/LineEdit.cpp
304 ${path_DesktopGui}/LoadablePartWidget.cpp
305 ${path_DesktopGui}/MailBoxTreeView.cpp
306 ${path_DesktopGui}/MessageListWidget.cpp
307 ${path_DesktopGui}/MessageSourceWidget.cpp
308 ${path_DesktopGui}/MessageView.cpp
309 ${path_DesktopGui}/MsgListView.cpp
310 ${path_DesktopGui}/OnePanelAtTimeWidget.cpp
311 ${path_DesktopGui}/OverlayWidget.cpp
312 ${path_DesktopGui}/PartWidget.cpp
313 ${path_DesktopGui}/PartWidgetFactory.cpp
314 ${path_DesktopGui}/PasswordDialog.cpp
315 ${path_DesktopGui}/ProgressPopUp.cpp
316 ${path_DesktopGui}/ProtocolLoggerWidget.cpp
317 ${path_DesktopGui}/ReplaceCharValidator.cpp
318 ${path_DesktopGui}/SettingsDialog.cpp
319 ${path_DesktopGui}/SimplePartWidget.cpp
320 ${path_DesktopGui}/Spinner.cpp
321 ${path_DesktopGui}/TagListWidget.cpp
322 ${path_DesktopGui}/TagWidget.cpp
323 ${path_DesktopGui}/TaskProgressIndicator.cpp
324 ${path_DesktopGui}/UserAgentWebPage.cpp
325 ${path_DesktopGui}/Util.cpp
326 ${path_DesktopGui}/Window.cpp
327 ${path_DesktopGui}/ShortcutHandler/ShortcutConfigDialog.cpp
328 ${path_DesktopGui}/ShortcutHandler/ShortcutConfigWidget.cpp
329 ${path_DesktopGui}/ShortcutHandler/ShortcutHandler.cpp
332 ${path_DesktopGui}/CreateMailboxDialog.ui
333 ${path_DesktopGui}/SettingsOutgoingPage.ui
334 ${path_DesktopGui}/SettingsGeneralPage.ui
335 ${path_DesktopGui}/ComposeWidget.ui
336 ${path_DesktopGui}/ProgressPopUpOld.ui
337 ${path_DesktopGui}/ShortcutHandler/ShortcutConfigWidget.ui
338 ${path_DesktopGui}/SettingsImapPage.ui
339 ${path_DesktopGui}/PasswordDialog.ui
340 ${path_DesktopGui}/SettingsCachePage.ui
341 ${path_DesktopGui}/EditIdentity.ui
342 ${path_DesktopGui}/ProgressPopUp.ui
344 set(libDesktopGui_RESOURCES
345 ${CMAKE_CURRENT_SOURCE_DIR}/src/icons.qrc
348 set(libqwwsmtpclient_HEADERS ${CMAKE_CURRENT_SOURCE_DIR}/src/qwwsmtpclient/qwwsmtpclient.h)
349 set(libqwwsmtpclient_SOURCES ${CMAKE_CURRENT_SOURCE_DIR}/src/qwwsmtpclient/qwwsmtpclient.cpp)
351 set(libAppVersion_HEADERS ${CMAKE_CURRENT_SOURCE_DIR}/src/AppVersion/SetCoreApplication.h)
352 set(libAppVersion_SOURCES ${CMAKE_CURRENT_SOURCE_DIR}/src/AppVersion/SetCoreApplication.cpp)
354 set(path_Imap ${CMAKE_CURRENT_SOURCE_DIR}/src/Imap)
356 ${path_Imap}/ConnectionState.h
357 ${path_Imap}/Exceptions.h
358 ${path_Imap}/Encoders.h
359 ${path_Imap}/Parser/3rdparty/kcodecs.h
360 ${path_Imap}/Parser/3rdparty/rfccodecs.h
362 ${path_Imap}/Parser/Command.h
363 ${path_Imap}/Parser/Data.h
364 ${path_Imap}/Parser/LowLevelParser.h
365 ${path_Imap}/Parser/MailAddress.h
366 ${path_Imap}/Parser/Message.h
367 ${path_Imap}/Parser/Parser.h
368 ${path_Imap}/Parser/Response.h
369 ${path_Imap}/Parser/Rfc5322HeaderParser.h
370 ${path_Imap}/Parser/Sequence.h
371 ${path_Imap}/Parser/ThreadingNode.h
373 ${path_Imap}/Network/FileDownloadManager.h
374 ${path_Imap}/Network/ForbiddenReply.h
375 ${path_Imap}/Network/MsgPartNetAccessManager.h
376 ${path_Imap}/Network/MsgPartNetworkReply.h
378 ${path_Imap}/Model/Cache.h
379 ${path_Imap}/Model/CatenateData.h
380 ${path_Imap}/Model/CombinedCache.h
381 ${path_Imap}/Model/CopyMoveOperation.h
382 ${path_Imap}/Model/DelayedPopulation.h
383 ${path_Imap}/Model/DiskPartCache.h
384 ${path_Imap}/Model/FindInterestingPart.h
385 ${path_Imap}/Model/FlagsOperation.h
386 ${path_Imap}/Model/FullMessageCombiner.h
387 ${path_Imap}/Model/ItemRoles.h
388 ${path_Imap}/Model/MailboxMetadata.h
389 ${path_Imap}/Model/MailboxModel.h
390 ${path_Imap}/Model/MailboxTree.h
391 ${path_Imap}/Model/MemoryCache.h
392 ${path_Imap}/Model/Model.h
393 ${path_Imap}/Model/ModelTest/modeltest.h
394 ${path_Imap}/Model/ModelWatcher.h
395 ${path_Imap}/Model/MsgListModel.h
396 ${path_Imap}/Model/OneMessageModel.h
397 ${path_Imap}/Model/ParserState.h
398 ${path_Imap}/Model/PrettyMailboxModel.h
399 ${path_Imap}/Model/PrettyMsgListModel.h
400 ${path_Imap}/Model/QAIM_reset.h
401 ${path_Imap}/Model/SQLCache.h
402 ${path_Imap}/Model/SubscribeUnSubscribeOperation.h
403 ${path_Imap}/Model/SubtreeModel.h
404 ${path_Imap}/Model/TaskFactory.h
405 ${path_Imap}/Model/TaskPresentationModel.h
406 ${path_Imap}/Model/ThreadingMsgListModel.h
407 ${path_Imap}/Model/UidSubmitData.h
408 ${path_Imap}/Model/Utils.h
409 ${path_Imap}/Model/VisibleTasksModel.h
411 ${path_Imap}/Model/kdeui-itemviews/kbihash_p.h
412 # this file is left out intentionally; otherwise cmake's automoc won't work with it
413 #${path_Imap}/Model/kdeui-itemviews/kdescendantsproxymodel.h
415 ${path_Imap}/Tasks/AppendTask.h
416 ${path_Imap}/Tasks/CopyMoveMessagesTask.h
417 ${path_Imap}/Tasks/CreateMailboxTask.h
418 ${path_Imap}/Tasks/DeleteMailboxTask.h
419 ${path_Imap}/Tasks/EnableTask.h
420 ${path_Imap}/Tasks/ExpungeMailboxTask.h
421 ${path_Imap}/Tasks/ExpungeMessagesTask.h
422 ${path_Imap}/Tasks/Fake_ListChildMailboxesTask.h
423 ${path_Imap}/Tasks/Fake_OpenConnectionTask.h
424 ${path_Imap}/Tasks/FetchMsgMetadataTask.h
425 ${path_Imap}/Tasks/FetchMsgPartTask.h
426 ${path_Imap}/Tasks/GenUrlAuthTask.h
427 ${path_Imap}/Tasks/GetAnyConnectionTask.h
428 ${path_Imap}/Tasks/IdTask.h
429 ${path_Imap}/Tasks/IdleLauncher.h
430 ${path_Imap}/Tasks/ImapTask.h
431 ${path_Imap}/Tasks/KeepMailboxOpenTask.h
432 ${path_Imap}/Tasks/ListChildMailboxesTask.h
433 ${path_Imap}/Tasks/NoopTask.h
434 ${path_Imap}/Tasks/NumberOfMessagesTask.h
435 ${path_Imap}/Tasks/ObtainSynchronizedMailboxTask.h
436 ${path_Imap}/Tasks/OfflineConnectionTask.h
437 ${path_Imap}/Tasks/OpenConnectionTask.h
438 ${path_Imap}/Tasks/SortTask.h
439 ${path_Imap}/Tasks/SubscribeUnsubscribeTask.h
440 ${path_Imap}/Tasks/ThreadTask.h
441 ${path_Imap}/Tasks/UidSubmitTask.h
442 ${path_Imap}/Tasks/UnSelectTask.h
443 ${path_Imap}/Tasks/UpdateFlagsTask.h
444 ${path_Imap}/Tasks/UpdateFlagsOfAllMessagesTask.h
447 ${path_Imap}/ConnectionState.cpp
448 ${path_Imap}/Encoders.cpp
449 ${path_Imap}/Exceptions.cpp
450 ${path_Imap}/Parser/3rdparty/kcodecs.cpp
451 ${path_Imap}/Parser/3rdparty/rfccodecs.cpp
453 ${path_Imap}/Parser/Command.cpp
454 ${path_Imap}/Parser/Data.cpp
455 ${path_Imap}/Parser/LowLevelParser.cpp
456 ${path_Imap}/Parser/MailAddress.cpp
457 ${path_Imap}/Parser/Message.cpp
458 ${path_Imap}/Parser/Parser.cpp
459 ${path_Imap}/Parser/Response.cpp
460 ${path_Imap}/Parser/Sequence.cpp
461 ${path_Imap}/Parser/ThreadingNode.cpp
463 ${path_Imap}/Network/FileDownloadManager.cpp
464 ${path_Imap}/Network/ForbiddenReply.cpp
465 ${path_Imap}/Network/MsgPartNetAccessManager.cpp
466 ${path_Imap}/Network/MsgPartNetworkReply.cpp
468 ${path_Imap}/Model/Cache.cpp
469 ${path_Imap}/Model/CombinedCache.cpp
470 ${path_Imap}/Model/DelayedPopulation.cpp
471 ${path_Imap}/Model/DiskPartCache.cpp
472 ${path_Imap}/Model/FindInterestingPart.cpp
473 ${path_Imap}/Model/FlagsOperation.cpp
474 ${path_Imap}/Model/FullMessageCombiner.cpp
475 ${path_Imap}/Model/MailboxMetadata.cpp
476 ${path_Imap}/Model/MailboxModel.cpp
477 ${path_Imap}/Model/MailboxTree.cpp
478 ${path_Imap}/Model/MemoryCache.cpp
479 ${path_Imap}/Model/Model.cpp
480 ${path_Imap}/Model/ModelWatcher.cpp
481 ${path_Imap}/Model/MsgListModel.cpp
482 ${path_Imap}/Model/OneMessageModel.cpp
483 ${path_Imap}/Model/ParserState.cpp
484 ${path_Imap}/Model/PrettyMailboxModel.cpp
485 ${path_Imap}/Model/PrettyMsgListModel.cpp
486 ${path_Imap}/Model/SQLCache.cpp
487 ${path_Imap}/Model/SubtreeModel.cpp
488 ${path_Imap}/Model/TaskFactory.cpp
489 ${path_Imap}/Model/TaskPresentationModel.cpp
490 ${path_Imap}/Model/ThreadingMsgListModel.cpp
491 ${path_Imap}/Model/Utils.cpp
492 ${path_Imap}/Model/VisibleTasksModel.cpp
494 ${path_Imap}/Model/ModelTest/modeltest.cpp
495 ${path_Imap}/Model/kdeui-itemviews/kdescendantsproxymodel.cpp
497 ${path_Imap}/Tasks/AppendTask.cpp
498 ${path_Imap}/Tasks/CopyMoveMessagesTask.cpp
499 ${path_Imap}/Tasks/CreateMailboxTask.cpp
500 ${path_Imap}/Tasks/DeleteMailboxTask.cpp
501 ${path_Imap}/Tasks/EnableTask.cpp
502 ${path_Imap}/Tasks/ExpungeMailboxTask.cpp
503 ${path_Imap}/Tasks/ExpungeMessagesTask.cpp
504 ${path_Imap}/Tasks/Fake_ListChildMailboxesTask.cpp
505 ${path_Imap}/Tasks/Fake_OpenConnectionTask.cpp
506 ${path_Imap}/Tasks/FetchMsgMetadataTask.cpp
507 ${path_Imap}/Tasks/FetchMsgPartTask.cpp
508 ${path_Imap}/Tasks/GenUrlAuthTask.cpp
509 ${path_Imap}/Tasks/GetAnyConnectionTask.cpp
510 ${path_Imap}/Tasks/IdTask.cpp
511 ${path_Imap}/Tasks/IdleLauncher.cpp
512 ${path_Imap}/Tasks/ImapTask.cpp
513 ${path_Imap}/Tasks/KeepMailboxOpenTask.cpp
514 ${path_Imap}/Tasks/ListChildMailboxesTask.cpp
515 ${path_Imap}/Tasks/NoopTask.cpp
516 ${path_Imap}/Tasks/NumberOfMessagesTask.cpp
517 ${path_Imap}/Tasks/ObtainSynchronizedMailboxTask.cpp
518 ${path_Imap}/Tasks/OfflineConnectionTask.cpp
519 ${path_Imap}/Tasks/OpenConnectionTask.cpp
520 ${path_Imap}/Tasks/SortTask.cpp
521 ${path_Imap}/Tasks/SubscribeUnsubscribeTask.cpp
522 ${path_Imap}/Tasks/ThreadTask.cpp
523 ${path_Imap}/Tasks/UidSubmitTask.cpp
524 ${path_Imap}/Tasks/UnSelectTask.cpp
525 ${path_Imap}/Tasks/UpdateFlagsTask.cpp
526 ${path_Imap}/Tasks/UpdateFlagsOfAllMessagesTask.cpp
529 if(WITH_RAGEL AND RAGEL_FOUND)
530 message(STATUS "Using Ragel for the RFC 5322 parser")
531 ragel_parser(${path_Imap}/Parser/Rfc5322HeaderParser.cpp)
532 set(libImap_SOURCES ${libImap_SOURCES}
533 ${CMAKE_CURRENT_BINARY_DIR}/Rfc5322HeaderParser.generated.cpp)
535 message(STATUS "Using pregenerated RFC 5322 parser")
536 set(libImap_SOURCES ${libImap_SOURCES}
537 ${path_Imap}/Parser/Rfc5322HeaderParser.generated.cpp)
540 set(path_AbookAddressbook ${CMAKE_CURRENT_SOURCE_DIR}/src/AbookAddressbook)
541 set(libAbookAddressbook_HEADERS
542 ${path_AbookAddressbook}/AbookAddressbook.h
543 ${path_AbookAddressbook}/be-contacts.h
545 set(libAbookAddressbook_SOURCES
546 ${path_AbookAddressbook}/AbookAddressbook.cpp
547 ${path_AbookAddressbook}/be-contacts.cpp
549 set(libAbookAddressbook_UI
550 ${path_AbookAddressbook}/be-contacts.ui
551 ${path_AbookAddressbook}/onecontact.ui
554 set(trojita_desktop_SOURCES
555 ${path_DesktopGui}/main.cpp
558 set(be_contacts_SOURCES
559 ${CMAKE_CURRENT_SOURCE_DIR}/src/be.contacts/main.cpp
562 set(libQmlModelGlue_SOURCES
563 ${CMAKE_CURRENT_SOURCE_DIR}/src/QmlSupport/ModelGlue/ImapAccess.cpp
565 set(libQmlModelGlue_HEADERS
566 ${CMAKE_CURRENT_SOURCE_DIR}/src/QmlSupport/ModelGlue/ImapAccess.h
569 set(libQNAMWebView_SOURCES
570 ${CMAKE_CURRENT_SOURCE_DIR}/src/QmlSupport/QNAMWebView/plugin.cpp
571 ${CMAKE_CURRENT_SOURCE_DIR}/src/QmlSupport/QNAMWebView/qdeclarativewebview.cpp
573 set(libQNAMWebView_HEADERS
574 ${CMAKE_CURRENT_SOURCE_DIR}/src/QmlSupport/QNAMWebView/plugin.h
575 ${CMAKE_CURRENT_SOURCE_DIR}/src/QmlSupport/QNAMWebView/qdeclarativewebview_p.h
578 set(trojitaHarmattan_SOURCES
579 ${CMAKE_CURRENT_SOURCE_DIR}/src/Harmattan/main.cpp
580 ${CMAKE_CURRENT_SOURCE_DIR}/src/Harmattan/qmlapplicationviewer/qmlapplicationviewer.cpp
584 file(GLOB_RECURSE lang_PO "${CMAKE_CURRENT_SOURCE_DIR}/po/trojita_common_*.po")
586 qt5_wrap_po(trojita_QM ${lang_PO})
588 qt4_wrap_po(trojita_QM ${lang_PO})
590 set(language_summary "")
591 foreach(po ${lang_PO})
592 string(REGEX REPLACE "^(.*)/trojita_common_(.*).po" "\\2" lang ${po})
593 list(APPEND language_summary ${lang})
595 list(SORT language_summary)
596 list(LENGTH language_summary num_languages)
598 message(STATUS "Available languages: ${language_summary}")
599 if(BUILD_DESKTOP_GUI)
600 install(DIRECTORY ${CMAKE_CURRENT_BINARY_DIR}/locale/ DESTINATION share/trojita/locale FILES_MATCHING PATTERN *.qm)
603 message(STATUS "No .po files found, will not install any languages")
606 message(STATUS "Qt Linguist (lupdate/lrelease/lconvert) not found, disabling localization support")
609 if(GIT_FOUND AND EXISTS ${CMAKE_CURRENT_SOURCE_DIR}/.git)
610 add_custom_target(git_version DEPENDS git_version_fake_file)
611 add_custom_command(OUTPUT git_version_fake_file ${CMAKE_CURRENT_BINARY_DIR}/gitversion.hpp
612 COMMAND ${CMAKE_COMMAND} -DSOURCE_DIR=${CMAKE_CURRENT_SOURCE_DIR} -DGIT_EXECUTABLE=${GIT_EXECUTABLE} -P ${CMAKE_CURRENT_SOURCE_DIR}/cmake/GitVersion.cmake)
613 set_source_files_properties(${CMAKE_CURRENT_BINARY_DIR}/gitversion.hpp
614 PROPERTIES GENERATED TRUE
615 HEADER_FILE_ONLY TRUE)
618 add_library(AppVersion ${libAppVersion_SOURCES})
620 if(GIT_FOUND AND EXISTS ${CMAKE_CURRENT_SOURCE_DIR}/.git)
621 set_property(TARGET AppVersion APPEND PROPERTY COMPILE_DEFINITIONS HAS_GITVERSION)
622 add_dependencies(AppVersion git_version git_version_fake_file)
625 add_library(Common ${libCommon_SOURCES})
627 add_library(Streams ${libStreams_SOURCES})
629 target_link_libraries(Streams ${ZLIB_LIBRARIES})
632 add_library(qwwsmtpclient ${libqwwsmtpclient_SOURCES})
634 add_library(MSA ${libMSA_SOURCES})
635 target_link_libraries(MSA Streams qwwsmtpclient)
637 add_library(Composer ${libComposer_SOURCES})
638 target_link_libraries(Composer Common MSA Streams qwwsmtpclient)
640 target_link_libraries(Composer MimetypesQt4)
643 add_library(Imap ${libImap_SOURCES})
644 target_link_libraries(Imap Common Streams ${QT_QTNETWORK_LIBRARY} ${QT_QTSQL_LIBRARY} ${QT_QTGUI_LIBRARY} ${QT_QTCORE_LIBRARY})
646 target_link_libraries(Imap ${ZLIB_LIBRARIES})
650 add_library(MimetypesQt4 ${libMimetypesQt4_SOURCES})
651 if(SUPPORTS_TARGET_INCLUDES)
652 set_property(TARGET MimetypesQt4 APPEND PROPERTY INCLUDE_DIRECTORIES
653 ${QT_MKSPECS_DIR}/default ${path_mimetypesqt4}/io/)
657 if(BUILD_DESKTOP_GUI)
659 qt5_wrap_ui(libAbookAddressbook_UI_OUT ${libAbookAddressbook_UI})
660 qt5_wrap_ui(libDesktopGui_UI_OUT ${libDesktopGui_UI})
661 qt5_add_resources(libDesktopGui_RESOURCES_OUT ${libDesktopGui_RESOURCES})
663 qt4_wrap_ui(libAbookAddressbook_UI_OUT ${libAbookAddressbook_UI})
664 qt4_wrap_ui(libDesktopGui_UI_OUT ${libDesktopGui_UI})
665 qt4_add_resources(libDesktopGui_RESOURCES_OUT ${libDesktopGui_RESOURCES})
668 add_library(AbookAddressbook ${libAbookAddressbook_SOURCES} ${libAbookAddressbook_UI_OUT})
670 add_library(DesktopGui ${libDesktopGui_SOURCES} ${libDesktopGui_UI_OUT} ${libDesktopGui_RESOURCES_OUT})
671 # The following is needed for the LineEdit widget within the .ui files.
672 # The ${path_DesktopGui} is needed so that the generated ui_*.h file can find the headers of the custom widgets
673 if(SUPPORTS_TARGET_INCLUDES)
674 set_property(TARGET DesktopGui APPEND PROPERTY INCLUDE_DIRECTORIES ${path_DesktopGui})
676 target_link_libraries(DesktopGui Common Composer Imap MSA Streams qwwsmtpclient AbookAddressbook)
678 if(WIN32) # Check if we are on Windows
679 # build a real Win32 GUI application. Hide the console window
680 add_executable(trojita WIN32 ${trojita_desktop_SOURCES} ${trojita_QM} ${CMAKE_CURRENT_SOURCE_DIR}/src/trojita_ico_win32.rc)
681 target_link_libraries(trojita ${QT_QTMAIN_LIBRARY} ${QT_LIBRARIES})
683 add_executable(trojita ${trojita_desktop_SOURCES} ${trojita_QM})
686 target_link_libraries(trojita AppVersion Imap MSA Streams qwwsmtpclient Common Composer AbookAddressbook DesktopGui
687 ${QT_QTSQL_LIBRARY} ${QT_QTNETWORK_LIBRARY} ${QT_QTWEBKIT_LIBRARY})
689 target_link_libraries(trojita MimetypesQt4 ${QT_QTGUI_LIBRARY} ${QT_QTNETWORK_LIBRARY} ${QT_QTCORE_LIBRARY})
692 target_link_libraries(trojita ${ZLIB_LIBRARIES})
695 add_executable(be.contacts ${be_contacts_SOURCES})
696 target_link_libraries(be.contacts AbookAddressbook ${QT_QTGUI_LIBRARY} ${QT_QTCORE_LIBRARY})
697 elseif(BUILD_HARMATTAN)
698 add_library(QmlModelGlue ${libQmlModelGlue_SOURCES})
699 add_library(trojitaqnamwebviewplugin SHARED ${libQNAMWebView_SOURCES})
700 add_executable(trojita-tp ${trojitaHarmattan_SOURCES})
701 if(SUPPORTS_TARGET_INCLUDES)
702 set_property(TARGET trojita-tp APPEND PROPERTY INCLUDE_DIRECTORIES
703 ${QT_MKSPECS_DIR}/default ${CMAKE_CURRENT_SOURCE_DIR}/src/Harmattan/qmlapplicationviewer)
705 target_link_libraries(trojita-tp QmlModelGlue AppVersion Imap MSA Streams qwwsmtpclient Common Composer MimetypesQt4
706 ${QT_QTSQL_LIBRARY} ${QT_QTNETWORK_LIBRARY} ${QT_QTWEBKIT_LIBRARY} ${QT_QTDECLARATIVE_LIBRARY})
710 qt5_use_modules(AppVersion Core)
711 qt5_use_modules(Common Core)
712 qt5_use_modules(Streams Network)
713 qt5_use_modules(qwwsmtpclient Network)
714 qt5_use_modules(MSA Network)
715 qt5_use_modules(Composer Gui Network)
716 qt5_use_modules(Imap Gui Network Sql)
717 qt5_use_modules(DesktopGui Network WebKitWidgets)
718 qt5_use_modules(AbookAddressbook Widgets)
719 qt5_use_modules(be.contacts Widgets)
720 qt5_use_modules(trojita Widgets)
723 if(BUILD_DESKTOP_GUI)
724 install(TARGETS trojita be.contacts RUNTIME DESTINATION bin)
725 install(FILES ${CMAKE_CURRENT_SOURCE_DIR}/src/Gui/trojita.desktop DESTINATION share/applications/)
726 install(FILES ${CMAKE_CURRENT_SOURCE_DIR}/src/icons/trojita.png DESTINATION share/icons/hicolor/32x32/apps/)
727 install(FILES ${CMAKE_CURRENT_SOURCE_DIR}/src/icons/trojita.svg DESTINATION share/icons/hicolor/scalable/apps/)
728 elseif(BUILD_HARMATTAN)
729 set(trojita_harmattan_path ${CMAKE_CURRENT_SOURCE_DIR}/src/Harmattan)
730 install(TARGETS trojita-tp RUNTIME DESTINATION opt/trojita-tp/bin)
731 install(TARGETS trojitaqnamwebviewplugin LIBRARY DESTINATION opt/trojita-tp/bin/net/flaska/QNAMWebView)
732 install(FILES ${CMAKE_CURRENT_SOURCE_DIR}/src/QmlSupport/QNAMWebView/qmldir DESTINATION opt/trojita-tp/bin/net/flaska/QNAMWebView)
733 install(DIRECTORY ${trojita_harmattan_path}/qml DESTINATION opt/trojita-tp/)
734 install(FILES ${trojita_harmattan_path}/trojita-tp.desktop DESTINATION usr/share/applications/)
735 install(FILES ${trojita_harmattan_path}/trojita-tp80.png DESTINATION usr/share/icons/hicolor/80x80/apps/)
739 if(NOT WITHOUT_TESTS)
740 set(test_LibMailboxSync_SOURCES
741 tests/test_LibMailboxSync/ModelEvents.cpp
742 tests/test_LibMailboxSync/test_LibMailboxSync.cpp
744 add_library(test_LibMailboxSync ${test_LibMailboxSync_SOURCES})
746 qt5_use_modules(test_LibMailboxSync Test Network)
748 if(SUPPORTS_TARGET_INCLUDES)
749 set_property(TARGET test_LibMailboxSync APPEND PROPERTY INCLUDE_DIRECTORIES
750 ${CMAKE_CURRENT_SOURCE_DIR}/tests
751 ${CMAKE_CURRENT_SOURCE_DIR}/tests/test_LibMailboxSync)
753 target_link_libraries(test_LibMailboxSync Imap MSA Streams Common Composer)
755 macro(trojita_test fname)
756 set(test_${fname}_SOURCES tests/tests/test_${fname}/test_${fname}.cpp)
757 set(test_${fname}_HEADERS tests/tests/test_${fname}/test_${fname}.h)
758 add_executable(test_${fname} ${test_${fname}_SOURCES})
759 target_link_libraries(test_${fname} Imap MSA Streams Common Composer test_LibMailboxSync)
761 qt5_use_modules(test_${fname} Network Sql Test Widgets)
763 target_link_libraries(test_${fname} ${QT_QTSQL_LIBRARY} ${QT_QTTEST_LIBRARY} ${QT_QTGUI_LIBRARY} ${QT_QTCORE_LIBRARY} ${QT_QTNETWORK_LIBRARY})
766 target_link_libraries(test_${fname} ${ZLIB_LIBRARIES})
768 add_test(test_${fname} test_${fname})
769 if(SUPPORTS_TARGET_INCLUDES)
770 set_property(TARGET test_${fname} APPEND PROPERTY INCLUDE_DIRECTORIES ${CMAKE_CURRENT_SOURCE_DIR}/tests)
775 trojita_test(Composer_Submission)
776 trojita_test(Composer_responses)
777 trojita_test(Html_formatting)
779 qt5_use_modules(test_Composer_responses WebKitWidgets)
780 qt5_use_modules(test_Html_formatting WebKitWidgets)
782 target_link_libraries(test_Html_formatting ${QT_QTWEBKIT_LIBRARY})
784 trojita_test(Imap_DisappearingMailboxes)
785 trojita_test(Imap_Idle)
786 trojita_test(Imap_LowLevelParser)
787 trojita_test(Imap_Message)
788 trojita_test(Imap_Model)
789 trojita_test(Imap_Parser_parse)
790 trojita_test(Imap_Responses)
791 trojita_test(Imap_SelectedMailboxUpdates)
792 trojita_test(Imap_Tasks_CreateMailbox)
793 trojita_test(Imap_Tasks_DeleteMailbox)
794 trojita_test(Imap_Tasks_ListChildMailboxes)
795 trojita_test(Imap_Tasks_ObtainSynchronizedMailbox)
796 trojita_test(Imap_Tasks_OpenConnection)
797 trojita_test(Imap_Threading)
798 trojita_test(Rfc5322)
799 trojita_test(RingBuffer)
800 trojita_test(SenderIdentitiesModel)
801 trojita_test(SqlCache)
802 trojita_test(algorithms)
803 trojita_test(rfccodecs)
806 if(WIN32) # Check if we are on Windows
807 if(MSVC10) # Check if we are using the Visual Studio compiler 2010
808 # Because of linker errors (see http://stackoverflow.com/questions/5625884/conversion-of-stdwstring-to-qstring-throws-linker-error)
809 set(CMAKE_CXX_FLAGS "${CMAKE_CXX_FLAGS} /Zc:wchar_t-")
811 message(WARNING "You are using a compiler which we have not tested yet (not MSVC10).")
812 message(WARNING "Please let us know how well it works.")
816 # FIXME: fix build warnings