Warning, /network/kaidan/CMakeLists.txt is written in an unsupported language. File is not indexed.
0001 cmake_minimum_required(VERSION 3.16) 0002 set(CMAKE_CXX_STANDARD 20) 0003 set(QT_MIN_VERSION "5.15.0") 0004 set(KF5_MIN_VERSION "5.67.0") 0005 0006 if(POLICY CMP0071) 0007 cmake_policy(SET CMP0071 NEW) 0008 endif() 0009 0010 project(kaidan) 0011 0012 # application information 0013 set(APPLICATION_ID "im.kaidan.kaidan") 0014 set(APPLICATION_NAME "kaidan") 0015 set(APPLICATION_DISPLAY_NAME "Kaidan") 0016 set(APPLICATION_DESCRIPTION "A simple, user-friendly Jabber/XMPP client for every device!") 0017 if(UBUNTU_TOUCH) 0018 set(APPLICATION_NAME "${APPLICATION_ID}") 0019 endif() 0020 0021 # Version 0022 set(VERSION_MAJOR 0) 0023 set(VERSION_MINOR 9) 0024 set(VERSION_PATCH 0) 0025 set(VERSION_CODE 13) 0026 set(VERSION_EXTRA "" CACHE STRING "Stuff to append to version string") 0027 0028 set(DEVELOPMENT_BUILD TRUE) 0029 if(DEVELOPMENT_BUILD) 0030 set(VERSION_EXTRA "${VERSION_EXTRA}-dev") 0031 endif() 0032 0033 set(VERSION_STRING "${VERSION_MAJOR}.${VERSION_MINOR}.${VERSION_PATCH}") 0034 if(VERSION_EXTRA) 0035 set(VERSION_STRING ${VERSION_STRING}${VERSION_EXTRA}) 0036 endif() 0037 0038 # CMake options 0039 option(BUILD_TESTS "Build unit tests" FALSE) 0040 option(STATIC_BUILD "Build Kaidan statically") 0041 option(APPIMAGE "Build Kaidan as AppImage (will only work in the appimage script)" FALSE) 0042 option(UBUNTU_TOUCH "Building an Ubuntu Touch click (internal use only!)" FALSE) 0043 option(CLICK_ARCH "Architecture that will be used in the click's manifest") 0044 option(CLICK_DATE "Date used in the version number in the click's manifest") 0045 option(QUICK_COMPILER "Use QtQuick compiler to improve performance" FALSE) 0046 option(USE_KNOTIFICATIONS "Use KNotifications for displaying notifications" TRUE) 0047 option(BUNDLE_ICONS "Bundle breeze icons" FALSE) 0048 0049 # Find includes in corresponding build directories 0050 set(CMAKE_INCLUDE_CURRENT_DIR ON) 0051 0052 # Instruct CMake to run moc, uic and rcc automatically when needed. 0053 set(CMAKE_AUTOMOC ON) 0054 set(CMAKE_AUTOUIC ON) 0055 set(CMAKE_AUTORCC ON) 0056 set(AUTOMOC_MOC_OPTIONS -Muri=${APPLICATION_ID}) 0057 0058 # 0059 # Dependecies 0060 # 0061 0062 find_package(ECM 5.40.0 REQUIRED NO_MODULE) 0063 0064 # CMake module path 0065 set(CMAKE_MODULE_PATH ${CMAKE_MODULE_PATH} ${ECM_MODULE_PATH}) 0066 0067 # CMake modules include 0068 include(KDEInstallDirs) 0069 include(KDECompilerSettings NO_POLICY_SCOPE) 0070 include(KDECMakeSettings) 0071 include(ECMInstallIcons) 0072 include(FeatureSummary) 0073 kde_enable_exceptions() 0074 0075 # Find packages 0076 find_package(Qt5 ${QT_MIN_VERSION} REQUIRED NO_MODULE COMPONENTS Core Concurrent Qml Quick Svg Sql QuickControls2 Xml Multimedia Positioning Location) 0077 find_package(KF5 ${KF5_MIN_VERSION} REQUIRED COMPONENTS KIO CoreAddons Kirigami2) 0078 find_package(KQuickImageEditor REQUIRED) 0079 find_package(KF5KirigamiAddons 0.7.0 REQUIRED) 0080 find_package(ZXing REQUIRED) 0081 find_package(QXmpp 1.5.0 REQUIRED COMPONENTS Omemo) 0082 0083 # Optional QtQuickCompiler 0084 if(QUICK_COMPILER) 0085 find_package(Qt5QuickCompiler) 0086 set_package_properties(Qt5QuickCompiler PROPERTIES 0087 DESCRIPTION "Compile QML at build time" 0088 TYPE OPTIONAL 0089 ) 0090 endif() 0091 0092 if(USE_KNOTIFICATIONS) 0093 find_package(KF5Notifications REQUIRED) 0094 set(__KF5Notifications_LIBRARIES KF5::Notifications) 0095 add_definitions(-DHAVE_KNOTIFICATIONS) 0096 endif() 0097 0098 # Optional QWidget style integration (not on mobile) 0099 if(NOT UBUNTU_TOUCH AND NOT ANDROID AND NOT IOS) 0100 find_package(Qt5Widgets) 0101 find_package(KF5QQC2DesktopStyle) 0102 set_package_properties(Qt5Widgets PROPERTIES 0103 DESCRIPTION "Integration with QWidget based desktop styles" 0104 TYPE OPTIONAL 0105 ) 0106 endif() 0107 0108 # Platform-specific 0109 if(Qt5Widgets_FOUND) 0110 add_definitions(-DHAVE_QWIDGETS -DQAPPLICATION_CLASS=QApplication) 0111 set(__Qt5Widgets_LIBRARIES Qt5::Widgets) 0112 else() 0113 add_definitions(-DQAPPLICATION_CLASS=QGuiApplication) 0114 endif() 0115 0116 if(ANDROID) 0117 find_package(Qt5 REQUIRED COMPONENTS AndroidExtras) 0118 # We need to link against sqlite3 to help androiddeployqt detect that we need it 0119 find_package(SQLite3 REQUIRED) 0120 0121 find_package(PkgConfig REQUIRED) 0122 pkg_search_module(OPENSSL REQUIRED openssl IMPORTED_TARGET) 0123 message(STATUS "Using OpenSSL ${OPENSSL_VERSION}") 0124 endif() 0125 0126 include(ECMPoQmTools) 0127 0128 ecm_install_po_files_as_qm(poqm) 0129 0130 # 0131 # Kaidan binary 0132 # 0133 0134 add_subdirectory(src) 0135 0136 # 0137 # Install Kaidan 0138 # 0139 0140 if(ANDROID) 0141 configure_file(${CMAKE_SOURCE_DIR}/misc/android/AndroidManifest.xml.in 0142 ${CMAKE_SOURCE_DIR}/misc/android/AndroidManifest.xml) 0143 elseif(IOS) 0144 configure_file(${CMAKE_SOURCE_DIR}/misc/ios/Info.plist.in 0145 ${CMAKE_SOURCE_DIR}/misc/ios/Info.plist) 0146 endif() 0147 0148 if(UBUNTU_TOUCH AND CLICK_ARCH) 0149 set(CLICK_VERSION ${VERSION_STRING}) 0150 if(DEVELOPMENT_BUILD) 0151 set(CLICK_VERSION "${CLICK_VERSION}.${CLICK_DATE}") 0152 endif() 0153 0154 # will replace ${CLICK_ARCH} with its value 0155 configure_file(${CMAKE_SOURCE_DIR}/misc/ubuntu-touch/manifest.json.in 0156 ${CMAKE_SOURCE_DIR}/misc/ubuntu-touch/manifest.json) 0157 0158 # install kaidan binary 0159 install(PROGRAMS ${CMAKE_CURRENT_BINARY_DIR}/bin/${PROJECT_NAME} 0160 DESTINATION ${CMAKE_INSTALL_PREFIX} 0161 ) 0162 # install kaidan media 0163 install(DIRECTORY "data/" 0164 DESTINATION "${CMAKE_INSTALL_FULL_DATADIR}/${APPLICATION_ID}" 0165 PATTERN "*.qrc" EXCLUDE 0166 ) 0167 # install icon 0168 install(FILES "data/images/kaidan.svg" "misc/ubuntu-touch/apparmor.json" 0169 "misc/ubuntu-touch/kaidan.desktop" "misc/ubuntu-touch/manifest.json" 0170 DESTINATION "${CMAKE_INSTALL_PREFIX}" 0171 ) 0172 elseif(UNIX AND NOT APPLE) 0173 # install kaidan media 0174 install(DIRECTORY "data/" 0175 DESTINATION "${CMAKE_INSTALL_FULL_DATADIR}/${PROJECT_NAME}" 0176 PATTERN "*.qrc" EXCLUDE 0177 ) 0178 0179 # install icon (scalable + 128x) 0180 install(FILES "data/images/kaidan.svg" 0181 DESTINATION "${CMAKE_INSTALL_FULL_DATADIR}/icons/hicolor/scalable/apps" 0182 ) 0183 install(FILES "misc/kaidan-128x128.png" 0184 DESTINATION "${CMAKE_INSTALL_FULL_DATADIR}/icons/hicolor/128x128/apps" 0185 RENAME "kaidan.png" 0186 ) 0187 # install desktop file 0188 install(FILES "misc/im.kaidan.kaidan.desktop" 0189 DESTINATION "${KDE_INSTALL_APPDIR}" 0190 ) 0191 # install metainfo 0192 install(FILES "misc/im.kaidan.kaidan.appdata.xml" 0193 DESTINATION "${KDE_INSTALL_METAINFODIR}" 0194 RENAME "${APPLICATION_ID}.appdata.xml" 0195 ) 0196 endif() 0197 0198 # install kaidan binary 0199 install(TARGETS kaidan 0200 ${KDE_INSTALL_TARGETS_DEFAULT_ARGS} 0201 ) 0202 0203 # KNotifications 0204 if(USE_KNOTIFICATIONS) 0205 install(FILES misc/kaidan.notifyrc DESTINATION ${KNOTIFYRC_INSTALL_DIR}) 0206 endif() 0207 0208 # 0209 # Unit tests 0210 # 0211 0212 if(BUILD_TESTS) 0213 add_subdirectory(tests) 0214 endif() 0215 0216 feature_summary(WHAT ALL FATAL_ON_MISSING_REQUIRED_PACKAGES)