-
-
Notifications
You must be signed in to change notification settings - Fork 8
/
CMakeLists.txt
217 lines (178 loc) · 8.52 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
cmake_minimum_required(VERSION 3.16 FATAL_ERROR)
set(PIM_VERSION "6.3.40")
set(PIM_VERSION ${PIM_VERSION})
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}")
# Whenever KALARM_VERSION changes, set the 3 variables below it to the first
# KDE Release Service version which will contain that KAlarm release.
# (This must be the full release version, not an alpha or beta release.)
set(KALARM_VERSION "3.10.0")
set(KALARM_VERSION_RELEASE_SERVICE_MAJOR "24")
set(KALARM_VERSION_RELEASE_SERVICE_MINOR "12")
set(KALARM_VERSION_RELEASE_SERVICE_MICRO "0")
# If KAlarm's version has not changed since the last KDE Release Service version,
# this code sets a sub-version x.x.x.N to avoid duplicate version numbers in
# org.kde.kalarm.appdata.xml, which cause appstream to choke.
math(EXPR LAST_RELEASE_MONTH "${KALARM_VERSION_RELEASE_SERVICE_MAJOR} * 12 + ${KALARM_VERSION_RELEASE_SERVICE_MINOR} + ${KALARM_VERSION_RELEASE_SERVICE_MICRO}")
math(EXPR THIS_RELEASE_MONTH "${RELEASE_SERVICE_VERSION_MAJOR} * 12 + ${RELEASE_SERVICE_VERSION_MINOR} + ${RELEASE_SERVICE_VERSION_MICRO}")
math(EXPR KALARM_RELEASE_SUB_VERSION "${THIS_RELEASE_MONTH} - ${LAST_RELEASE_MONTH}")
if(${KALARM_RELEASE_SUB_VERSION} GREATER 0)
set(KALARM_VERSION "${KALARM_VERSION}.${KALARM_RELEASE_SUB_VERSION}")
endif()
project(kalarm VERSION ${KALARM_VERSION})
set(KF_MIN_VERSION "6.8.0")
find_package(ECM ${KF_MIN_VERSION} CONFIG REQUIRED)
set(CMAKE_MODULE_PATH ${kalarm_SOURCE_DIR}/cmake/modules ${ECM_MODULE_PATH})
include(ECMInstallIcons)
include(ECMSetupVersion)
include(ECMAddTests)
include(GenerateExportHeader)
include(ECMGenerateHeaders)
include(FeatureSummary)
include(CheckFunctionExists)
include(KDEInstallDirs)
include(KDECMakeSettings)
include(KDECompilerSettings NO_POLICY_SCOPE)
include(ECMAddAppIcon)
include(ECMQtDeclareLoggingCategory)
include(ECMDeprecationSettings)
include(ECMFeatureSummary)
set(QT_REQUIRED_VERSION "6.7.0")
set(KTEXTADDONS_MIN_VERSION "1.5.4")
# Do NOT add quote
set(KDEPIM_DEV_VERSION alpha)
# add an extra space
if(DEFINED KDEPIM_DEV_VERSION)
set(KDEPIM_DEV_VERSION " ${KDEPIM_DEV_VERSION}")
endif()
set(KDEPIM_VERSION "${PIM_VERSION}${KDEPIM_DEV_VERSION} (${RELEASE_SERVICE_VERSION})")
set(AKONADI_VERSION "6.3.40")
set(AKONADI_MIMELIB_VERSION "6.3.40")
set(AKONADI_CONTACT_VERSION "6.3.40")
set(KMAILTRANSPORT_LIB_VERSION "6.3.40")
set(IDENTITYMANAGEMENT_LIB_VERSION "6.3.40")
set(KMIME_LIB_VERSION "6.3.40")
set(KDEPIM_LIB_VERSION "${PIM_VERSION}")
set(KDEPIM_LIB_SOVERSION "6")
find_package(Qt6 ${QT_REQUIRED_VERSION} CONFIG REQUIRED DBus Gui Network Widgets)
set(CALENDARUTILS_LIB_VERSION "6.3.40")
option(ENABLE_AKONADI_PLUGIN "Build the Akonadi plugin" ON)
add_feature_info(AKONADI_PLUGIN ${ENABLE_AKONADI_PLUGIN} "Provides features dependent on Akonadi (including birthday import,
email functions, email address book, first run resource migration)")
option(ENABLE_RTC_WAKE_FROM_SUSPEND "Enable RTC wake-from-suspend alarms (requires KAuth)" ON)
if(ENABLE_RTC_WAKE_FROM_SUSPEND)
find_package(KF6Auth ${KF_MIN_VERSION})
if(NOT KF6Auth_FOUND)
set(ENABLE_RTC_WAKE_FROM_SUSPEND OFF)
endif()
endif()
add_feature_info(RTC_WAKE_FROM_SUSPEND ${ENABLE_RTC_WAKE_FROM_SUSPEND} "If kernel timers are not available, use RTC for wake-from-suspend alarms")
# Find KF6 packages
find_package(KF6CalendarCore ${KF_MIN_VERSION} CONFIG REQUIRED)
find_package(KF6Codecs ${KF_MIN_VERSION} CONFIG REQUIRED)
find_package(KF6Completion ${KF_MIN_VERSION} REQUIRED)
find_package(KF6Config ${KF_MIN_VERSION} CONFIG REQUIRED)
find_package(KF6ConfigWidgets ${KF_MIN_VERSION} CONFIG REQUIRED)
find_package(KF6Contacts ${KF_MIN_VERSION} CONFIG REQUIRED)
find_package(KF6Crash ${KF_MIN_VERSION} CONFIG REQUIRED)
find_package(KF6DBusAddons ${KF_MIN_VERSION} CONFIG REQUIRED)
find_package(KF6GlobalAccel ${KF_MIN_VERSION})
find_package(KF6GuiAddons ${KF_MIN_VERSION} REQUIRED)
find_package(KF6Holidays ${KF_MIN_VERSION} CONFIG REQUIRED)
find_package(KF6I18n ${KF_MIN_VERSION} CONFIG REQUIRED)
find_package(KF6ItemModels ${KF_MIN_VERSION} CONFIG REQUIRED)
find_package(KF6JobWidgets ${KF_MIN_VERSION} REQUIRED)
find_package(KF6KIO ${KF_MIN_VERSION} CONFIG REQUIRED)
find_package(KF6Notifications ${KF_MIN_VERSION} CONFIG REQUIRED)
find_package(KF6NotifyConfig ${KF_MIN_VERSION} CONFIG REQUIRED)
find_package(KF6Service ${KF_MIN_VERSION} CONFIG REQUIRED)
find_package(KF6WidgetsAddons ${KF_MIN_VERSION} CONFIG REQUIRED)
find_package(KF6WindowSystem ${KF_MIN_VERSION} CONFIG REQUIRED)
find_package(KF6XmlGui ${KF_MIN_VERSION} CONFIG REQUIRED)
find_package(KF6TextWidgets ${KF_MIN_VERSION} CONFIG REQUIRED)
find_package(KF6StatusNotifierItem ${KF_MIN_VERSION} CONFIG REQUIRED)
find_package(KF6IconThemes ${KF_MIN_VERSION} QUIET)
find_package(KF6DocTools ${KF_MIN_VERSION})
set_package_properties(KF6DocTools PROPERTIES DESCRIPTION
"Tools to generate documentation"
TYPE OPTIONAL
)
if(TARGET KF6::GlobalAccel)
add_definitions(-DHAVE_GLOBAL_ACCEL_SUPPORT)
endif()
# Find KDE PIM packages
find_package(KPim6CalendarUtils ${CALENDARUTILS_LIB_VERSION} CONFIG REQUIRED)
find_package(KPim6IdentityManagementWidgets ${IDENTITYMANAGEMENT_LIB_VERSION} CONFIG REQUIRED)
find_package(KPim6Mime ${KMIME_LIB_VERSION} CONFIG REQUIRED)
option(ENABLE_LIBVLC "Build support for LibVLC" ON)
add_feature_info(ENABLE_LIBVLC ${ENABLE_LIBVLC} "Provides support for playing sound files using LibVLC")
option(ENABLE_LIBMPV "Build support for Libmpv" OFF)
add_feature_info(ENABLE_LIBMPV ${ENABLE_LIBMPV} "Provides support for playing sound files using Libmpv")
if(ENABLE_LIBVLC)
find_package(LibVLC "3.0.0" QUIET REQUIRED)
set_package_properties(LibVLC PROPERTIES PURPOSE "Needed to play audio alarms")
elseif(ENABLE_LIBMPV)
# Note: libmpv < 2.2.0 has threading issues which cause hang-ups
find_package(Libmpv "2.2.0" QUIET REQUIRED)
set_package_properties(Libmpv PROPERTIES PURPOSE "Needed to play audio alarms")
else()
message(FATAL_ERROR "Support for either ENABLE_LIBVLC or ENABLE_LIBMPV must be enabled for playing sound files")
endif()
find_package(KF6TextEditTextToSpeech ${KTEXTADDONS_MIN_VERSION} CONFIG)
set_package_properties(KF6TextEditTextToSpeech PROPERTIES DESCRIPTION
"Add support for text to speech"
TYPE OPTIONAL
)
if(TARGET KF6::TextEditTextToSpeech)
add_definitions(-DHAVE_TEXT_TO_SPEECH_SUPPORT)
endif()
if(ENABLE_AKONADI_PLUGIN)
find_package(KPim6Akonadi ${AKONADI_VERSION} CONFIG REQUIRED)
find_package(KPim6AkonadiContactWidgets ${AKONADI_CONTACT_VERSION} CONFIG REQUIRED)
find_package(KPim6AkonadiMime ${AKONADI_MIMELIB_VERSION} CONFIG REQUIRED)
find_package(KPim6MailTransport ${KMAILTRANSPORT_LIB_VERSION} CONFIG REQUIRED)
endif()
configure_file(kalarm-version-string.h.in ${CMAKE_CURRENT_BINARY_DIR}/kalarm-version-string.h @ONLY)
if(NOT APPLE)
option(WITHOUT_X11 "Build without X11 integration (skips finding X11)" OFF)
add_feature_info(WITHOUT_X11 ${WITHOUT_X11} "Disable X11 integration, even if X11 is available")
if(NOT WITHOUT_X11)
find_package(X11)
set(ENABLE_X11 ${X11_FOUND})
if(X11_FOUND)
find_package(Qt6 ${QT_REQUIRED_VERSION} CONFIG REQUIRED Gui)
add_feature_info(ENABLE_X11 ${ENABLE_X11} "Enable use of X11")
endif()
endif()
endif()
set(CMAKE_MODULE_PATH ${ECM_MODULE_PATH})
configure_file(src/config-kalarm.h.in ${CMAKE_CURRENT_BINARY_DIR}/config-kalarm.h)
include_directories(${kalarm_SOURCE_DIR} ${kalarm_BINARY_DIR})
add_definitions(-DQT_MESSAGELOGCONTEXT)
add_definitions(-DQT_NO_CONTEXTLESS_CONNECT)
# -fhardened increase compilation time and produce a lot of warning
option(OPTION_DISABLE_HARDENED_OPTIMIZATION "Disable -fhardened" OFF)
if(OPTION_DISABLE_HARDENED_OPTIMIZATION)
string(REPLACE "-fhardened" "" CMAKE_C_FLAGS "${CMAKE_C_FLAGS}")
string(REPLACE "-fhardened" "" CMAKE_CXX_FLAGS "${CMAKE_CXX_FLAGS}")
endif()
ecm_set_disabled_deprecation_versions(QT 6.7.0 KF 6.9.0)
option(USE_UNITY_CMAKE_SUPPORT "Use UNITY cmake support (speedup compile time)" OFF)
set(COMPILE_WITH_UNITY_CMAKE_SUPPORT OFF)
if(USE_UNITY_CMAKE_SUPPORT)
set(COMPILE_WITH_UNITY_CMAKE_SUPPORT ON)
endif()
add_subdirectory(src)
ecm_qt_install_logging_categories(
EXPORT KALARM
FILE kalarm.categories
DESTINATION ${KDE_INSTALL_LOGGINGCATEGORIESDIR}
)
if(KF6DocTools_FOUND)
kdoctools_install(po)
add_subdirectory(doc)
endif()
ki18n_install(po)
ecm_feature_summary(WHAT ALL FATAL_ON_MISSING_REQUIRED_PACKAGES)