CMakeLists.txt 7.72 KB
Newer Older
Rolf Eike Beer's avatar
Rolf Eike Beer committed
1
cmake_minimum_required(VERSION 3.0 FATAL_ERROR)
2

3
# KDE Application Version, managed by release script
4
set (RELEASE_SERVICE_VERSION_MAJOR "20")
5
set (RELEASE_SERVICE_VERSION_MINOR "04")
6
set (RELEASE_SERVICE_VERSION_MICRO "2")
7
set (RELEASE_SERVICE_VERSION "${RELEASE_SERVICE_VERSION_MAJOR}.${RELEASE_SERVICE_VERSION_MINOR}.${RELEASE_SERVICE_VERSION_MICRO}")
8

9
project(kgpg VERSION ${RELEASE_SERVICE_VERSION})
Rolf Eike Beer's avatar
Rolf Eike Beer committed
10
set(QT_MIN_VERSION "5.9.0")
Andrius Štikonas's avatar
Andrius Štikonas committed
11
12
13
14
15
16
17
18

find_package(ECM 5.21 REQUIRED NO_MODULE)
set(CMAKE_MODULE_PATH ${ECM_MODULE_PATH} ${CMAKE_MODULE_PATH} "${CMAKE_CURRENT_SOURCE_DIR}/cmake/")

include(ECMAddAppIcon)
include(ECMInstallIcons)
include(KDEInstallDirs)
include(KDECMakeSettings)
19
include(KDEFrameworkCompilerSettings NO_POLICY_SCOPE)
Andrius Štikonas's avatar
Andrius Štikonas committed
20
21
include(FeatureSummary)
include(ECMSetupVersion)
Rolf Eike Beer's avatar
Rolf Eike Beer committed
22
include(CMakeFindDependencyMacro)
Laurent Montel's avatar
Laurent Montel committed
23
include(ECMQtDeclareLoggingCategory)
Andrius Štikonas's avatar
Andrius Štikonas committed
24
25
26

find_package(Qt5 ${QT_MIN_VERSION} CONFIG REQUIRED COMPONENTS
  Core
27
  DBus
Andrius Štikonas's avatar
Andrius Štikonas committed
28
  Gui
29
  PrintSupport
Andrius Štikonas's avatar
Andrius Štikonas committed
30
31
  Widgets
)
Laurent Montel's avatar
Laurent Montel committed
32

Andrius Štikonas's avatar
Andrius Štikonas committed
33
# Load the frameworks we need
Albert Astals Cid's avatar
Albert Astals Cid committed
34
find_package(KF5 5.28 REQUIRED
Andrius Štikonas's avatar
Andrius Štikonas committed
35
36
37
  Archive
  DocTools
  Codecs
38
  CoreAddons
Andrius Štikonas's avatar
Andrius Štikonas committed
39
  Crash
40
  DBusAddons
41
42
  I18n
  IconThemes
43
  JobWidgets
Andrius Štikonas's avatar
Andrius Štikonas committed
44
  KIO
45
  Notifications
Andrius Štikonas's avatar
Andrius Štikonas committed
46
  Service
Andrius Štikonas's avatar
Andrius Štikonas committed
47
  TextWidgets
48
  XmlGui
Andrius Štikonas's avatar
Andrius Štikonas committed
49
  WidgetsAddons
50
  WindowSystem
Andrius Štikonas's avatar
Andrius Štikonas committed
51
)
52

53
54
55
56
57
58
# kdepimlibs
find_package(KF5 REQUIRED
  AkonadiContact
  Contacts
)

59
# only headers are used
Andrius Štikonas's avatar
Andrius Štikonas committed
60
find_package(Gpgme REQUIRED)
61

62
add_definitions(-DQT_NO_URL_CAST_FROM_STRING)
63
64
add_definitions(-DQT_NO_NARROWING_CONVERSIONS_IN_CONNECT)
#add_definitions(-DQT_DISABLE_DEPRECATED_BEFORE=0x060000)
65

66
add_subdirectory( icons )
Andrius Štikonas's avatar
Andrius Štikonas committed
67
add_subdirectory( doc )
Andrius Štikonas's avatar
Andrius Štikonas committed
68
include_directories(  ${KDEPIMLIBS_INCLUDE_DIR} ${GPGME_INCLUDES} )
69

70
71
option(KGPG_DEBUG_TRANSACTIONS "show commands and results of gpg calls in debug log" Off)

Laurent Montel's avatar
Laurent Montel committed
72
73
74



75
set(core_SRCS
Laurent Montel's avatar
Laurent Montel committed
76
77
   core/convert.cpp
   core/images.cpp
78
   core/emailvalidator.cpp
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
   core/kgpgkey.cpp
   core/KGpgExpandableNode.cpp
   core/KGpgKeyNode.cpp
   core/KGpgGroupMemberNode.cpp
   core/KGpgGroupNode.cpp
   core/KGpgNode.cpp
   core/KGpgOrphanNode.cpp
   core/KGpgRefNode.cpp
   core/KGpgRootNode.cpp
   core/KGpgSignableNode.cpp
   core/KGpgSignNode.cpp
   core/KGpgSubkeyNode.cpp
   core/KGpgUatNode.cpp
   core/KGpgUidNode.cpp
)
94

95
96
97
set(kgpg_editor_SRCS
   editor/kgpgmd5widget.cpp
   editor/kgpgeditor.cpp
98
   editor/kgpgtextedit.cpp
99
100
101
)

set(kgpg_model_SRCS
102
   model/gpgservermodel.cpp
103
104
105
   model/kgpgitemmodel.cpp
   model/groupeditproxymodel.cpp
   model/keylistproxymodel.cpp
106
   model/kgpgsearchresultmodel.cpp
107
108
109
   model/selectkeyproxymodel.cpp
)

110
111
set(kgpg_transaction_SRCS
   transactions/kgpgtransaction.cpp
112
   transactions/kgpgtransactionjob.cpp
Andrius Štikonas's avatar
Andrius Štikonas committed
113
   transactions/kgpgtransactionprivate.cpp
114
   transactions/kgpguidtransaction.cpp
115
   transactions/kgpgeditkeytransaction.cpp
116
   transactions/kgpgsigntransactionhelper.cpp
117
118
119
120
   transactions/kgpgchangedisable.cpp
   transactions/kgpgchangeexpire.cpp
   transactions/kgpgchangepass.cpp
   transactions/kgpgchangetrust.cpp
121
   transactions/kgpgdelsign.cpp
122
   transactions/kgpgdeluid.cpp
123
   transactions/kgpgencrypt.cpp
124
   transactions/kgpgexport.cpp
125
   transactions/kgpgaddphoto.cpp
126
127
   transactions/kgpgadduid.cpp
   transactions/kgpggeneratekey.cpp
128
   transactions/kgpggeneraterevoke.cpp
129
   transactions/kgpgdecrypt.cpp
130
   transactions/kgpgdelkey.cpp
Rolf Eike Beer's avatar
Rolf Eike Beer committed
131
   transactions/kgpgimport.cpp
132
133
   transactions/kgpgkeyservertransaction.cpp
   transactions/kgpgkeyservergettransaction.cpp
134
   transactions/kgpgkeyserversearchtransaction.cpp
135
   transactions/kgpgprimaryuid.cpp
136
   transactions/kgpgsendkeys.cpp
137
   transactions/kgpgsignkey.cpp
138
   transactions/kgpgsigntext.cpp
139
   transactions/kgpgsignuid.cpp
140
   transactions/kgpgtextorfiletransaction.cpp
141
   transactions/kgpgverify.cpp
142
143
144
)

set(kgpg_SRCS ${core_SRCS} ${kgpg_editor_SRCS} ${kgpg_model_SRCS} ${kgpg_transaction_SRCS}
145
   selectpublickeydialog.cpp
146
   selectsecretkey.cpp
147
148
   kgpgoptions.cpp
   keysmanager.cpp
149
150
151
   kgpg.cpp
   kgpgkeygenerate.cpp
   kgpginterface.cpp
152
   kgpgtextinterface.cpp
153
   gpgproc.cpp
154
   klinebufferedprocess.cpp
Andrius Štikonas's avatar
Andrius Štikonas committed
155
   klinebufferedprocessprivate.cpp
156
157
   keyservers.cpp
   detailedconsole.cpp
158
   keyinfodialog.cpp
Jimmy Gilles's avatar
Jimmy Gilles committed
159
160
161
   newkey.cpp
   keyexport.cpp
   conf_encryption.cpp
Laurent Montel's avatar
Laurent Montel committed
162
   kgpgrevokewidget.cpp
163
   keytreeview.cpp
164
   groupedit.cpp
165
166
   sourceselect.cpp
   kgpgchangekey.cpp
167
   kgpgfirstassistant.cpp
168
   kgpgexternalactions.cpp
169
   selectexpirydate.cpp
170
   caff.cpp
171
   foldercompressjob.cpp
172
)
Laurent Montel's avatar
Laurent Montel committed
173

Laurent Montel's avatar
Laurent Montel committed
174
175
ecm_qt_declare_logging_category(kgpg_SRCS HEADER kgpg_general_debug.h IDENTIFIER KGPG_LOG_GENERAL CATEGORY_NAME org.kde.kgpg_general)
ecm_qt_declare_logging_category(kgpg_SRCS HEADER kgpg_transactions_debug.h IDENTIFIER KGPG_LOG_TRANSACTIONS CATEGORY_NAME org.kde.kgpg_transactions)
Laurent Montel's avatar
Laurent Montel committed
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
set(kgpg_HDRS
   caff.h
   caff_p.h
   conf_encryption.h
   detailedconsole.h
   foldercompressjob.h
   gpgproc.h
   groupedit.h
   keyexport.h
   keyinfodialog.h
   keyservers.h
   keysmanager.h
   keytreeview.h
   kgpg.h
   kgpgchangekey.h
   kgpgexternalactions.h
   kgpgfirstassistant.h
   kgpginterface.h
   kgpgkeygenerate.h
   kgpgoptions.h
   kgpgrevokewidget.h
   kgpgtextinterface.h
   klinebufferedprocess.h
   newkey.h
   selectexpirydate.h
   selectpublickeydialog.h
   selectsecretkey.h
   sourceselect.h
)

208
qt5_add_dbus_adaptor( kgpg_SRCS org.kde.kgpg.Key.xml keysmanager.h KeysManager)
Laurent Montel's avatar
Laurent Montel committed
209

210
qt5_add_dbus_interface(kgpg_SRCS org.kde.kgpg.Key.xml kgpg_interface )
211

Andrius Štikonas's avatar
Andrius Štikonas committed
212
ki18n_wrap_ui(kgpg_SRCS
Urs Wolfer's avatar
Urs Wolfer committed
213
214
215
216
217
218
219
220
221
222
    adduid.ui
    conf_gpg.ui
    searchres.ui
    groupedit.ui
    conf_ui2.ui
    conf_servers.ui
    conf_misc.ui
    newkey.ui
    keyexport.ui
    conf_encryption.ui
223
    kgpgKeyInfo.ui
224
    kgpgkeygenerate.ui
Urs Wolfer's avatar
Urs Wolfer committed
225
226
227
228
229
    kgpgrevokewidget.ui
    keyserver.ui
    conf_decryption.ui
    sourceselect.ui
)
Laurent Montel's avatar
Laurent Montel committed
230

231
232
file(GLOB ICONS_SRCS "${CMAKE_CURRENT_SOURCE_DIR}/*-apps-kgpg.png")
ecm_add_app_icon(kgpg_SRCS ICONS ${ICONS_SRCS})
233

Andrius Štikonas's avatar
Andrius Štikonas committed
234
kconfig_add_kcfg_files(kgpg_SRCS kgpgsettings.kcfgc )
Laurent Montel's avatar
Laurent Montel committed
235

Kavinda Pitiduwa Gamage's avatar
Kavinda Pitiduwa Gamage committed
236
237
238
add_library(kgpg_lib STATIC ${kgpg_SRCS} ${kgpg_HDRS})
add_executable(kgpg main.cpp)
target_link_libraries(kgpg kgpg_lib)
Laurent Montel's avatar
Laurent Montel committed
239

240
if (KGPG_DEBUG_TRANSACTIONS)
241
	set_property(SOURCE ${kgpg_transaction_SRCS} APPEND PROPERTY COMPILE_DEFINITIONS "KGPG_DEBUG_TRANSACTIONS")
242
endif ()
243

244
set_property(SOURCE main.cpp APPEND PROPERTY COMPILE_DEFINITIONS "KGPG_VERSION=\"${RELEASE_SERVICE_VERSION}\"")
245

Kavinda Pitiduwa Gamage's avatar
Kavinda Pitiduwa Gamage committed
246
target_link_libraries(kgpg_lib
247
    KF5::AkonadiContact
Andrius Štikonas's avatar
Andrius Štikonas committed
248
249
250
    KF5::Archive
    KF5::Codecs
    KF5::Contacts
251
    KF5::CoreAddons
Andrius Štikonas's avatar
Andrius Štikonas committed
252
    KF5::Crash
253
    KF5::DBusAddons
254
    KF5::I18n
255
    KF5::IconThemes
256
    KF5::JobWidgets
Andrius Štikonas's avatar
Andrius Štikonas committed
257
    KF5::KIOCore
258
259
    KF5::KIOFileWidgets
    KF5::KIOWidgets
260
    KF5::Notifications
261
    KF5::Service
Andrius Štikonas's avatar
Andrius Štikonas committed
262
    KF5::TextWidgets
263
    KF5::XmlGui
264
    KF5::WidgetsAddons
265
266
    KF5::WindowSystem
    Qt5::PrintSupport
267
)
Laurent Montel's avatar
Laurent Montel committed
268

269
270
271
272
if(BUILD_TESTING)
  add_subdirectory(tests)
endif()

273
install(TARGETS kgpg  ${INSTALL_TARGETS_DEFAULT_ARGS} )
Laurent Montel's avatar
Laurent Montel committed
274
275
276

########### install files ###############

277
278
install( FILES editor/kgpgeditor.rc keysmanager.rc DESTINATION ${KXMLGUI_INSTALL_DIR}/kgpg)
install( FILES tips  DESTINATION ${DATA_INSTALL_DIR}/kgpg)
279
install( PROGRAMS org.kde.kgpg.desktop  DESTINATION ${XDG_APPS_INSTALL_DIR})
280
install( FILES org.kde.kgpg.appdata.xml  DESTINATION ${KDE_INSTALL_METAINFODIR})
281
install( FILES kgpg.kcfg  DESTINATION ${KCFG_INSTALL_DIR})
282
install( FILES org.kde.kgpg.desktop  DESTINATION ${AUTOSTART_INSTALL_DIR} )
283
install( FILES encryptfile.desktop encryptfolder.desktop viewdecrypted.desktop DESTINATION
284
${SERVICES_INSTALL_DIR}/ServiceMenus)
285
install( FILES org.kde.kgpg.Key.xml DESTINATION ${DBUS_INTERFACES_INSTALL_DIR})
Laurent Montel's avatar
Laurent Montel committed
286

287
288
289
290
291
ecm_install_icons(ICONS
    16-apps-kgpg.png
    22-apps-kgpg.png
    32-apps-kgpg.png
    48-apps-kgpg.png
292
293
294
    64-apps-kgpg.png
    128-apps-kgpg.png
    sc-apps-kgpg.svg
295
296
297
    DESTINATION ${KDE_INSTALL_ICONDIR}
    THEME hicolor
)
Andrius Štikonas's avatar
Andrius Štikonas committed
298

299
300
if (ECM_VERSION VERSION_GREATER "5.58.0")
    install(FILES kgpg.categories DESTINATION ${KDE_INSTALL_LOGGINGCATEGORIESDIR})
301
else()
302
    install(FILES kgpg.categories DESTINATION ${KDE_INSTALL_CONFDIR})
303
endif()
Laurent Montel's avatar
Laurent Montel committed
304
305


Andrius Štikonas's avatar
Andrius Štikonas committed
306
feature_summary(WHAT ALL INCLUDE_QUIET_PACKAGES FATAL_ON_MISSING_REQUIRED_PACKAGES)