Warning, /network/tokodon/src/CMakeLists.txt is written in an unsupported language. File is not indexed.

0001 # SPDX-FileCopyrightText: 2021 Carl Schwan <carlschwan@kde.org>
0002 # SPDX-License-Identifier: BSD-2-Clause
0003 
0004 qt_add_qml_module(tokodon_static
0005         STATIC
0006         URI org.kde.tokodon
0007         VERSION 1.0)
0008 
0009 ecm_qt_declare_logging_category(tokodon_static
0010     HEADER tokodon_debug.h
0011     IDENTIFIER TOKODON_LOG
0012     CATEGORY_NAME org.kde.tokodon
0013     DESCRIPTION "tokodon"
0014     DEFAULT_SEVERITY Warning
0015     EXPORT TOKODON
0016 )
0017 
0018 ecm_qt_declare_logging_category(tokodon_static
0019     HEADER tokodon_http_debug.h
0020     IDENTIFIER TOKODON_HTTP
0021     CATEGORY_NAME org.kde.tokodon.http
0022     DESCRIPTION "Tokodon request"
0023     EXPORT TOKODON
0024 )
0025 
0026 target_sources(tokodon_static
0027     PRIVATE
0028     # Account
0029     account/abstractaccount.cpp
0030     account/abstractaccount.h
0031     account/accountmanager.cpp
0032     account/accountmanager.h
0033     account/announcementmodel.cpp
0034     account/announcementmodel.h
0035     account/featuredtagsmodel.cpp
0036     account/featuredtagsmodel.h
0037     account/account.cpp
0038     account/account.h
0039     account/preferences.cpp
0040     account/preferences.h
0041     account/identity.cpp
0042     account/identity.h
0043     account/listsmodel.cpp
0044     account/listsmodel.h
0045     account/socialgraphmodel.cpp
0046     account/socialgraphmodel.h
0047     account/relationship.cpp
0048     account/rulesmodel.cpp
0049     account/rulesmodel.h
0050     account/profileeditor.cpp
0051     account/notificationhandler.cpp
0052     account/notificationhandler.h
0053 
0054     # Editor
0055     editor/posteditorbackend.cpp
0056     editor/posteditorbackend.h
0057     editor/attachmenteditormodel.cpp
0058     editor/attachmenteditormodel.h
0059     editor/polltimemodel.cpp
0060     editor/polltimemodel.h
0061     editor/languagemodel.cpp
0062     editor/languagemodel.h
0063     editor/listeditorbackend.cpp
0064     editor/listeditorbackend.h
0065     editor/polleditorbackend.cpp
0066     editor/polleditorbackend.h
0067     editor/reporteditorbackend.cpp
0068     editor/reporteditorbackend.h
0069 
0070     # Conversation view
0071     conversation/conversationmodel.cpp
0072     conversation/conversationmodel.h
0073 
0074     # Timeline
0075     timeline/post.cpp
0076     timeline/post.h
0077     timeline/poll.cpp
0078     timeline/poll.h
0079     timeline/tag.h
0080     timeline/tag.cpp
0081     timeline/accountmodel.cpp
0082     timeline/accountmodel.h
0083     timeline/threadmodel.cpp
0084     timeline/threadmodel.h
0085     timeline/timelinemodel.cpp
0086     timeline/timelinemodel.h
0087     timeline/tagstimelinemodel.cpp
0088     timeline/tagstimelinemodel.h
0089     timeline/maintimelinemodel.cpp
0090     timeline/maintimelinemodel.h
0091     timeline/abstracttimelinemodel.cpp
0092     timeline/abstracttimelinemodel.h
0093     timeline/tagsmodel.h
0094     timeline/tagsmodel.cpp
0095     timeline/abstractlistmodel.cpp
0096     timeline/abstractlistmodel.h
0097 
0098     # Search
0099     search/searchmodel.cpp
0100     search/searchmodel.h
0101 
0102     # Misc utils
0103     utils/blurhash.cpp
0104     utils/blurhash.hpp
0105     utils/blurhashimageprovider.cpp
0106     utils/blurhashimageprovider.h
0107     utils/filehelper.cpp
0108     utils/filehelper.h
0109     utils/filetransferjob.cpp
0110     utils/filetransferjob.h
0111     utils/initialsetupflow.cpp
0112     utils/initialsetupflow.h
0113     utils/clipboard.cpp
0114     utils/clipboard.h
0115     utils/navigation.cpp
0116     utils/navigation.h
0117     utils/emojimodel.cpp
0118     utils/emojimodel.h
0119     utils/emojis.h
0120     utils/emojitones.cpp
0121     utils/emojitones.h
0122     utils/emojitones_data.h
0123     utils/messagefiltercontainer.cpp
0124     utils/messagefiltercontainer.h
0125     utils/mpvplayer.cpp
0126     utils/mpvplayer.h
0127     utils/textpreprocessing.cpp
0128     utils/textpreprocessing.h
0129     utils/utils.cpp
0130     utils/utils.h
0131     utils/colorschemer.cpp
0132     utils/colorschemer.h
0133     utils/customemoji.cpp
0134     utils/customemoji.h
0135     utils/windowcontroller.cpp
0136     utils/windowcontroller.h
0137 
0138     # Network related classes
0139     network/networkrequestprogress.cpp
0140     network/networkrequestprogress.h
0141     network/networkaccessmanagerfactory.cpp
0142     network/networkaccessmanagerfactory.h
0143     network/networkcontroller.cpp
0144     network/networkcontroller.h
0145 
0146     # Admin
0147     admin/accounttoolmodel.cpp
0148     admin/accounttoolmodel.h
0149     admin/adminaccountinfo.cpp
0150     admin/adminaccountinfo.h
0151     admin/federationtoolmodel.cpp
0152     admin/federationtoolmodel.h
0153     admin/federationinfo.h
0154     admin/federationinfo.cpp
0155     admin/ipinfo.cpp
0156     admin/ipinfo.h
0157     admin/iprulestoolmodel.cpp
0158     admin/iprulestoolmodel.h
0159     admin/emailblocktoolmodel.cpp
0160     admin/emailblocktoolmodel.h
0161     admin/emailinfo.cpp
0162     admin/emailinfo.h
0163     admin/reporttoolmodel.cpp
0164     admin/reporttoolmodel.h
0165     admin/reportinfo.h
0166     admin/reportinfo.cpp
0167 
0168     # Notification models
0169     notification/notificationgroupingmodel.cpp
0170     notification/notificationgroupingmodel.h
0171     notification/notificationmodel.cpp
0172     notification/notificationmodel.h
0173 )
0174 
0175 qt_target_qml_sources(tokodon_static
0176     QML_FILES
0177         # Components
0178         content/ui/Components/Emoji/EmojiDelegate.qml
0179         content/ui/Components/Emoji/EmojiGrid.qml
0180         content/ui/Components/Emoji/EmojiPicker.qml
0181         content/ui/Components/Emoji/EmojiTonesPicker.qml
0182         content/ui/Components/FocusedImage.qml
0183         content/ui/Components/PopupShadow.qml
0184         content/ui/Components/UserCard.qml
0185 
0186         # Initial Setup
0187         content/ui/InitialSetup/SetupNotifications.qml
0188         content/ui/InitialSetup/SetupPassword.qml
0189         content/ui/InitialSetup/SetupWelcome.qml
0190 
0191         # Login Flow
0192         content/ui/LoginFlow/AuthorizationPage.qml
0193         content/ui/LoginFlow/LoginIssuePage.qml
0194         content/ui/LoginFlow/LoginPage.qml
0195         content/ui/LoginFlow/RegistrationPage.qml
0196         content/ui/LoginFlow/RulesPage.qml
0197         content/ui/LoginFlow/ServersPage.qml
0198         content/ui/LoginFlow/WelcomePage.qml
0199 
0200         # Moderation Tools
0201         content/ui/ModerationTools/AccountToolPage.qml
0202         content/ui/ModerationTools/EmailBlockToolPage.qml
0203         content/ui/ModerationTools/FederationToolPage.qml
0204         content/ui/ModerationTools/IpRulePage.qml
0205         content/ui/ModerationTools/MainAccountToolPage.qml
0206         content/ui/ModerationTools/MainFederationToolPage.qml
0207         content/ui/ModerationTools/MainIpRulePage.qml
0208         content/ui/ModerationTools/MainReportToolPage.qml
0209         content/ui/ModerationTools/ModerationToolPage.qml
0210         content/ui/ModerationTools/ReportToolPage.qml
0211 
0212         # Notifications
0213         content/ui/Notifications/GroupInteractionLabel.qml
0214         content/ui/Notifications/UserInteractionLabel.qml
0215 
0216         # Settings
0217         content/ui/Settings/AboutKDEPage.qml
0218         content/ui/Settings/AboutPage.qml
0219         content/ui/Settings/AccountsPage.qml
0220         content/ui/Settings/AppearancePage.qml
0221         content/ui/Settings/NetworkProxyPage.qml
0222         content/ui/Settings/NotificationsPage.qml
0223         content/ui/Settings/ProfileEditor.qml
0224         content/ui/Settings/SettingsPage.qml
0225         content/ui/Settings/SonnetPage.qml
0226 
0227         # Composer
0228         content/ui/StatusComposer/EditorAttachmentGrid.qml
0229         content/ui/StatusComposer/AttachmentInfoDialog.qml
0230         content/ui/StatusComposer/ComposerPoll.qml
0231         content/ui/StatusComposer/EmojiDialog.qml
0232         content/ui/StatusComposer/StatusComposer.qml
0233         content/ui/StatusComposer/StatusPreview.qml
0234 
0235         # Delegate
0236         content/ui/StatusDelegate/AttachmentGrid.qml
0237         content/ui/StatusDelegate/ImageMenu.qml
0238         content/ui/StatusDelegate/InformationBar.qml
0239         content/ui/StatusDelegate/InlineIdentityInfo.qml
0240         content/ui/StatusDelegate/InteractionButton.qml
0241         content/ui/StatusDelegate/LinkPreview.qml
0242         content/ui/StatusDelegate/MediaContainer.qml
0243         content/ui/StatusDelegate/OverflowMenu.qml
0244         content/ui/StatusDelegate/PostContent.qml
0245         content/ui/StatusDelegate/PostInfoBar.qml
0246         content/ui/StatusDelegate/StandaloneTags.qml
0247         content/ui/StatusDelegate/StatusDelegate.qml
0248         content/ui/StatusDelegate/StatusPoll.qml
0249         content/ui/StatusDelegate/UserInteractionLabel.qml
0250         content/ui/StatusDelegate/VideoAttachment.qml
0251 
0252         # Other
0253         content/ui/AccountInfo.qml
0254         content/ui/AnnouncementsPage.qml
0255         content/ui/ConversationDelegate.qml
0256         content/ui/ConversationPage.qml
0257         content/ui/EditListPage.qml
0258         content/ui/ExplorePage.qml
0259         content/ui/FollowDelegate.qml
0260         content/ui/FullScreenImage.qml
0261         content/ui/LanguageSelector.qml
0262         content/ui/ListPage.qml
0263         content/ui/ListsPage.qml
0264         content/ui/Main.qml
0265         content/ui/MastoPage.qml
0266         content/ui/NotificationPage.qml
0267         content/ui/ReportDialog.qml
0268         content/ui/SearchField.qml
0269         content/ui/SearchPage.qml
0270         content/ui/SearchView.qml
0271         content/ui/ShareDialog.qml
0272         content/ui/SocialGraphPage.qml
0273         content/ui/StandaloneComposer.qml
0274         content/ui/ThreadPage.qml
0275         content/ui/TimelinePage.qml
0276         content/ui/UserInfo.qml
0277 )
0278 
0279 set_source_files_properties(../org.kde.tokodon.svg PROPERTIES
0280     QT_RESOURCE_ALIAS /org.kde.tokodon.svg
0281 )
0282 
0283 qt_target_qml_sources(tokodon_static
0284     PREFIX /
0285     RESOURCES
0286         content/elephant.svg
0287         ../org.kde.tokodon.svg
0288 )
0289 
0290 if (NOT ANDROID)
0291     install(DIRECTORY icons/ DESTINATION ${KDE_INSTALL_FULL_ICONDIR}/hicolor/scalable/actions)
0292 else()
0293     install(DIRECTORY icons/ DESTINATION ${KDE_INSTALL_QMLDIR}/org/kde/kirigami/breeze-internal/icons/)
0294 endif()
0295 
0296 target_include_directories(tokodon_static PUBLIC ${CMAKE_CURRENT_SOURCE_DIR}/search)
0297 target_include_directories(tokodon_static PUBLIC ${CMAKE_CURRENT_SOURCE_DIR}/timeline)
0298 target_include_directories(tokodon_static PUBLIC ${CMAKE_CURRENT_SOURCE_DIR}/account)
0299 target_include_directories(tokodon_static PUBLIC ${CMAKE_CURRENT_SOURCE_DIR}/utils)
0300 target_include_directories(tokodon_static PUBLIC ${CMAKE_CURRENT_SOURCE_DIR}/notification)
0301 target_include_directories(tokodon_static PUBLIC ${CMAKE_CURRENT_SOURCE_DIR}/network)
0302 target_include_directories(tokodon_static PUBLIC ${CMAKE_CURRENT_SOURCE_DIR}/admin)
0303 target_include_directories(tokodon_static PUBLIC ${CMAKE_CURRENT_SOURCE_DIR}/conversation)
0304 target_include_directories(tokodon_static PUBLIC ${CMAKE_CURRENT_SOURCE_DIR}/editor)
0305 
0306 if (BUILD_TESTING)
0307     qt_target_qml_sources(tokodon_static
0308             QML_FILES
0309             content/ui/Debug/DebugPage.qml
0310     )
0311 endif()
0312 
0313 if(ANDROID)
0314     target_sources(tokodon_static
0315         PRIVATE
0316         utils/androidutils.cpp
0317         utils/androidutils.h
0318     )
0319     qt_target_qml_sources(tokodon_static
0320         QML_FILES
0321         content/ui/Android/ShareAction.qml
0322         content/ui/Android/ShareMenu.qml
0323     )
0324     set_source_files_properties(content/ui/Android/ShareAction.qml PROPERTIES
0325         QT_RESOURCE_ALIAS content/ui/ShareAction.qml
0326     )
0327     set_source_files_properties(content/ui/Android/ShareMenu.qml PROPERTIES
0328         QT_RESOURCE_ALIAS content/ui/ShareMenu.qml
0329     )
0330 else()
0331     qt_target_qml_sources(tokodon_static
0332         QML_FILES
0333         content/ui/ShareAction.qml
0334         content/ui/ShareMenu.qml
0335     )
0336 endif()
0337 
0338 kconfig_add_kcfg_files(tokodon_static GENERATE_MOC config.kcfgc accountconfig.kcfgc)
0339 target_link_libraries(tokodon_static
0340     PUBLIC
0341         Qt::Quick
0342         Qt::Qml
0343         Qt::Gui
0344         Qt::Network
0345         Qt::WebSockets
0346         Qt::QuickControls2
0347         Qt::WebView
0348         KF6::I18n
0349         KF6::Kirigami
0350         KF6::KirigamiPlatform
0351         KF6::Notifications
0352         KF6::ConfigCore
0353         KF6::ConfigGui
0354         KF6::CoreAddons
0355         KF6::ColorScheme
0356         MpvQt::MpvQt
0357         ${QTKEYCHAIN_LIBRARIES}
0358 )
0359 target_compile_options(tokodon_static PRIVATE -fexceptions)
0360 
0361 if (TARGET KF6::KIOWidgets)
0362     target_compile_definitions(tokodon_static PUBLIC -DHAVE_KIO)
0363     target_link_libraries(tokodon_static PUBLIC KF6::KIOWidgets)
0364 endif()
0365 
0366 if (TARGET KUnifiedPush)
0367     target_sources(tokodon_static PRIVATE
0368             utils/ecdh.cpp
0369             utils/ecdh.h)
0370     target_compile_definitions(tokodon_static PUBLIC -DHAVE_KUNIFIEDPUSH)
0371     target_link_libraries(tokodon_static PUBLIC KUnifiedPush OpenSSL::Crypto)
0372 endif()
0373 
0374 if (SAILFISHOS)
0375     target_compile_definitions(tokodon_static PUBLIC -DSAILFISHOS)
0376 endif()
0377 
0378 if(TOKODON_FLATPAK)
0379     target_compile_definitions(tokodon_static PUBLIC TOKODON_FLATPAK)
0380 endif()
0381 
0382 if (BUILD_TESTING)
0383     add_subdirectory(autotests)
0384 endif()
0385 
0386 add_executable(tokodon
0387     main.cpp
0388 )
0389 
0390 target_include_directories(tokodon PRIVATE ${CMAKE_BINARY_DIR})
0391 target_link_libraries(tokodon PRIVATE tokodon_static tokodon_staticplugin)
0392 
0393 if(ANDROID)
0394     target_link_libraries(tokodon PRIVATE Qt::Svg OpenSSL::SSL)
0395     kirigami_package_breeze_icons(ICONS
0396             "help-about"
0397             "im-user"
0398             "im-invisible-user"
0399             "im-kick-user"
0400             "mail-attachment"
0401             "mail-attachment-symbolic"
0402             "dialog-cancel"
0403             "preferences-desktop-emoticons"
0404             "document-open"
0405             "document-save"
0406             "document-send"
0407             "dialog-close"
0408             "edit-delete-remove"
0409             "code-context"
0410             "document-edit"
0411             "list-user-add"
0412             "list-add-user"
0413             "user-others"
0414             "media-playback-pause"
0415             "media-playback-start"
0416             "go-up"
0417             "go-down"
0418             "list-add"
0419             "irc-join-channel"
0420             "settings-configure"
0421             "configure"
0422             "rating"
0423             "rating-unrated"
0424             "search"
0425             "mail-replied-symbolic"
0426             "edit-copy"
0427             "gtk-quit"
0428             "compass"
0429             "network-connect"
0430             "notifications"
0431             "kstars_xplanet"
0432             "kstars_planets"
0433             "system-users"
0434             "go-home-large"
0435             "view-hidden"
0436             "favorite"
0437             "cell_edit"
0438             "office-chart-bar"
0439             "im-ban-kick-user"
0440             "user-group-properties"
0441             "microphone-sensitivity-muted"
0442             "cards-block"
0443             "system-search"
0444             "bookmarks"
0445             "checkmark"
0446             "lock"
0447             "edit-clear"
0448             "approved"
0449             "delete"
0450             "user-identity"
0451             "download"
0452             "edit-reset"
0453             "dialog-ok"
0454             "gnumeric-graphguru"
0455             "mail-message"
0456             "bookmark-new"
0457             "window-unpin"
0458             "pin"
0459             "edit-entry"
0460             "edit-cut"
0461             "system-switch-user"
0462             "note"
0463             "view-list-text"
0464             "view-filter"
0465             "preferences-desktop-theme-global"
0466             "preferences-desktop-notification"
0467             "preferences-system-users"
0468             "kde"
0469             "cloud-upload"
0470             "expand"
0471             "view-web-browser-dom-tree"
0472             "window"
0473             "emblem-shared-symbolic"
0474             "data-warning"
0475             "arrow-up"
0476             "arrow-down"
0477             "zoom-out"
0478             "zoom-in"
0479             "object-rotate-left"
0480             "object-rotate-right"
0481             "add-subtitle"
0482             "unlock"
0483             "dialog-warning-symbolic"
0484             "list-remove-user"
0485             )
0486 else()
0487     target_link_libraries(tokodon PRIVATE Qt::Widgets)
0488 endif()
0489 
0490 if (TARGET KF6::DBusAddons)
0491     target_link_libraries(tokodon PRIVATE KF6::DBusAddons KF6::WindowSystem)
0492     target_compile_definitions(tokodon PRIVATE -DHAVE_KDBUSADDONS)
0493 endif ()
0494 
0495 if(ANDROID)
0496     target_sources(tokodon PRIVATE notifyrc.qrc)
0497 
0498     ecm_add_android_apk(tokodon ANDROID_DIR ${CMAKE_SOURCE_DIR}/android)
0499 else()
0500     install(FILES tokodon.notifyrc DESTINATION ${KDE_INSTALL_KNOTIFYRCDIR})
0501 
0502     if (TARGET KUnifiedPush)
0503         configure_file(org.kde.tokodon.service.in ${CMAKE_CURRENT_BINARY_DIR}/org.kde.tokodon.service)
0504         install(FILES ${CMAKE_CURRENT_BINARY_DIR}/org.kde.tokodon.service DESTINATION ${KDE_INSTALL_DBUSSERVICEDIR})
0505     endif()
0506 endif()
0507 
0508 install(TARGETS tokodon ${KF6_INSTALL_TARGETS_DEFAULT_ARGS})
0509 
0510 if(BUILD_TESTING)
0511     add_definitions(-DDATA_DIR="${CMAKE_CURRENT_SOURCE_DIR}/autotests/data" )
0512 
0513     add_executable(tokodon-offline
0514             main.cpp
0515             autotests/mockaccount.cpp)
0516     target_compile_definitions(tokodon-offline PUBLIC TEST_MODE=1)
0517     target_link_libraries(tokodon-offline PRIVATE tokodon_static tokodon_staticplugin)
0518     target_include_directories(tokodon-offline PRIVATE ${CMAKE_BINARY_DIR})
0519 
0520     if (TARGET KF6::DBusAddons)
0521         target_link_libraries(tokodon-offline PRIVATE KF6::DBusAddons KF6::WindowSystem)
0522         target_compile_definitions(tokodon-offline PRIVATE -DHAVE_KDBUSADDONS)
0523     endif ()
0524 
0525     install(TARGETS tokodon-offline ${KF6_INSTALL_TARGETS_DEFAULT_ARGS})
0526 endif()
0527 
0528 if (UNIX AND NOT APPLE AND NOT ANDROID AND NOT TOKODON_FLATPAK)
0529     add_subdirectory(purpose)
0530 endif ()