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

0001 # SPDX-FileCopyrightText: 2020-2021 Carl Schwan <carl@carlschwan.eu>
0002 # SPDX-FileCopyrightText: 2020-2021 Nicolas Fella <nicolas.fella@gmx.de>
0003 # SPDX-FileCopyrightText: 2020-2021 Tobias Fella <tobias.fella@kde.org>
0004 # SPDX-FileCopyrightText: 2021 Adriaan de Groot <groot@kde.org>
0005 # SPDX-License-Identifier: BSD-2-Clause
0006 
0007 cmake_minimum_required(VERSION 3.16)
0008 
0009 # KDE Applications version, managed by release script.
0010 set(RELEASE_SERVICE_VERSION_MAJOR "23")
0011 set(RELEASE_SERVICE_VERSION_MINOR "08")
0012 set(RELEASE_SERVICE_VERSION_MICRO "5")
0013 set(RELEASE_SERVICE_VERSION "${RELEASE_SERVICE_VERSION_MAJOR}.${RELEASE_SERVICE_VERSION_MINOR}.${RELEASE_SERVICE_VERSION_MICRO}")
0014 
0015 project(NeoChat VERSION ${RELEASE_SERVICE_VERSION})
0016 
0017 set(KF_MIN_VERSION "5.105.0")
0018 set(QT_MIN_VERSION "5.15.2")
0019 if (ANDROID)
0020     set(QT_MIN_VERSION "5.15.10")
0021 endif()
0022 
0023 find_package(ECM ${KF_MIN_VERSION} REQUIRED NO_MODULE)
0024 
0025 set(CMAKE_MODULE_PATH ${ECM_MODULE_PATH} ${CMAKE_SOURCE_DIR}/cmake)
0026 
0027 set(CMAKE_CXX_STANDARD 20)
0028 set(CMAKE_CXX_STANDARD_REQUIRED ON)
0029 
0030 set(KDE_COMPILERSETTINGS_LEVEL 5.84)
0031 
0032 include(FeatureSummary)
0033 include(ECMSetupVersion)
0034 include(KDEInstallDirs)
0035 include(ECMFindQmlModule)
0036 include(KDECMakeSettings)
0037 include(ECMAddTests)
0038 include(KDECompilerSettings NO_POLICY_SCOPE)
0039 include(ECMAddAppIcon)
0040 include(KDEGitCommitHooks)
0041 include(ECMCheckOutboundLicense)
0042 include(ECMQtDeclareLoggingCategory)
0043 if (NOT ANDROID)
0044     include(KDEClangFormat)
0045 endif()
0046 
0047 if(NEOCHAT_FLATPAK)
0048     include(cmake/Flatpak.cmake)
0049 endif()
0050 
0051 if(QT_MAJOR_VERSION STREQUAL "6")
0052     set(BASICLISTITEM_BOLD "font.bold")
0053     set(OVERLAYSHEET_OPEN "onOpened")
0054     set(QTQUICK_MODULE_QML_VERSION "")
0055     set(QTLOCATION_MODULE_QML_VERSION "")
0056     set(QTMULTIMEDIA_MODULE_QML_VERSION "")
0057     set(QTMULTIMEDIA_AUDIO "MediaPlayer")
0058     # in Audio qt6 we don't have it but we disable it in qt5 => it seems ok
0059     set(QTMULTIMEDIA_AUDIO_AUTOLOAD "")
0060     # In Video qml qt6 we don't have it.
0061     set(QTMULTIMEDIA_VIDEO_FLUSHMODE "")
0062 else()
0063     set(BASICLISTITEM_BOLD "bold")
0064     set(OVERLAYSHEET_OPEN "onSheetOpenChanged")
0065     set(QTQUICK_MODULE_QML_VERSION "2.15")
0066     set(QTLOCATION_MODULE_QML_VERSION "5.15")
0067     set(QTMULTIMEDIA_MODULE_QML_VERSION "5.15")
0068     set(QTMULTIMEDIA_AUDIO "Audio")
0069     set(QTMULTIMEDIA_AUDIO_AUTOLOAD "autoLoad: false")
0070     set(QTMULTIMEDIA_VIDEO_FLUSHMODE "flushMode: VideoOutput.FirstFrame")
0071 endif()
0072 
0073 set(QUOTIENT_FORCE_NAMESPACED_INCLUDES TRUE)
0074 
0075 ecm_setup_version(${PROJECT_VERSION}
0076     VARIABLE_PREFIX NEOCHAT
0077     VERSION_HEADER ${CMAKE_CURRENT_BINARY_DIR}/neochat-version.h
0078 )
0079 
0080 find_package(Qt${QT_MAJOR_VERSION} ${QT_MIN_VERSION} NO_MODULE COMPONENTS Core Quick Gui QuickControls2 Multimedia Svg)
0081 set_package_properties(Qt${QT_MAJOR_VERSION} PROPERTIES
0082     TYPE REQUIRED
0083     PURPOSE "Basic application components"
0084 )
0085 find_package(KF${QT_MAJOR_VERSION} ${KF_MIN_VERSION} COMPONENTS Kirigami2 I18n Notifications Config CoreAddons Sonnet ItemModels)
0086 set_package_properties(KF${QT_MAJOR_VERSION} PROPERTIES
0087     TYPE REQUIRED
0088     PURPOSE "Basic application components"
0089 )
0090 set_package_properties(KF${QT_MAJOR_VERSION}Kirigami2 PROPERTIES
0091         TYPE REQUIRED
0092         PURPOSE "Kirigami application UI framework"
0093         )
0094 find_package(KF${QT_MAJOR_VERSION}KirigamiAddons 0.7.2 REQUIRED)
0095 
0096 find_package(Qt${QT_MAJOR_VERSION}Keychain)
0097 set_package_properties(Qt${QT_MAJOR_VERSION}Keychain PROPERTIES
0098     TYPE REQUIRED
0099     PURPOSE "Secure storage of account secrets"
0100 )
0101 
0102 if(ANDROID)
0103     find_package(OpenSSL)
0104     set_package_properties(OpenSSL PROPERTIES
0105         TYPE REQUIRED
0106         PURPOSE "Encrypted communications"
0107     )
0108 else()
0109     find_package(Qt${QT_MAJOR_VERSION} ${QT_MIN_VERSION} COMPONENTS Widgets)
0110     find_package(KF${QT_MAJOR_VERSION} ${KF_MIN_VERSION} REQUIRED COMPONENTS QQC2DesktopStyle ConfigWidgets KIO WindowSystem)
0111     set_package_properties(KF${QT_MAJOR_VERSION}QQC2DesktopStyle PROPERTIES
0112         TYPE RUNTIME
0113     )
0114     ecm_find_qmlmodule(org.kde.syntaxhighlighting 1.0)
0115 endif()
0116 
0117 if (NOT ANDROID AND NOT WIN32 AND NOT APPLE)
0118     find_package(KF${QT_MAJOR_VERSION}DBusAddons ${KF_MIN_VERSION} REQUIRED)
0119 endif()
0120 
0121 if(QT_MAJOR_VERSION STREQUAL "6" AND NOT ANDROID AND NOT WIN32)
0122     set(QUOTIENT_SUFFIX "Qt6")
0123 endif()
0124 
0125 find_package(Quotient${QUOTIENT_SUFFIX} 0.7)
0126 set_package_properties(Quotient${QUOTIENT_SUFFIX} PROPERTIES
0127     TYPE REQUIRED
0128     DESCRIPTION "Qt wrapper around Matrix API"
0129     URL "https://github.com/quotient-im/libQuotient/"
0130     PURPOSE "Talk with matrix server"
0131 )
0132 
0133 find_package(cmark)
0134 set_package_properties(cmark PROPERTIES
0135     TYPE REQUIRED
0136     DESCRIPTION "Cmark is the common mark reference implementation"
0137     URL "https://github.com/commonmark/cmark"
0138     PURPOSE "Convert markdown to html"
0139 )
0140 
0141 ecm_find_qmlmodule(org.kde.kquickimageeditor 1.0)
0142 ecm_find_qmlmodule(org.kde.kitemmodels 1.0)
0143 ecm_find_qmlmodule(org.kde.quickcharts 1.0)
0144 ecm_find_qmlmodule(QtLocation ${QTLOCATION_MODULE_QML_VERSION})
0145 
0146 find_package(KQuickImageEditor COMPONENTS)
0147 set_package_properties(KQuickImageEditor PROPERTIES
0148     TYPE REQUIRED
0149     DESCRIPTION "Simple image editor for QtQuick applications"
0150     URL "https://invent.kde.org/libraries/kquickimageeditor/"
0151     PURPOSE "Add image editing capability to image attachments"
0152 )
0153 
0154 find_package(QCoro${QT_MAJOR_VERSION} 0.4 COMPONENTS Core REQUIRED)
0155 
0156 qcoro_enable_coroutines()
0157 
0158 find_package(KF${QT_MAJOR_VERSION}DocTools ${KF_MIN_VERSION})
0159 set_package_properties(KF${QT_MAJOR_VERSION}DocTools PROPERTIES DESCRIPTION
0160     "Tools to generate documentation"
0161     TYPE OPTIONAL
0162 )
0163 
0164 if(NOT Quotient${QUOTIENT_SUFFIX}_VERSION_MINOR GREATER 6)
0165     cmake_policy(SET CMP0063 OLD)
0166 endif()
0167 
0168 if(ANDROID)
0169     find_package(Sqlite3)
0170     configure_file(${CMAKE_CURRENT_SOURCE_DIR}/android/version.gradle.in ${CMAKE_BINARY_DIR}/version.gradle)
0171 endif()
0172 
0173 ki18n_install(po)
0174 
0175 install(FILES org.kde.neochat.desktop DESTINATION ${KDE_INSTALL_APPDIR})
0176 install(FILES org.kde.neochat.appdata.xml DESTINATION ${KDE_INSTALL_METAINFODIR})
0177 install(FILES org.kde.neochat.svg DESTINATION ${KDE_INSTALL_FULL_ICONDIR}/hicolor/scalable/apps)
0178 install(FILES org.kde.neochat.tray.svg DESTINATION ${KDE_INSTALL_FULL_ICONDIR}/hicolor/scalable/apps)
0179 
0180 add_definitions(-DQT_NO_FOREACH)
0181 
0182 add_subdirectory(src)
0183 if (BUILD_TESTING AND Quotient${QUOTIENT_SUFFIX}_VERSION_MINOR GREATER 6)
0184     find_package(Qt${QT_MAJOR_VERSION} ${QT_MIN_VERSION} NO_MODULE COMPONENTS Test)
0185     add_subdirectory(autotests)
0186 endif()
0187 
0188 if(KF${QT_MAJOR_VERSION}DocTools_FOUND)
0189     kdoctools_install(po)
0190     add_subdirectory(doc)
0191 endif()
0192 
0193 feature_summary(WHAT ALL INCLUDE_QUIET_PACKAGES FATAL_ON_MISSING_REQUIRED_PACKAGES)
0194 
0195 if (NOT ANDROID)
0196     file(GLOB_RECURSE ALL_CLANG_FORMAT_SOURCE_FILES src/*.cpp src/*.h)
0197     kde_clang_format(${ALL_CLANG_FORMAT_SOURCE_FILES})
0198 
0199     kde_configure_git_pre_commit_hook(CHECKS CLANG_FORMAT)
0200 endif()
0201 file(GLOB_RECURSE ALL_SOURCE_FILES *.cpp *.h *.qml)
0202 # CI installs dependency headers to _install and _build, which break the reuse check
0203 # Fixes the test by excluding this directory
0204 list(FILTER ALL_SOURCE_FILES EXCLUDE REGEX [[_(install|build)/.*]])
0205 ecm_check_outbound_license(LICENSES GPL-3.0-only FILES ${ALL_SOURCE_FILES})
0206 
0207 ecm_qt_install_logging_categories(
0208         EXPORT NEOCHAT
0209         FILE neochat.categories
0210         DESTINATION ${KDE_INSTALL_LOGGINGCATEGORIESDIR}
0211         )