-
-
Notifications
You must be signed in to change notification settings - Fork 8
/
CMakeLists.txt
218 lines (178 loc) · 6.37 KB
/
CMakeLists.txt
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
143
144
145
146
147
148
149
150
151
152
153
154
155
156
157
158
159
160
161
162
163
164
165
166
167
168
169
170
171
172
173
174
175
176
177
178
179
180
181
182
183
184
185
186
187
188
189
190
191
192
193
194
195
196
197
198
199
200
201
202
203
204
205
206
207
208
209
210
211
212
213
214
215
216
217
218
# SPDX-FileCopyrightText: 2021 Carl Schwan <carlschwan@kde.org>
# SPDX-License-Identifier: BSD-2-Clause
cmake_minimum_required(VERSION 3.16)
# KDE Applications version, managed by release script.
set(RELEASE_SERVICE_VERSION_MAJOR "25")
set(RELEASE_SERVICE_VERSION_MINOR "03")
set(RELEASE_SERVICE_VERSION_MICRO "70")
set(RELEASE_SERVICE_VERSION "${RELEASE_SERVICE_VERSION_MAJOR}.${RELEASE_SERVICE_VERSION_MINOR}.${RELEASE_SERVICE_VERSION_MICRO}")
project(tokodon VERSION ${RELEASE_SERVICE_VERSION})
option(SAILFISHOS "Build for sailfishOS" OFF)
set(SHOULD_USE_QTMULTIMEDIA OFF)
if (WIN32)
set(SHOULD_USE_QTMULTIMEDIA ON)
endif()
option(USE_QTMULTIMEDIA "Use QtMultimedia instead of MpvQt for video playback" ${SHOULD_USE_QTMULTIMEDIA})
set(KF_MIN_VERSION "6.9.0")
set(QT_MIN_VERSION "6.7.0")
include(FeatureSummary)
find_package(ECM ${KF_MIN_VERSION} NO_MODULE)
set_package_properties(ECM PROPERTIES
TYPE REQUIRED
URL "https://api.kde.org/ecm/"
DESCRIPTION "extra cmake modules")
set(CMAKE_MODULE_PATH ${ECM_MODULE_PATH} ${CMAKE_SOURCE_DIR}/cmake)
set(CMAKE_CXX_STANDARD 20)
set(CMAKE_CXX_STANDARD_REQUIRED ON)
find_package(Qt6 ${QT_MIN_VERSION} NO_MODULE COMPONENTS Widgets Core Quick Gui QuickControls2 Svg WebSockets Test)
set_package_properties(Qt6 PROPERTIES
TYPE REQUIRED
PURPOSE "Required application components"
)
find_package(Qt6WebView ${QT_MIN_VERSION})
set_package_properties(Qt6WebView PROPERTIES
TYPE OPTIONAL
PURPOSE "For in-app authentication on mobile"
)
set(USE_QTWEBVIEW ${Qt6WebView_FOUND})
find_package(KF6 ${KF_MIN_VERSION} COMPONENTS Kirigami KirigamiPlatform I18n Notifications Config CoreAddons ColorScheme)
set_package_properties(KF6 PROPERTIES
TYPE REQUIRED
PURPOSE "Required application components"
)
find_package(KF6Crash ${KF_MIN_VERSION})
set_package_properties(KF6Crash PROPERTIES
TYPE OPTIONAL
PURPOSE "For crash handling"
)
find_package(KF6KirigamiAddons 1.1.0)
set_package_properties(KF6KirigamiAddons PROPERTIES
TYPE REQUIRED
PURPOSE "Required application components and runtime dependency"
)
find_package(Qt6Keychain)
set_package_properties(Qt6Keychain PROPERTIES
TYPE REQUIRED
PURPOSE "Secure storage of account secrets"
)
find_package(KUnifiedPush QUIET)
set_package_properties(KUnifiedPush PROPERTIES
TYPE OPTIONAL
PURPOSE "Push notification support"
URL "https://invent.kde.org/libraries/kunifiedpush"
)
if (TARGET KUnifiedPush)
find_package(OpenSSL REQUIRED)
set_package_properties(OpenSSL PROPERTIES
PURPOSE "Generate push notification keys"
)
endif()
if (ANDROID AND NOT TARGET OpenSSL::SSL)
find_package(OpenSSL)
set_package_properties(OpenSSL PROPERTIES
TYPE REQUIRED
PURPOSE "Encrypted communications"
)
endif()
if (SAILFISHOS OR ANDROID)
find_package(QQC2BreezeStyle)
set_package_properties(QQC2BreezeStyle PROPERTIES
PURPOSE "Preferred Qt Quick Controls style"
)
else()
find_package(KF6QQC2DesktopStyle)
set_package_properties(KF6QQC2DesktopStyle PROPERTIES
TYPE REQUIRED
PURPOSE "Preferred Qt Quick Controls style"
)
endif()
if (UNIX AND NOT APPLE AND NOT ANDROID)
find_package(KF6KIO ${KF_MIN_VERSION})
set_package_properties(KF6KIO PROPERTIES
TYPE REQUIRED
PURPOSE "Sharing content and downloading files"
)
endif ()
if (UNIX AND NOT APPLE AND NOT ANDROID AND NOT TOKODON_FLATPAK)
find_package(KF6Purpose ${KF_MIN_VERSION})
set_package_properties(KF6Purpose PROPERTIES
TYPE REQUIRED
PURPOSE "Sharing content from other KDE applications"
)
endif ()
if (NOT ANDROID AND NOT WIN32 AND NOT APPLE)
find_package(KF6DBusAddons ${KF_MIN_VERSION})
set_package_properties(KF6DBusAddons PROPERTIES
TYPE REQUIRED
PURPOSE "Single application support"
)
find_package(KF6WindowSystem ${KF_MIN_VERSION})
set_package_properties(KF6WindowSystem PROPERTIES
TYPE REQUIRED
PURPOSE "Misc windowing operations"
)
endif ()
if (USE_QTMULTIMEDIA)
find_package(Qt6Multimedia ${QT_MIN_VERSION})
set_package_properties(Qt6Multimedia PROPERTIES
TYPE REQUIRED
PURPOSE "Video playback"
)
else()
find_package(MpvQt)
set_package_properties(MpvQt PROPERTIES
PURPOSE "Video playback"
TYPE REQUIRED
)
endif()
feature_summary(WHAT ALL INCLUDE_QUIET_PACKAGES FATAL_ON_MISSING_REQUIRED_PACKAGES)
include(ECMSetupVersion)
include(KDEInstallDirs)
include(ECMFindQmlModule)
include(KDEClangFormat)
include(ECMQtDeclareLoggingCategory)
include(KDECMakeSettings NO_POLICY_SCOPE)
include(KDECompilerSettings NO_POLICY_SCOPE)
include(ECMAddTests)
include(KDEGitCommitHooks)
include(ECMQmlModule)
include(ECMDeprecationSettings)
include(ECMCheckOutboundLicense)
if (ANDROID)
include(ECMAddAndroidApk)
endif ()
ecm_setup_version(${PROJECT_VERSION}
VARIABLE_PREFIX TOKODON
VERSION_HEADER ${CMAKE_CURRENT_BINARY_DIR}/tokodon-version.h
)
ecm_set_disabled_deprecation_versions(
QT ${QT_MIN_VERSION}
KF ${KF_MIN_VERSION}
)
ecm_find_qmlmodule(org.kde.kitemmodels REQUIRED)
ecm_find_qmlmodule(org.kde.notification REQUIRED)
ecm_find_qmlmodule(org.kde.kquickcontrolsaddons REQUIRED)
if (NOT ANDROID)
ecm_find_qmlmodule(org.kde.sonnet REQUIRED)
endif()
add_subdirectory(src)
ki18n_install(po)
if (ANDROID)
configure_file(${CMAKE_CURRENT_SOURCE_DIR}/android/version.gradle.in ${CMAKE_BINARY_DIR}/version.gradle)
endif()
install(FILES org.kde.tokodon.desktop DESTINATION ${KDE_INSTALL_APPDIR})
install(FILES org.kde.tokodon.appdata.xml DESTINATION ${KDE_INSTALL_METAINFODIR})
install(FILES org.kde.tokodon.svg DESTINATION ${KDE_INSTALL_FULL_ICONDIR}/hicolor/scalable/apps)
ecm_qt_install_logging_categories(
EXPORT TOKODON
FILE tokodon.categories
SORT DESTINATION ${KDE_INSTALL_LOGGINGCATEGORIESDIR}
)
file(GLOB_RECURSE ALL_CLANG_FORMAT_SOURCE_FILES src/*.cpp src/*.h)
kde_clang_format(${ALL_CLANG_FORMAT_SOURCE_FILES})
kde_configure_git_pre_commit_hook(CHECKS CLANG_FORMAT)
file(GLOB_RECURSE ALL_SOURCE_FILES *.cpp *.h *.qml)
# CI installs dependency headers to _install and _build, which break the reuse check
# Fixes the test by excluding this directory
list(FILTER ALL_SOURCE_FILES EXCLUDE REGEX [[.*(install|build).*/.*]])
ecm_check_outbound_license(LICENSES GPL-3.0-only FILES ${ALL_SOURCE_FILES})