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(WIN32 AND WITH_NSIS)
56 find_program(MAKENSIS makensis)
58 message(STATUS "makensis not found")
60 message(STATUS "Found makensis: ${MAKENSIS}")
62 mark_as_advanced(MAKENSIS)
66 if(NOT WIN32 AND NOT MSVC)
67 # Check if we are NOT on Windows and don't use MSVC since -g is not supported by VC
68 # and Wall makes the build very noisy.
69 set(CMAKE_CXX_FLAGS "${CMAKE_CXX_FLAGS} -Wall -g")
70 #set(CMAKE_CXX_FLAGS "${CMAKE_CXX_FLAGS} -Wall -Wextra -Wnon-virtual-dtor -Wold-style-cast -Woverloaded-virtual")
71 endif(NOT WIN32 AND NOT MSVC)
73 include_directories(${CMAKE_CURRENT_SOURCE_DIR}/src)
74 # The following is required so that the moc_*.cpp and ui_*.h are found
75 include_directories(${CMAKE_CURRENT_BINARY_DIR})
76 add_definitions(-DQT_STRICT_ITERATORS)
78 if(NOT WITH_QT5 AND CMAKE_VERSION VERSION_LESS 2.8.10)
79 set(SUPPORTS_TARGET_INCLUDES 0)
81 ${QT_MKSPECS_DIR}/default
82 ${CMAKE_CURRENT_SOURCE_DIR}/src/Gui/
83 ${CMAKE_CURRENT_SOURCE_DIR}/src/mimetypes-qt4/io/
84 ${CMAKE_CURRENT_SOURCE_DIR}/src/Harmattan/qmlapplicationviewer
85 ${CMAKE_CURRENT_SOURCE_DIR}/tests
86 ${CMAKE_CURRENT_SOURCE_DIR}/tests/test_LibMailboxSync)
88 set(SUPPORTS_TARGET_INCLUDES 1)
91 set(CMAKE_AUTOMOC True)
94 find_package(RagelForTrojita)
99 if(NOT WIN32) # Check if we are NOT on Windows
102 # On win32, qt can statically link to zlib and export their symbols.
103 # We check if we can find the string " zlib " in the QT_CONFIG list in
104 # ${QT_MKSPECS_DIR}/qconfig.pri and include on success ${QT_QTCORE_LIBRARY}
105 # and ${QTDIR}/src/3rdparty/zlib as lib and include folder
107 message(STATUS "We are on Windows with Qt. Checking if zlib is built into Qt")
109 if(EXISTS "${QT_MKSPECS_DIR}/qconfig.pri")
110 file(READ ${QT_MKSPECS_DIR}/qconfig.pri _qconfig_FILE_contents_ZLIB_CHECK)
111 string(REGEX MATCH "QT_CONFIG[^\n]+" QT_CONFIG_ZLIB_CHECK ${_qconfig_FILE_contents_ZLIB_CHECK})
113 if(QT_CONFIG_ZLIB_CHECK)
114 if(QT_CONFIG_ZLIB_CHECK MATCHES " zlib ")
115 message(STATUS "Found zlib in QT_QCONFIG. zlib seems to be built into Qt")
116 set(ZLIB_LIBRARY_RELEASE ${QT_QTCORE_LIBRARY_RELEASE})
117 set(ZLIB_LIBRARY_DEBUG ${QT_QTCORE_LIBRARY_DEBUG})
118 set(ZLIB_LIBRARY ${QT_QTCORE_LIBRARY})
120 string(REGEX REPLACE "\\\\" "/" QTDIR $ENV{QTDIR})
121 set(ZLIB_INCLUDE_DIR "${QTDIR}/src/3rdparty/zlib")
124 set(ZLIB_LIBRARIES ${ZLIB_LIBRARY} )
125 mark_as_advanced(ZLIB_LIBRARY ZLIB_INCLUDE_DIR ZLIB_FOUND)
126 else(QT_CONFIG_ZLIB_CHECK MATCHES " zlib ")
127 message(STATUS "Could not determine if Qt was built with zlib support.")
128 endif(QT_CONFIG_ZLIB_CHECK MATCHES " zlib ")
130 endif(QT_CONFIG_ZLIB_CHECK)
131 endif(EXISTS "${QT_MKSPECS_DIR}/qconfig.pri")
132 endif(QT_QTCORE_FOUND)
137 set(TROJITA_HAVE_ZLIB True)
138 message(STATUS "Support for COMPRESS=DEFLATE enabled")
140 set(TROJITA_HAVE_ZLIB False)
141 message(STATUS "Disabling COMPRESS=DEFLATE, zlib is not available")
144 configure_file(${CMAKE_CURRENT_SOURCE_DIR}/src/configure.cmake.in
145 ${CMAKE_CURRENT_BINARY_DIR}/configure.cmake.h)
147 set(path_Common ${CMAKE_CURRENT_SOURCE_DIR}/src/Common)
148 set(libCommon_HEADERS
149 ${path_Common}/Application.h
150 ${path_Common}/ConnectionId.h
151 ${path_Common}/DeleteAfter.h
152 ${path_Common}/FileLogger.h
153 ${path_Common}/Paths.h
154 ${path_Common}/SettingsNames.h
156 set(libCommon_SOURCES
157 ${path_Common}/Application.cpp
158 ${path_Common}/ConnectionId.cpp
159 ${path_Common}/DeleteAfter.cpp
160 ${path_Common}/FileLogger.cpp
161 ${path_Common}/Paths.cpp
162 ${path_Common}/SettingsNames.cpp
165 set(path_Composer ${CMAKE_CURRENT_SOURCE_DIR}/src/Composer)
166 set(libComposer_HEADERS
167 ${path_Composer}/ComposerAttachments.h
168 ${path_Composer}/MessageComposer.h
169 ${path_Composer}/PlainTextFormatter.h
170 ${path_Composer}/Recipients.h
171 ${path_Composer}/ReplaceSignature.h
172 ${path_Composer}/SenderIdentitiesModel.h
173 ${path_Composer}/SubjectMangling.h
174 ${path_Composer}/Submission.h
176 set(libComposer_SOURCES
177 ${path_Composer}/ComposerAttachments.cpp
178 ${path_Composer}/MessageComposer.cpp
179 ${path_Composer}/PlainTextFormatter.cpp
180 ${path_Composer}/Recipients.cpp
181 ${path_Composer}/ReplaceSignature.cpp
182 ${path_Composer}/SenderIdentitiesModel.cpp
183 ${path_Composer}/SubjectMangling.cpp
184 ${path_Composer}/Submission.cpp
187 set(path_MSA ${CMAKE_CURRENT_SOURCE_DIR}/src/MSA)
189 ${path_MSA}/AbstractMSA.h
190 ${path_MSA}/FakeMSA.h
191 ${path_MSA}/ImapSubmit.h
193 ${path_MSA}/Sendmail.h
196 ${path_MSA}/AbstractMSA.cpp
197 ${path_MSA}/FakeMSA.cpp
198 ${path_MSA}/ImapSubmit.cpp
200 ${path_MSA}/Sendmail.cpp
203 set(path_Streams ${CMAKE_CURRENT_SOURCE_DIR}/src/Streams)
204 set(libStreams_HEADERS
205 ${path_Streams}/DeletionWatcher.h
206 ${path_Streams}/FakeSocket.h
207 ${path_Streams}/IODeviceSocket.h
208 ${path_Streams}/Socket.h
209 ${path_Streams}/SocketFactory.h
211 set(libStreams_SOURCES
212 ${path_Streams}/DeletionWatcher.cpp
213 ${path_Streams}/FakeSocket.cpp
214 ${path_Streams}/IODeviceSocket.cpp
215 ${path_Streams}/Socket.cpp
216 ${path_Streams}/SocketFactory.cpp
220 set(libStreams_SOURCES ${libStreams_SOURCES}
221 ${path_Streams}/3rdparty/rfc1951.cpp)
222 include_directories(${ZLIB_INCLUDE_DIR})
225 set(path_mimetypesqt4 ${CMAKE_CURRENT_SOURCE_DIR}/src/mimetypes-qt4)
226 set(libMimetypesQt4_HEADERS
227 ${path_mimetypesqt4}/io/qstandardpaths.h
228 ${path_mimetypesqt4}/mimetypes/qmimedatabase_p.h
229 ${path_mimetypesqt4}/mimetypes/qmimeglobpattern_p.h
230 ${path_mimetypesqt4}/mimetypes/qmimemagicrule_p.h
231 ${path_mimetypesqt4}/mimetypes/qmimemagicrulematcher_p.h
232 ${path_mimetypesqt4}/mimetypes/qmimeprovider_p.h
233 ${path_mimetypesqt4}/mimetypes/qmimetype_p.h
234 ${path_mimetypesqt4}/mimetypes/qmimetypeparser_p.h
235 ${path_mimetypesqt4}/mimetypes/qmimetype.h
236 ${path_mimetypesqt4}/mimetypes/qmimedatabase.h
238 set(libMimetypesQt4_SOURCES
239 ${path_mimetypesqt4}/io/qstandardpaths.cpp
240 ${path_mimetypesqt4}/mimetypes/qmimedatabase.cpp
241 ${path_mimetypesqt4}/mimetypes/qmimeglobpattern.cpp
242 ${path_mimetypesqt4}/mimetypes/qmimemagicrule.cpp
243 ${path_mimetypesqt4}/mimetypes/qmimemagicrulematcher.cpp
244 ${path_mimetypesqt4}/mimetypes/qmimetype.cpp
245 ${path_mimetypesqt4}/mimetypes/qmimetypeparser.cpp
246 ${path_mimetypesqt4}/mimetypes/qmimeprovider.cpp
249 set(libMimetypesQt4_SOURCES ${libMimetypesQt4_SOURCES}
250 ${path_mimetypesqt4}/io/qstandardpaths_win.cpp)
252 set(libMimetypesQt4_SOURCES ${libMimetypesQt4_SOURCES}
253 ${path_mimetypesqt4}/io/qstandardpaths_mac.cpp)
255 set(libMimetypesQt4_SOURCES ${libMimetypesQt4_SOURCES}
256 ${path_mimetypesqt4}/io/qstandardpaths_os2.cpp)
258 set(libMimetypesQt4_SOURCES ${libMimetypesQt4_SOURCES}
259 ${path_mimetypesqt4}/io/qstandardpaths_unix.cpp)
261 message(FATAL_ERROR "Unsupported platform -- mimetypes-Qt4 support only Unix, MacOSX, Windows and OS/2")
264 set(path_DesktopGui ${CMAKE_CURRENT_SOURCE_DIR}/src/Gui)
265 set(libDesktopGui_HEADERS
266 ${path_DesktopGui}/AttachmentView.h
267 ${path_DesktopGui}/AutoCompletion.h
268 ${path_DesktopGui}/CompleteMessageWidget.h
269 ${path_DesktopGui}/ComposeWidget.h
270 ${path_DesktopGui}/ComposerAttachmentsList.h
271 ${path_DesktopGui}/ComposerTextEdit.h
272 ${path_DesktopGui}/EmbeddedWebView.h
273 ${path_DesktopGui}/EnvelopeView.h
274 ${path_DesktopGui}/ExternalElementsWidget.h
275 ${path_DesktopGui}/FindBar.h
276 ${path_DesktopGui}/FlowLayout.h
277 ${path_DesktopGui}/FromAddressProxyModel.h
278 ${path_DesktopGui}/LineEdit.h
279 ${path_DesktopGui}/LoadablePartWidget.h
280 ${path_DesktopGui}/MailBoxTreeView.h
281 ${path_DesktopGui}/MessageListWidget.h
282 ${path_DesktopGui}/MessageSourceWidget.h
283 ${path_DesktopGui}/MessageView.h
284 ${path_DesktopGui}/MsgListView.h
285 ${path_DesktopGui}/OnePanelAtTimeWidget.h
286 ${path_DesktopGui}/OverlayWidget.h
287 ${path_DesktopGui}/PartWidget.h
288 ${path_DesktopGui}/PartWidgetFactory.h
289 ${path_DesktopGui}/PasswordDialog.h
290 ${path_DesktopGui}/ProgressPopUp.h
291 ${path_DesktopGui}/ProtocolLoggerWidget.h
292 ${path_DesktopGui}/ReplaceCharValidator.h
293 ${path_DesktopGui}/SettingsDialog.h
294 ${path_DesktopGui}/SimplePartWidget.h
295 ${path_DesktopGui}/Spinner.h
296 ${path_DesktopGui}/TagListWidget.h
297 ${path_DesktopGui}/TagWidget.h
298 ${path_DesktopGui}/TaskProgressIndicator.h
299 ${path_DesktopGui}/UserAgentWebPage.h
300 ${path_DesktopGui}/Util.h
301 ${path_DesktopGui}/Window.h
302 ${path_DesktopGui}/ShortcutHandler/ShortcutConfigDialog.h
303 ${path_DesktopGui}/ShortcutHandler/ShortcutConfigWidget.h
304 ${path_DesktopGui}/ShortcutHandler/ShortcutHandler.h
306 set(libDesktopGui_SOURCES
307 ${path_DesktopGui}/AttachmentView.cpp
308 ${path_DesktopGui}/AutoCompletion.cpp
309 ${path_DesktopGui}/CompleteMessageWidget.cpp
310 ${path_DesktopGui}/ComposeWidget.cpp
311 ${path_DesktopGui}/ComposerAttachmentsList.cpp
312 ${path_DesktopGui}/ComposerTextEdit.cpp
313 ${path_DesktopGui}/EmbeddedWebView.cpp
314 ${path_DesktopGui}/EnvelopeView.cpp
315 ${path_DesktopGui}/ExternalElementsWidget.cpp
316 ${path_DesktopGui}/FindBar.cpp
317 ${path_DesktopGui}/FlowLayout.cpp
318 ${path_DesktopGui}/FromAddressProxyModel.cpp
319 ${path_DesktopGui}/LineEdit.cpp
320 ${path_DesktopGui}/LoadablePartWidget.cpp
321 ${path_DesktopGui}/MailBoxTreeView.cpp
322 ${path_DesktopGui}/MessageListWidget.cpp
323 ${path_DesktopGui}/MessageSourceWidget.cpp
324 ${path_DesktopGui}/MessageView.cpp
325 ${path_DesktopGui}/MsgListView.cpp
326 ${path_DesktopGui}/OnePanelAtTimeWidget.cpp
327 ${path_DesktopGui}/OverlayWidget.cpp
328 ${path_DesktopGui}/PartWidget.cpp
329 ${path_DesktopGui}/PartWidgetFactory.cpp
330 ${path_DesktopGui}/PasswordDialog.cpp
331 ${path_DesktopGui}/ProgressPopUp.cpp
332 ${path_DesktopGui}/ProtocolLoggerWidget.cpp
333 ${path_DesktopGui}/ReplaceCharValidator.cpp
334 ${path_DesktopGui}/SettingsDialog.cpp
335 ${path_DesktopGui}/SimplePartWidget.cpp
336 ${path_DesktopGui}/Spinner.cpp
337 ${path_DesktopGui}/TagListWidget.cpp
338 ${path_DesktopGui}/TagWidget.cpp
339 ${path_DesktopGui}/TaskProgressIndicator.cpp
340 ${path_DesktopGui}/UserAgentWebPage.cpp
341 ${path_DesktopGui}/Util.cpp
342 ${path_DesktopGui}/Window.cpp
343 ${path_DesktopGui}/ShortcutHandler/ShortcutConfigDialog.cpp
344 ${path_DesktopGui}/ShortcutHandler/ShortcutConfigWidget.cpp
345 ${path_DesktopGui}/ShortcutHandler/ShortcutHandler.cpp
348 ${path_DesktopGui}/CreateMailboxDialog.ui
349 ${path_DesktopGui}/SettingsOutgoingPage.ui
350 ${path_DesktopGui}/SettingsGeneralPage.ui
351 ${path_DesktopGui}/ComposeWidget.ui
352 ${path_DesktopGui}/ProgressPopUpOld.ui
353 ${path_DesktopGui}/ShortcutHandler/ShortcutConfigWidget.ui
354 ${path_DesktopGui}/SettingsImapPage.ui
355 ${path_DesktopGui}/PasswordDialog.ui
356 ${path_DesktopGui}/SettingsCachePage.ui
357 ${path_DesktopGui}/EditIdentity.ui
358 ${path_DesktopGui}/ProgressPopUp.ui
360 set(libDesktopGui_RESOURCES
361 ${CMAKE_CURRENT_SOURCE_DIR}/src/icons.qrc
364 set(libqwwsmtpclient_HEADERS ${CMAKE_CURRENT_SOURCE_DIR}/src/qwwsmtpclient/qwwsmtpclient.h)
365 set(libqwwsmtpclient_SOURCES ${CMAKE_CURRENT_SOURCE_DIR}/src/qwwsmtpclient/qwwsmtpclient.cpp)
367 set(libAppVersion_HEADERS ${CMAKE_CURRENT_SOURCE_DIR}/src/AppVersion/SetCoreApplication.h)
368 set(libAppVersion_SOURCES ${CMAKE_CURRENT_SOURCE_DIR}/src/AppVersion/SetCoreApplication.cpp)
370 set(path_Imap ${CMAKE_CURRENT_SOURCE_DIR}/src/Imap)
372 ${path_Imap}/ConnectionState.h
373 ${path_Imap}/Exceptions.h
374 ${path_Imap}/Encoders.h
375 ${path_Imap}/Parser/3rdparty/kcodecs.h
376 ${path_Imap}/Parser/3rdparty/rfccodecs.h
378 ${path_Imap}/Parser/Command.h
379 ${path_Imap}/Parser/Data.h
380 ${path_Imap}/Parser/LowLevelParser.h
381 ${path_Imap}/Parser/MailAddress.h
382 ${path_Imap}/Parser/Message.h
383 ${path_Imap}/Parser/Parser.h
384 ${path_Imap}/Parser/Response.h
385 ${path_Imap}/Parser/Rfc5322HeaderParser.h
386 ${path_Imap}/Parser/Sequence.h
387 ${path_Imap}/Parser/ThreadingNode.h
389 ${path_Imap}/Network/FileDownloadManager.h
390 ${path_Imap}/Network/ForbiddenReply.h
391 ${path_Imap}/Network/MsgPartNetAccessManager.h
392 ${path_Imap}/Network/MsgPartNetworkReply.h
394 ${path_Imap}/Model/Cache.h
395 ${path_Imap}/Model/CatenateData.h
396 ${path_Imap}/Model/CombinedCache.h
397 ${path_Imap}/Model/CopyMoveOperation.h
398 ${path_Imap}/Model/DelayedPopulation.h
399 ${path_Imap}/Model/DiskPartCache.h
400 ${path_Imap}/Model/FindInterestingPart.h
401 ${path_Imap}/Model/FlagsOperation.h
402 ${path_Imap}/Model/FullMessageCombiner.h
403 ${path_Imap}/Model/ItemRoles.h
404 ${path_Imap}/Model/MailboxMetadata.h
405 ${path_Imap}/Model/MailboxModel.h
406 ${path_Imap}/Model/MailboxTree.h
407 ${path_Imap}/Model/MemoryCache.h
408 ${path_Imap}/Model/Model.h
409 ${path_Imap}/Model/ModelTest/modeltest.h
410 ${path_Imap}/Model/ModelWatcher.h
411 ${path_Imap}/Model/MsgListModel.h
412 ${path_Imap}/Model/OneMessageModel.h
413 ${path_Imap}/Model/ParserState.h
414 ${path_Imap}/Model/PrettyMailboxModel.h
415 ${path_Imap}/Model/PrettyMsgListModel.h
416 ${path_Imap}/Model/QAIM_reset.h
417 ${path_Imap}/Model/SQLCache.h
418 ${path_Imap}/Model/SubscribeUnSubscribeOperation.h
419 ${path_Imap}/Model/SubtreeModel.h
420 ${path_Imap}/Model/TaskFactory.h
421 ${path_Imap}/Model/TaskPresentationModel.h
422 ${path_Imap}/Model/ThreadingMsgListModel.h
423 ${path_Imap}/Model/UidSubmitData.h
424 ${path_Imap}/Model/Utils.h
425 ${path_Imap}/Model/VisibleTasksModel.h
427 ${path_Imap}/Model/kdeui-itemviews/kbihash_p.h
428 # this file is left out intentionally; otherwise cmake's automoc won't work with it
429 #${path_Imap}/Model/kdeui-itemviews/kdescendantsproxymodel.h
431 ${path_Imap}/Tasks/AppendTask.h
432 ${path_Imap}/Tasks/CopyMoveMessagesTask.h
433 ${path_Imap}/Tasks/CreateMailboxTask.h
434 ${path_Imap}/Tasks/DeleteMailboxTask.h
435 ${path_Imap}/Tasks/EnableTask.h
436 ${path_Imap}/Tasks/ExpungeMailboxTask.h
437 ${path_Imap}/Tasks/ExpungeMessagesTask.h
438 ${path_Imap}/Tasks/Fake_ListChildMailboxesTask.h
439 ${path_Imap}/Tasks/Fake_OpenConnectionTask.h
440 ${path_Imap}/Tasks/FetchMsgMetadataTask.h
441 ${path_Imap}/Tasks/FetchMsgPartTask.h
442 ${path_Imap}/Tasks/GenUrlAuthTask.h
443 ${path_Imap}/Tasks/GetAnyConnectionTask.h
444 ${path_Imap}/Tasks/IdTask.h
445 ${path_Imap}/Tasks/IdleLauncher.h
446 ${path_Imap}/Tasks/ImapTask.h
447 ${path_Imap}/Tasks/KeepMailboxOpenTask.h
448 ${path_Imap}/Tasks/ListChildMailboxesTask.h
449 ${path_Imap}/Tasks/NoopTask.h
450 ${path_Imap}/Tasks/NumberOfMessagesTask.h
451 ${path_Imap}/Tasks/ObtainSynchronizedMailboxTask.h
452 ${path_Imap}/Tasks/OfflineConnectionTask.h
453 ${path_Imap}/Tasks/OpenConnectionTask.h
454 ${path_Imap}/Tasks/SortTask.h
455 ${path_Imap}/Tasks/SubscribeUnsubscribeTask.h
456 ${path_Imap}/Tasks/ThreadTask.h
457 ${path_Imap}/Tasks/UidSubmitTask.h
458 ${path_Imap}/Tasks/UnSelectTask.h
459 ${path_Imap}/Tasks/UpdateFlagsTask.h
460 ${path_Imap}/Tasks/UpdateFlagsOfAllMessagesTask.h
463 ${path_Imap}/ConnectionState.cpp
464 ${path_Imap}/Encoders.cpp
465 ${path_Imap}/Exceptions.cpp
466 ${path_Imap}/Parser/3rdparty/kcodecs.cpp
467 ${path_Imap}/Parser/3rdparty/rfccodecs.cpp
469 ${path_Imap}/Parser/Command.cpp
470 ${path_Imap}/Parser/Data.cpp
471 ${path_Imap}/Parser/LowLevelParser.cpp
472 ${path_Imap}/Parser/MailAddress.cpp
473 ${path_Imap}/Parser/Message.cpp
474 ${path_Imap}/Parser/Parser.cpp
475 ${path_Imap}/Parser/Response.cpp
476 ${path_Imap}/Parser/Sequence.cpp
477 ${path_Imap}/Parser/ThreadingNode.cpp
479 ${path_Imap}/Network/FileDownloadManager.cpp
480 ${path_Imap}/Network/ForbiddenReply.cpp
481 ${path_Imap}/Network/MsgPartNetAccessManager.cpp
482 ${path_Imap}/Network/MsgPartNetworkReply.cpp
484 ${path_Imap}/Model/Cache.cpp
485 ${path_Imap}/Model/CombinedCache.cpp
486 ${path_Imap}/Model/DelayedPopulation.cpp
487 ${path_Imap}/Model/DiskPartCache.cpp
488 ${path_Imap}/Model/FindInterestingPart.cpp
489 ${path_Imap}/Model/FlagsOperation.cpp
490 ${path_Imap}/Model/FullMessageCombiner.cpp
491 ${path_Imap}/Model/MailboxMetadata.cpp
492 ${path_Imap}/Model/MailboxModel.cpp
493 ${path_Imap}/Model/MailboxTree.cpp
494 ${path_Imap}/Model/MemoryCache.cpp
495 ${path_Imap}/Model/Model.cpp
496 ${path_Imap}/Model/ModelWatcher.cpp
497 ${path_Imap}/Model/MsgListModel.cpp
498 ${path_Imap}/Model/OneMessageModel.cpp
499 ${path_Imap}/Model/ParserState.cpp
500 ${path_Imap}/Model/PrettyMailboxModel.cpp
501 ${path_Imap}/Model/PrettyMsgListModel.cpp
502 ${path_Imap}/Model/SQLCache.cpp
503 ${path_Imap}/Model/SubtreeModel.cpp
504 ${path_Imap}/Model/TaskFactory.cpp
505 ${path_Imap}/Model/TaskPresentationModel.cpp
506 ${path_Imap}/Model/ThreadingMsgListModel.cpp
507 ${path_Imap}/Model/Utils.cpp
508 ${path_Imap}/Model/VisibleTasksModel.cpp
510 ${path_Imap}/Model/ModelTest/modeltest.cpp
511 ${path_Imap}/Model/kdeui-itemviews/kdescendantsproxymodel.cpp
513 ${path_Imap}/Tasks/AppendTask.cpp
514 ${path_Imap}/Tasks/CopyMoveMessagesTask.cpp
515 ${path_Imap}/Tasks/CreateMailboxTask.cpp
516 ${path_Imap}/Tasks/DeleteMailboxTask.cpp
517 ${path_Imap}/Tasks/EnableTask.cpp
518 ${path_Imap}/Tasks/ExpungeMailboxTask.cpp
519 ${path_Imap}/Tasks/ExpungeMessagesTask.cpp
520 ${path_Imap}/Tasks/Fake_ListChildMailboxesTask.cpp
521 ${path_Imap}/Tasks/Fake_OpenConnectionTask.cpp
522 ${path_Imap}/Tasks/FetchMsgMetadataTask.cpp
523 ${path_Imap}/Tasks/FetchMsgPartTask.cpp
524 ${path_Imap}/Tasks/GenUrlAuthTask.cpp
525 ${path_Imap}/Tasks/GetAnyConnectionTask.cpp
526 ${path_Imap}/Tasks/IdTask.cpp
527 ${path_Imap}/Tasks/IdleLauncher.cpp
528 ${path_Imap}/Tasks/ImapTask.cpp
529 ${path_Imap}/Tasks/KeepMailboxOpenTask.cpp
530 ${path_Imap}/Tasks/ListChildMailboxesTask.cpp
531 ${path_Imap}/Tasks/NoopTask.cpp
532 ${path_Imap}/Tasks/NumberOfMessagesTask.cpp
533 ${path_Imap}/Tasks/ObtainSynchronizedMailboxTask.cpp
534 ${path_Imap}/Tasks/OfflineConnectionTask.cpp
535 ${path_Imap}/Tasks/OpenConnectionTask.cpp
536 ${path_Imap}/Tasks/SortTask.cpp
537 ${path_Imap}/Tasks/SubscribeUnsubscribeTask.cpp
538 ${path_Imap}/Tasks/ThreadTask.cpp
539 ${path_Imap}/Tasks/UidSubmitTask.cpp
540 ${path_Imap}/Tasks/UnSelectTask.cpp
541 ${path_Imap}/Tasks/UpdateFlagsTask.cpp
542 ${path_Imap}/Tasks/UpdateFlagsOfAllMessagesTask.cpp
545 if(WITH_RAGEL AND RAGEL_FOUND)
546 message(STATUS "Using Ragel for the RFC 5322 parser")
547 ragel_parser(${path_Imap}/Parser/Rfc5322HeaderParser.cpp)
548 set(libImap_SOURCES ${libImap_SOURCES}
549 ${CMAKE_CURRENT_BINARY_DIR}/Rfc5322HeaderParser.generated.cpp)
551 message(STATUS "Using pregenerated RFC 5322 parser")
552 set(libImap_SOURCES ${libImap_SOURCES}
553 ${path_Imap}/Parser/Rfc5322HeaderParser.generated.cpp)
556 set(path_AbookAddressbook ${CMAKE_CURRENT_SOURCE_DIR}/src/AbookAddressbook)
557 set(libAbookAddressbook_HEADERS
558 ${path_AbookAddressbook}/AbookAddressbook.h
559 ${path_AbookAddressbook}/be-contacts.h
561 set(libAbookAddressbook_SOURCES
562 ${path_AbookAddressbook}/AbookAddressbook.cpp
563 ${path_AbookAddressbook}/be-contacts.cpp
565 set(libAbookAddressbook_UI
566 ${path_AbookAddressbook}/be-contacts.ui
567 ${path_AbookAddressbook}/onecontact.ui
570 set(trojita_desktop_SOURCES
571 ${path_DesktopGui}/main.cpp
574 set(be_contacts_SOURCES
575 ${CMAKE_CURRENT_SOURCE_DIR}/src/be.contacts/main.cpp
578 set(libQmlModelGlue_SOURCES
579 ${CMAKE_CURRENT_SOURCE_DIR}/src/QmlSupport/ModelGlue/ImapAccess.cpp
581 set(libQmlModelGlue_HEADERS
582 ${CMAKE_CURRENT_SOURCE_DIR}/src/QmlSupport/ModelGlue/ImapAccess.h
585 set(libQNAMWebView_SOURCES
586 ${CMAKE_CURRENT_SOURCE_DIR}/src/QmlSupport/QNAMWebView/plugin.cpp
587 ${CMAKE_CURRENT_SOURCE_DIR}/src/QmlSupport/QNAMWebView/qdeclarativewebview.cpp
589 set(libQNAMWebView_HEADERS
590 ${CMAKE_CURRENT_SOURCE_DIR}/src/QmlSupport/QNAMWebView/plugin.h
591 ${CMAKE_CURRENT_SOURCE_DIR}/src/QmlSupport/QNAMWebView/qdeclarativewebview_p.h
594 set(trojitaHarmattan_SOURCES
595 ${CMAKE_CURRENT_SOURCE_DIR}/src/Harmattan/main.cpp
596 ${CMAKE_CURRENT_SOURCE_DIR}/src/Harmattan/qmlapplicationviewer/qmlapplicationviewer.cpp
600 file(GLOB_RECURSE lang_PO "${CMAKE_CURRENT_SOURCE_DIR}/po/trojita_common_*.po")
602 qt5_wrap_po(trojita_QM ${lang_PO})
604 qt4_wrap_po(trojita_QM ${lang_PO})
606 set(language_summary "")
607 foreach(po ${lang_PO})
608 string(REGEX REPLACE "^(.*)/trojita_common_(.*).po" "\\2" lang ${po})
609 list(APPEND language_summary ${lang})
611 list(SORT language_summary)
612 list(LENGTH language_summary num_languages)
614 message(STATUS "Available languages: ${language_summary}")
615 if(BUILD_DESKTOP_GUI)
616 install(DIRECTORY ${CMAKE_CURRENT_BINARY_DIR}/locale/ DESTINATION share/trojita/locale FILES_MATCHING PATTERN *.qm)
619 message(STATUS "No .po files found, will not install any languages")
622 message(STATUS "Qt Linguist (lupdate/lrelease/lconvert) not found, disabling localization support")
625 set(version_files ${CMAKE_CURRENT_BINARY_DIR}/trojita-version.h ${CMAKE_CURRENT_BINARY_DIR}/trojita-git-version.h)
626 if(WIN32 AND WITH_NSIS AND MAKENSIS)
627 set(version_files ${version_files} ${CMAKE_CURRENT_BINARY_DIR}/trojita-version.nsi)
631 add_custom_target(version DEPENDS version_fake_file)
632 add_custom_command(OUTPUT version_fake_file ${version_files}
633 COMMAND ${CMAKE_COMMAND} -DGIT_EXECUTABLE=${GIT_EXECUTABLE} -DNSIS=${NSIS} -DSOURCE_DIR=${CMAKE_CURRENT_SOURCE_DIR} -P ${CMAKE_CURRENT_SOURCE_DIR}/cmake/TrojitaVersion.cmake)
634 set_source_files_properties(${version_files}
635 PROPERTIES GENERATED TRUE
636 HEADER_FILE_ONLY TRUE)
638 add_library(AppVersion ${libAppVersion_SOURCES})
639 add_dependencies(AppVersion version version_fake_file)
641 add_library(Common ${libCommon_SOURCES})
642 target_link_libraries(Common ${QT_QTGUI_LIBRARY} ${QT_QTCORE_LIBRARY})
644 add_library(Streams ${libStreams_SOURCES})
645 target_link_libraries(Streams ${QT_QTNETWORK_LIBRARY} ${QT_QTCORE_LIBRARY})
647 target_link_libraries(Streams ${ZLIB_LIBRARIES})
650 add_library(qwwsmtpclient ${libqwwsmtpclient_SOURCES})
651 target_link_libraries(qwwsmtpclient ${QT_QTNETWORK_LIBRARY} ${QT_QTCORE_LIBRARY})
653 add_library(MSA ${libMSA_SOURCES})
654 target_link_libraries(MSA Streams qwwsmtpclient ${QT_QTNETWORK_LIBRARY} ${QT_QTCORE_LIBRARY})
656 add_library(Composer ${libComposer_SOURCES})
657 target_link_libraries(Composer Common MSA Streams qwwsmtpclient ${QT_QTGUI_LIBRARY} ${QT_QTCORE_LIBRARY})
659 target_link_libraries(Composer MimetypesQt4)
662 add_library(Imap ${libImap_SOURCES})
663 target_link_libraries(Imap Common Streams ${QT_QTNETWORK_LIBRARY} ${QT_QTSQL_LIBRARY} ${QT_QTGUI_LIBRARY} ${QT_QTCORE_LIBRARY})
665 target_link_libraries(Imap ${ZLIB_LIBRARIES})
669 add_library(MimetypesQt4 ${libMimetypesQt4_SOURCES})
670 if(SUPPORTS_TARGET_INCLUDES)
671 set_property(TARGET MimetypesQt4 APPEND PROPERTY INCLUDE_DIRECTORIES
672 ${QT_MKSPECS_DIR}/default ${path_mimetypesqt4}/io/)
676 if(BUILD_DESKTOP_GUI)
678 qt5_wrap_ui(libAbookAddressbook_UI_OUT ${libAbookAddressbook_UI})
679 qt5_wrap_ui(libDesktopGui_UI_OUT ${libDesktopGui_UI})
680 qt5_add_resources(libDesktopGui_RESOURCES_OUT ${libDesktopGui_RESOURCES})
682 qt4_wrap_ui(libAbookAddressbook_UI_OUT ${libAbookAddressbook_UI})
683 qt4_wrap_ui(libDesktopGui_UI_OUT ${libDesktopGui_UI})
684 qt4_add_resources(libDesktopGui_RESOURCES_OUT ${libDesktopGui_RESOURCES})
687 add_library(AbookAddressbook ${libAbookAddressbook_SOURCES} ${libAbookAddressbook_UI_OUT})
688 target_link_libraries(AbookAddressbook ${QT_QTGUI_LIBRARY} ${QT_QTCORE_LIBRARY})
690 add_library(DesktopGui ${libDesktopGui_SOURCES} ${libDesktopGui_UI_OUT} ${libDesktopGui_RESOURCES_OUT})
691 # The following is needed for the LineEdit widget within the .ui files.
692 # The ${path_DesktopGui} is needed so that the generated ui_*.h file can find the headers of the custom widgets
693 if(SUPPORTS_TARGET_INCLUDES)
694 set_property(TARGET DesktopGui APPEND PROPERTY INCLUDE_DIRECTORIES ${path_DesktopGui})
696 target_link_libraries(DesktopGui Common Composer Imap MSA Streams qwwsmtpclient AbookAddressbook)
698 if(WIN32) # Check if we are on Windows
699 # build a real Win32 GUI application. Hide the console window
700 add_executable(trojita WIN32 ${trojita_desktop_SOURCES} ${trojita_QM} ${CMAKE_CURRENT_SOURCE_DIR}/src/trojita_ico_win32.rc)
701 target_link_libraries(trojita ${QT_QTMAIN_LIBRARY} ${QT_LIBRARIES})
703 add_executable(trojita ${trojita_desktop_SOURCES} ${trojita_QM})
706 target_link_libraries(trojita AppVersion Imap MSA Streams qwwsmtpclient Common Composer AbookAddressbook DesktopGui
707 ${QT_QTSQL_LIBRARY} ${QT_QTNETWORK_LIBRARY} ${QT_QTWEBKIT_LIBRARY})
709 target_link_libraries(trojita MimetypesQt4 ${QT_QTGUI_LIBRARY} ${QT_QTNETWORK_LIBRARY} ${QT_QTCORE_LIBRARY})
712 target_link_libraries(trojita ${ZLIB_LIBRARIES})
715 add_executable(be.contacts ${be_contacts_SOURCES})
716 target_link_libraries(be.contacts AbookAddressbook ${QT_QTGUI_LIBRARY} ${QT_QTCORE_LIBRARY})
717 elseif(BUILD_HARMATTAN)
718 add_library(QmlModelGlue ${libQmlModelGlue_SOURCES})
719 add_library(trojitaqnamwebviewplugin SHARED ${libQNAMWebView_SOURCES})
720 add_executable(trojita-tp ${trojitaHarmattan_SOURCES})
721 if(SUPPORTS_TARGET_INCLUDES)
722 set_property(TARGET trojita-tp APPEND PROPERTY INCLUDE_DIRECTORIES
723 ${QT_MKSPECS_DIR}/default ${CMAKE_CURRENT_SOURCE_DIR}/src/Harmattan/qmlapplicationviewer)
725 target_link_libraries(trojita-tp QmlModelGlue AppVersion Imap MSA Streams qwwsmtpclient Common Composer MimetypesQt4
726 ${QT_QTSQL_LIBRARY} ${QT_QTNETWORK_LIBRARY} ${QT_QTWEBKIT_LIBRARY} ${QT_QTDECLARATIVE_LIBRARY})
730 qt5_use_modules(AppVersion Core)
731 qt5_use_modules(Common Core)
732 qt5_use_modules(Streams Network)
733 qt5_use_modules(qwwsmtpclient Network)
734 qt5_use_modules(MSA Network)
735 qt5_use_modules(Composer Gui Network)
736 qt5_use_modules(Imap Gui Network Sql)
737 qt5_use_modules(DesktopGui Network WebKitWidgets)
738 qt5_use_modules(AbookAddressbook Widgets)
739 qt5_use_modules(be.contacts Widgets)
740 qt5_use_modules(trojita Widgets)
743 if(BUILD_DESKTOP_GUI)
744 install(TARGETS trojita be.contacts RUNTIME DESTINATION bin)
745 install(FILES ${CMAKE_CURRENT_SOURCE_DIR}/src/Gui/trojita.desktop DESTINATION share/applications/)
746 install(FILES ${CMAKE_CURRENT_SOURCE_DIR}/src/icons/trojita.png DESTINATION share/icons/hicolor/32x32/apps/)
747 install(FILES ${CMAKE_CURRENT_SOURCE_DIR}/src/icons/trojita.svg DESTINATION share/icons/hicolor/scalable/apps/)
748 elseif(BUILD_HARMATTAN)
749 set(trojita_harmattan_path ${CMAKE_CURRENT_SOURCE_DIR}/src/Harmattan)
750 install(TARGETS trojita-tp RUNTIME DESTINATION opt/trojita-tp/bin)
751 install(TARGETS trojitaqnamwebviewplugin LIBRARY DESTINATION opt/trojita-tp/bin/net/flaska/QNAMWebView)
752 install(FILES ${CMAKE_CURRENT_SOURCE_DIR}/src/QmlSupport/QNAMWebView/qmldir DESTINATION opt/trojita-tp/bin/net/flaska/QNAMWebView)
753 install(DIRECTORY ${trojita_harmattan_path}/qml DESTINATION opt/trojita-tp/)
754 install(FILES ${trojita_harmattan_path}/trojita-tp.desktop DESTINATION usr/share/applications/)
755 install(FILES ${trojita_harmattan_path}/trojita-tp80.png DESTINATION usr/share/icons/hicolor/80x80/apps/)
758 if(WIN32 AND WITH_NSIS AND MAKENSIS)
759 if(CMAKE_SIZEOF_VOID_P STREQUAL 4)
760 set(MAKENSIS_OUTPUT Trojita-installer.exe)
762 set(MAKENSIS_FLAGS -DX86_64 ${MAKENSIS_FLAGS})
763 set(MAKENSIS_OUTPUT Trojita-installer-x86_64.exe)
766 if(NOT CMAKE_VERBOSE_MAKEFILE)
767 set(MAKENSIS_FLAGS -V2 -DQUIET ${MAKENSIS_FLAGS})
770 set(MAKENSIS_FLAGS ${MAKENSIS_FLAGS} -NOCD)
772 add_custom_command(OUTPUT ${MAKENSIS_OUTPUT}
774 ARGS ${MAKENSIS_FLAGS} ${CMAKE_CURRENT_SOURCE_DIR}/packaging/trojita.nsi
775 DEPENDS ${CMAKE_CURRENT_SOURCE_DIR}/packaging/trojita.nsi ${CMAKE_CURRENT_BINARY_DIR}/trojita.exe)
776 add_custom_target(installer ALL DEPENDS ${MAKENSIS_OUTPUT})
780 if(NOT WITHOUT_TESTS)
781 set(test_LibMailboxSync_SOURCES
782 tests/test_LibMailboxSync/ModelEvents.cpp
783 tests/test_LibMailboxSync/test_LibMailboxSync.cpp
785 add_library(test_LibMailboxSync ${test_LibMailboxSync_SOURCES})
787 qt5_use_modules(test_LibMailboxSync Test Network)
789 if(SUPPORTS_TARGET_INCLUDES)
790 set_property(TARGET test_LibMailboxSync APPEND PROPERTY INCLUDE_DIRECTORIES
791 ${CMAKE_CURRENT_SOURCE_DIR}/tests
792 ${CMAKE_CURRENT_SOURCE_DIR}/tests/test_LibMailboxSync)
794 target_link_libraries(test_LibMailboxSync Imap MSA Streams Common Composer)
796 macro(trojita_test fname)
797 set(test_${fname}_SOURCES tests/tests/test_${fname}/test_${fname}.cpp)
798 set(test_${fname}_HEADERS tests/tests/test_${fname}/test_${fname}.h)
799 add_executable(test_${fname} ${test_${fname}_SOURCES})
800 target_link_libraries(test_${fname} Imap MSA Streams Common Composer test_LibMailboxSync)
802 qt5_use_modules(test_${fname} Network Sql Test Widgets)
804 target_link_libraries(test_${fname} ${QT_QTSQL_LIBRARY} ${QT_QTTEST_LIBRARY} ${QT_QTGUI_LIBRARY} ${QT_QTCORE_LIBRARY} ${QT_QTNETWORK_LIBRARY})
807 target_link_libraries(test_${fname} ${ZLIB_LIBRARIES})
809 add_test(test_${fname} test_${fname})
810 if(SUPPORTS_TARGET_INCLUDES)
811 set_property(TARGET test_${fname} APPEND PROPERTY INCLUDE_DIRECTORIES ${CMAKE_CURRENT_SOURCE_DIR}/tests)
816 trojita_test(Composer_Submission)
817 trojita_test(Composer_responses)
818 trojita_test(Html_formatting)
820 qt5_use_modules(test_Composer_responses WebKitWidgets)
821 qt5_use_modules(test_Html_formatting WebKitWidgets)
823 target_link_libraries(test_Html_formatting ${QT_QTWEBKIT_LIBRARY})
825 trojita_test(Imap_DisappearingMailboxes)
826 trojita_test(Imap_Idle)
827 trojita_test(Imap_LowLevelParser)
828 trojita_test(Imap_Message)
829 trojita_test(Imap_Model)
830 trojita_test(Imap_Parser_parse)
831 trojita_test(Imap_Responses)
832 trojita_test(Imap_SelectedMailboxUpdates)
833 trojita_test(Imap_Tasks_CreateMailbox)
834 trojita_test(Imap_Tasks_DeleteMailbox)
835 trojita_test(Imap_Tasks_ListChildMailboxes)
836 trojita_test(Imap_Tasks_ObtainSynchronizedMailbox)
837 trojita_test(Imap_Tasks_OpenConnection)
838 trojita_test(Imap_Threading)
839 trojita_test(Rfc5322)
840 trojita_test(RingBuffer)
841 trojita_test(SenderIdentitiesModel)
842 trojita_test(SqlCache)
843 trojita_test(algorithms)
844 trojita_test(rfccodecs)
847 if(WIN32) # Check if we are on Windows
848 if(MSVC10) # Check if we are using the Visual Studio compiler 2010
849 # Because of linker errors (see http://stackoverflow.com/questions/5625884/conversion-of-stdwstring-to-qstring-throws-linker-error)
850 set(CMAKE_CXX_FLAGS "${CMAKE_CXX_FLAGS} /Zc:wchar_t-")
852 message(WARNING "You are using a compiler which we have not tested yet (not MSVC10).")
853 message(WARNING "Please let us know how well it works.")
857 # FIXME: fix build warnings