forked from mhogomchungu/qCheckGMail
-
Notifications
You must be signed in to change notification settings - Fork 0
/
CMakeLists.txt
288 lines (227 loc) · 10.5 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
219
220
221
222
223
224
225
226
227
228
229
230
231
232
233
234
235
236
237
238
239
240
241
242
243
244
245
246
247
248
249
250
251
252
253
254
255
256
257
258
259
260
261
262
263
264
265
266
267
268
269
270
271
272
273
274
275
276
277
278
279
280
281
282
283
284
285
286
287
288
cmake_minimum_required(VERSION 3.0.0)
set_property(GLOBAL PROPERTY ALLOW_DUPLICATE_CUSTOM_TARGETS ON)
project(qCheckGMail)
INCLUDE(GNUInstallDirs)
if( "${DATA_INSTALL_DIR}" STREQUAL "" )
set( DATA_INSTALL_DIR "${CMAKE_INSTALL_PREFIX}/share/" )
endif()
INCLUDE(CMakeDependentOption)
INCLUDE(FindPkgConfig)
# uninstall target
configure_file(
"${CMAKE_CURRENT_SOURCE_DIR}/cmake_uninstall.cmake.in"
"${CMAKE_CURRENT_BINARY_DIR}/cmake_uninstall.cmake"
IMMEDIATE @ONLY )
add_custom_target( uninstall
COMMAND ${CMAKE_COMMAND} -P ${CMAKE_CURRENT_BINARY_DIR}/cmake_uninstall.cmake )
INCLUDE(GNUInstallDirs)
set( PGR_VERSION "Version:\t2.2.0" )
set( COPYRIGHT_YEARS "Copyright:\t2013-2022" )
set( LICENSE "License:\tGPLv2+" )
file(WRITE ${PROJECT_BINARY_DIR}/version.h
"
#define VERSION \"${PGR_VERSION}\"
#define COPYRIGHT \"${COPYRIGHT_YEARS}\"
#define LICENCE \"${LICENSE}\"
")
set( QT5 "true" )
if( INTERNAL_LXQT_WALLET )
message( STATUS "---------------------------------------------------------------------------" )
message( STATUS "lxqt wallet support will be provided by an internal library" )
message( STATUS "---------------------------------------------------------------------------" )
ADD_SUBDIRECTORY( src/3rdParty/lxqt_wallet )
include_directories( src/3rdParty/lxqt_wallet/frontend )
else()
pkg_check_modules( LXQT_WALLET lxqt-wallet )
if( NOT LXQT_WALLET_FOUND )
message( STATUS "ERROR: could not find lxqt_wallet package" )
message( STATUS "---------------------------------------------------------------------------" )
message( STATUS "lxqt wallet support will be provided by an internal library" )
message( STATUS "---------------------------------------------------------------------------" )
ADD_SUBDIRECTORY( src/3rdParty/lxqt_wallet )
include_directories( src/3rdParty/lxqt_wallet/frontend )
else()
if( LXQT_WALLET_VERSION VERSION_GREATER "3.1.0" )
include_directories( ${LXQT_WALLET_INCLUDEDIR} )
link_directories( ${LXQT_WALLET_LIBDIR} )
message( STATUS "---------------------------------------------------------------------------" )
message( STATUS "lxqt wallet support will be provided by an external libary" )
message( STATUS "---------------------------------------------------------------------------" )
else()
message( STATUS "---------------------------------------------------------------------------" )
message( STATUS "lxqt wallet support will be provided by an internal library" )
message( STATUS "because external library is too old(< 3.2.0)" )
message( STATUS "\nPlease install a more receant version from: https://github.com/lxqt/lxqt_wallet
message" )
message( STATUS "---------------------------------------------------------------------------" )
ADD_SUBDIRECTORY( src/3rdParty/lxqt_wallet )
include_directories( src/3rdParty/lxqt_wallet/frontend )
endif()
endif()
endif()
include_directories( ${CMAKE_BINARY_DIR} )
add_definitions( -Wno-unused-result -D_DEFAULT_SOURCE )
if (CMAKE_CXX_COMPILER_ID MATCHES "Clang")
add_definitions(-Qunused-arguments)
endif()
if( ${CMAKE_VERSION} VERSION_LESS "3.1.0" )
message("Warning your cmake version is too old(<3.1.0) and code my not compile")
add_definitions(-std=c++14)
endif()
add_definitions( -Wextra -Wall -pedantic -I${PROJECT_BINARY_DIR})
set( CMAKE_CXX_STANDARD 14 )
set( CMAKE_CXX_STANDARD_REQUIRED ON )
set(CMAKE_CXX_EXTENSIONS OFF)
file( WRITE "${PROJECT_BINARY_DIR}/audio_file_path.h"
"\n#define AUDIO_NOTIFY_FILE \"${DATA_INSTALL_DIR}/qCheckGMail/audio/new-email-sound.ogg\"\n"
)
file( WRITE "${PROJECT_BINARY_DIR}/icon_file_path.h"
"\n#define ICON_FILE_PATH \"${DATA_INSTALL_DIR}/icons/qCheckGMail-hasMail.svg\"\n"
)
install( FILES audio/new-email-sound.ogg DESTINATION "${DATA_INSTALL_DIR}/qCheckGMail/audio" )
install( FILES icons/qCheckGMail.svg DESTINATION ${DATA_INSTALL_DIR}/icons )
install( FILES icons/qCheckGMail-hasNoMail.svg DESTINATION ${DATA_INSTALL_DIR}/icons )
install( FILES icons/qCheckGMail-hasError.svg DESTINATION ${DATA_INSTALL_DIR}/icons )
install( FILES icons/qCheckGMail-hasMail.svg DESTINATION ${DATA_INSTALL_DIR}/icons )
install( FILES icons/qCheckGMail-paused.svg DESTINATION ${DATA_INSTALL_DIR}/icons )
#install( FILES translations.ts/translations.ts DESTINATION share/qCheckGMail/translations.ts/ )
#install( FILES translations.ts/greek_GR.ts DESTINATION share/qCheckGMail/translations.ts/ )
#install( FILES translations.ts/dutch_NL.ts DESTINATION share/qCheckGMail/translations.ts/ )
#install( FILES translations.ts/german_DE.ts DESTINATION share/qCheckGMail/translations.ts/ )
#install( FILES translations.ts/spanish_ES.ts DESTINATION share/qCheckGMail/translations.ts/ )
#install( FILES translations.ts/french_FR.ts DESTINATION share/qCheckGMail/translations.ts/ )
install( FILES translations.qm/greek_GR.qm DESTINATION "${DATA_INSTALL_DIR}/qCheckGMail/translations.qm/" )
install( FILES translations.qm/dutch_NL.qm DESTINATION "${DATA_INSTALL_DIR}/qCheckGMail/translations.qm/" )
install( FILES translations.qm/german_DE.qm DESTINATION "${DATA_INSTALL_DIR}/qCheckGMail/translations.qm/" )
install( FILES translations.qm/spanish_ES.qm DESTINATION "${DATA_INSTALL_DIR}/qCheckGMail/translations.qm/" )
install( FILES translations.qm/french_FR.qm DESTINATION "${DATA_INSTALL_DIR}/qCheckGMail/translations.qm/" )
install( FILES src/3rdParty/lxqt_wallet/translations.qm/german_DE.qm DESTINATION share/qCheckGMail/lxqt_wallet/translations.qm/ )
install( FILES src/3rdParty/lxqt_wallet/translations.qm/greek_GR.qm DESTINATION share/qCheckGMail/lxqt_wallet/translations.qm/ )
install( FILES src/3rdParty/lxqt_wallet/translations.qm/dutch_NL.qm DESTINATION share/qCheckGMail/lxqt_wallet/translations.qm/ )
install( FILES src/3rdParty/lxqt_wallet/translations.qm/french_FR.qm DESTINATION share/qCheckGMail/lxqt_wallet/translations.qm/ )
install( FILES src/3rdParty/lxqt_wallet/translations.qm/spanish_ES.qm DESTINATION share/qCheckGMail/lxqt_wallet/translations.qm/ )
file( WRITE "${PROJECT_BINARY_DIR}/language_path.h"
"\n#define LANGUAGE_FILE_PATH \"${DATA_INSTALL_DIR}/qCheckGMail/\""
)
find_package( Qt5Widgets REQUIRED )
find_package( Qt5Core REQUIRED )
find_package( Qt5Network REQUIRED )
find_package( Qt5DBus REQUIRED)
set( UI_FILES
src/gmailauthorization.ui
src/gmailauthorization.ui
src/walletmanager.ui
src/addaccount.ui
src/logwindow.ui
src/configurationoptionsdialog.ui
)
if (${Qt5Widgets_VERSION} VERSION_LESS "5.4.0")
set( MOC_FILES
src/statusicon.h
src/walletmanager.h
src/addaccount.h
src/qcheckgmail.h
src/configurationoptionsdialog.h
src/logwindow.h
src/util.hpp )
else()
set( MOC_FILES
src/statusicon.h
src/walletmanager.h
src/addaccount.h
src/qcheckgmail.h
src/logwindow.h
src/configurationoptionsdialog.h )
endif()
set( CPP_FILES
src/gmailauthorization.cpp
src/main.cpp
src/settings.cpp
src/qcheckgmail.cpp
src/accounts.cpp
src/statusicon.cpp
src/logwindow.cpp
src/walletmanager.cpp
src/addaccount.cpp
src/configurationoptionsdialog.cpp
)
set( RESOUCES icons/icon.qrc )
#find_package( ECM REQUIRED NO_MODULE )
#set(CMAKE_MODULE_PATH ${ECM_MODULE_PATH} )
set( CMAKE_INCLUDE_CURRENT_DIR ON )
include_directories( ${Qt5Widgets_INCLUDE_DIRS} )
include_directories( ${Qt5DBus_INCLUDE_DIRS} )
add_definitions( ${Qt5Widgets_DEFINITIONS} )
if( KF5 )
cmake_policy( SET CMP0012 NEW )
find_package( KF5Config REQUIRED )
find_package( KF5Notifications REQUIRED )
find_package( KF5CoreAddons )
find_package( KF5I18n NO_MODULE )
message( STATUS "\n------------------------------------------------------------------------------------------" )
message( STATUS "kde support found,will build KStatusNotifierItem based tray icon application" )
message( STATUS "---------------------------------------------------------------------------------------" )
file( WRITE "${PROJECT_BINARY_DIR}/tray_application_type.h" "\n#define KF5 1\n" )
QT5_WRAP_CPP( MOC ${MOC_FILES} )
QT5_WRAP_UI( UI ${UI_FILES} )
QT5_ADD_RESOURCES( TRAY_RC_SRCS ${RESOUCES} )
add_executable( qCheckGMail ${CPP_FILES} ${MOC} ${UI} ${TRAY_RC_SRCS} )
TARGET_LINK_LIBRARIES( qCheckGMail lxqt-wallet ${Qt5Widgets_LIBRARIES} ${Qt5Core_LIBRARIES} ${Qt5Network_LIBRARIES} KF5::Notifications KF5::CoreAddons )
else()
message( STATUS "\n-------------------------------------------------------------------------------------------" )
message( STATUS "kde support NOT found,will build QSystemTrayIcon based tray icon application" )
message( STATUS "----------------------------------------------------------------------------------------" )
file( WRITE "${PROJECT_BINARY_DIR}/tray_application_type.h" "\n#define KF5 0\n" )
QT5_WRAP_CPP( MOC ${MOC_FILES} )
QT5_WRAP_UI( UI ${UI_FILES} )
QT5_ADD_RESOURCES( TRAY_RC_SRCS ${RESOUCES} )
add_executable( qCheckGMail ${CPP_FILES} ${MOC} ${UI} ${TRAY_RC_SRCS} )
TARGET_LINK_LIBRARIES( qCheckGMail lxqt-wallet ${Qt5Widgets_LIBRARIES} ${Qt5Core_LIBRARIES} ${Qt5Network_LIBRARIES} ${Qt5DBus_LIBRARIES})
endif()
set_target_properties( qCheckGMail PROPERTIES COMPILE_FLAGS "-D_FILE_OFFSET_BITS=64 -Wextra -Wall -s -fPIE -pthread -pedantic " )
set_target_properties( qCheckGMail PROPERTIES LINK_FLAGS "-pie" )
set_target_properties( qCheckGMail PROPERTIES INSTALL_RPATH "${LIB_PATH}" )
install( TARGETS qCheckGMail RUNTIME DESTINATION bin )
install( FILES ${PROJECT_BINARY_DIR}/qCheckGMail.desktop DESTINATION share/applications
PERMISSIONS OWNER_READ OWNER_WRITE OWNER_EXECUTE GROUP_READ GROUP_EXECUTE WORLD_READ WORLD_EXECUTE
)
install( FILES ${PROJECT_BINARY_DIR}/qCheckGMail-autostart.desktop DESTINATION /etc/xdg/autostart/
PERMISSIONS OWNER_READ OWNER_WRITE OWNER_EXECUTE GROUP_READ GROUP_EXECUTE WORLD_READ WORLD_EXECUTE
)
#Icon=${CMAKE_INSTALL_PREFIX}/share/icons/qCheckGMail.svg
# desktop file section
file( WRITE "${PROJECT_BINARY_DIR}/qCheckGMail.desktop"
"[Desktop Entry]
Comment[en_US]=
Comment=
Exec=${CMAKE_INSTALL_PREFIX}/bin/qCheckGMail
GenericName[en_US]=a gmail new mail checker
GenericName=a gmail new mail checker
Icon=qCheckGMail
Name[en_US]=qCheckGMail
Name=qCheckGMail
NoDisplay=false
StartupNotify=true
Terminal=false
Type=Application
Categories=Network;Email;\n")
# desktop file section
file( WRITE "${PROJECT_BINARY_DIR}/qCheckGMail-autostart.desktop"
"#!/usr/bin/env xdg-open
[Desktop Entry]
Comment[en_US]=
Comment=
Exec=${CMAKE_INSTALL_PREFIX}/bin/qCheckGMail -a
GenericName[en_US]=a gmail new mail checker
GenericName=a gmail new mail checker
Icon=qCheckGMail
MimeType=
Name[en_US]=qCheckGMail
Name=qCheckGMail
NoDisplay=false
Path=
StartupNotify=true
Terminal=false
TerminalOptions=
Type=Application
Categories=Network;X-MandrivaLinux-Internet;\n")