-
Notifications
You must be signed in to change notification settings - Fork 56
/
CMakeLists.txt
378 lines (326 loc) · 11.6 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
289
290
291
292
293
294
295
296
297
298
299
300
301
302
303
304
305
306
307
308
309
310
311
312
313
314
315
316
317
318
319
320
321
322
323
324
325
326
327
328
329
330
331
332
333
334
335
336
337
338
339
340
341
342
343
344
345
346
347
348
349
350
351
352
353
354
355
356
357
358
359
360
361
362
363
364
365
366
367
368
369
370
371
372
373
374
375
376
377
378
cmake_minimum_required(VERSION 3.13.4)
project(dde-session-shell C CXX)
set(CMAKE_CXX_STANDARD 14)
set(CMAKE_INCLUDE_CURRENT_DIR ON)
set(CMAKE_AUTOMOC ON)
set(CMAKE_AUTORCC ON)
SET(CMAKE_CXX_FLAGS "${CMAKE_CXX_FLAGS} -g -Wall -pthread -Wl,--as-need -Wl,-E")
SET(CMAKE_CXX_FLAGS_DEBUG "${CMAKE_CXX_FLAGS} -O0 -ggdb")
SET(CMAKE_CXX_FLAGS_RELEASE "${CMAKE_CXX_FLAGS} -O3")
set(CMAKE_MODULE_PATH ${CMAKE_SOURCE_DIR}/cmake/modules)
# 增加安全编译参数
set(SECURITY_COMPILE, "-fstack-protector-all -fPIC")
set(CMAKE_CXX_FLAGS, "${CMAKE_CXX_FLAGS} ${SECURITY_COMPILE}")
set(CMAKE_C_FLAGS, "${CMAKE_C_FLAGS} ${SECURITY_COMPILE}")
# coverage option
# cmake -DENABLE_COVERAGE=ON ..
OPTION (ENABLE_COVERAGE "Use gcov" OFF)
option (CONTRAST_BACKGROUND "Fill background using high-contrast color for debug" OFF)
MESSAGE(STATUS ENABLE_COVERAGE=${ENABLE_COVERAGE})
if (ENABLE_COVERAGE)
SET(CMAKE_CXX_FLAGS "${CMAKE_CXX_FLAGS} -fprofile-arcs -ftest-coverage")
SET(CMAKE_C_FLAGS "${CMAKE_C_FLAGS} -fprofile-arcs -ftest-coverage")
#SET(CMAKE_EXE_LINKER_FLAGS "${CMAKE_EXE_LINKER_FLAGS} -fprofile-arcs -ftest-coverage")
endif()
if (${CMAKE_SYSTEM_PROCESSOR} MATCHES "mips64")
set(CMAKE_CXX_FLAGS "${CMAKE_CXX_FLAGS} -O3 -ftree-vectorize -march=loongson3a -mhard-float -mno-micromips -mno-mips16 -flax-vector-conversions -mloongson-ext2 -mloongson-mmi")
endif()
if (NOT (${CMAKE_BUILD_TYPE} MATCHES "Debug"))
set(CMAKE_CXX_FLAGS "${CMAKE_CXX_FLAGS} -Ofast")
# generate qm
execute_process(COMMAND bash "translate_generation.sh"
WORKING_DIRECTORY ${CMAKE_SOURCE_DIR})
endif ()
if (CMAKE_INSTALL_PREFIX_INITIALIZED_TO_DEFAULT)
set(CMAKE_INSTALL_PREFIX /usr)
endif ()
include(GNUInstallDirs)
# Find the library
find_package(PAM REQUIRED)
find_package(PkgConfig REQUIRED)
find_package(DtkWidget REQUIRED)
find_package(DtkCMake REQUIRED)
find_package(DtkCore REQUIRED)
find_package(Qt5 COMPONENTS
Core
Widgets
Concurrent
X11Extras
DBus
Xml
Svg
Network
REQUIRED)
find_package(DtkTools REQUIRED)
pkg_check_modules(XCB_EWMH REQUIRED xcb-ewmh x11 xi xcursor xfixes xrandr xext xtst)
pkg_check_modules(QGSettings REQUIRED gsettings-qt)
pkg_check_modules(Greeter REQUIRED liblightdm-qt5-3)
set(Qt_LIBS
Qt5::Core
Qt5::Gui
Qt5::DBus
Qt5::Widgets
Qt5::X11Extras
Qt5::Xml
Qt5::Svg
)
set(XML2CPP_DIR ${PROJECT_SOURCE_DIR}/src/global_util/dbus)
function(generation_dbus_interface xml class_name class_file)
execute_process(COMMAND ${DTK_XML2CPP} -c ${class_name} -p ${class_file} ${xml}
WORKING_DIRECTORY ${XML2CPP_DIR})
endfunction(generation_dbus_interface)
generation_dbus_interface(
${CMAKE_SOURCE_DIR}/xml/org.deepin.dde.Authenticate1.xml
Authenticate
${XML2CPP_DIR}/authenticate_interface
)
generation_dbus_interface(
${CMAKE_SOURCE_DIR}/xml/com.huawei.switchos.xml
HuaWeiSwitchOS
${XML2CPP_DIR}/huaweiswitchos_interface
)
generation_dbus_interface(
${CMAKE_SOURCE_DIR}/xml/org.deepin.dde.Accounts1.xml
Accounts
${XML2CPP_DIR}/accounts_interface
)
generation_dbus_interface(
${CMAKE_SOURCE_DIR}/xml/org.deepin.dde.Accounts1.User.xml
AccountsUser
${XML2CPP_DIR}/accountsuser_interface
)
generation_dbus_interface(
${CMAKE_SOURCE_DIR}/xml/org.deepin.dde.ImageEffect1.xml
ImageEffect
${XML2CPP_DIR}/imageeffect_interface
)
generation_dbus_interface(
${CMAKE_SOURCE_DIR}/xml/org.deepin.dde.Logined.xml
Logined
${XML2CPP_DIR}/logined_interface
)
generation_dbus_interface(
${CMAKE_SOURCE_DIR}/xml/org.deepin.dde.PowerManager1.xml
PowerManager
${XML2CPP_DIR}/powermanager_interface
)
generation_dbus_interface(
${CMAKE_SOURCE_DIR}/xml/org.deepin.dde.SystemPower1.xml
SystemPower
${XML2CPP_DIR}/systempower_interface
)
generation_dbus_interface(
${CMAKE_SOURCE_DIR}/xml/com.deepin.wm.xml
wm
${XML2CPP_DIR}/wm_interface
)
generation_dbus_interface(
${CMAKE_SOURCE_DIR}/xml/org.deepin.dde.Authenticate1.Session2.xml
AuthenticateSession2
${XML2CPP_DIR}/authenticatesession2_interface
)
generation_dbus_interface(
${CMAKE_SOURCE_DIR}/xml/org.deepin.dde.SessionManager1.xml
SessionManager
${XML2CPP_DIR}/sessionmanager_interface
)
generation_dbus_interface(
${CMAKE_SOURCE_DIR}/xml/org.deepin.dde.SoundThemePlayer1.xml
SoundThemePlayer
${XML2CPP_DIR}/soundthemeplayer_interface
)
generation_dbus_interface(
${CMAKE_SOURCE_DIR}/xml/org.deepin.dde.SystemDisplay1.xml
SystemDisplay
${XML2CPP_DIR}/systemdisplay_interface
)
generation_dbus_interface(
${CMAKE_SOURCE_DIR}/xml/org.freedesktop.DBus.xml
FreedesktopDBus
${XML2CPP_DIR}/freedesktopdbus_interface
)
generation_dbus_interface(
${CMAKE_SOURCE_DIR}/xml/org.freedesktop.login1.session.self.xml
Login1SessionSelf
${XML2CPP_DIR}/login1sessionself_interface
)
include_directories(${PROJECT_SOURCE_DIR}/src/global_util)
include_directories(${PROJECT_SOURCE_DIR}/src/global_util/dbus)
include_directories(${PROJECT_SOURCE_DIR}/src/global_util/keyboardmonitor)
include_directories(${PROJECT_SOURCE_DIR}/src/widgets)
include_directories(${PROJECT_SOURCE_DIR}/src/session-widgets)
include_directories(${PROJECT_SOURCE_DIR}/src/libdde-auth)
include_directories(${PROJECT_SOURCE_DIR}/interface)
include_directories(${PROJECT_SOURCE_DIR}/src/global_util/dbus/types)
include_directories(${DTKCORE_INCLUDE_DIRS})
aux_source_directory(${PROJECT_SOURCE_DIR}/src/global_util GLOBAL_UTILS)
aux_source_directory(${PROJECT_SOURCE_DIR}/src/global_util/dbus GLOBAL_UTILS_DBUS)
aux_source_directory(${PROJECT_SOURCE_DIR}/src/global_util/keyboardmonitor GLOBAL_UTILS_KEYBOARDMONITOR)
aux_source_directory(${PROJECT_SOURCE_DIR}/src/widgets WIDGETS)
aux_source_directory(${PROJECT_SOURCE_DIR}/src/session-widgets SESSION_WIDGETS)
aux_source_directory(${PROJECT_SOURCE_DIR}/src/libdde-auth AUTHENTICATE)
aux_source_directory(${PROJECT_SOURCE_DIR}/interface INTERFACE)
aux_source_directory(${PROJECT_SOURCE_DIR}/src/global_util/dbus/types DBUS_DATA_TYPES)
set(QRCS
${CMAKE_CURRENT_SOURCE_DIR}/resources.qrc
${PROJECT_SOURCE_DIR}/src/widgets/widgetsimages.qrc
${PROJECT_SOURCE_DIR}/src/widgets/widgetstheme.qrc
)
set(LOCK_SRCS
${transaction_DBUS_SCRS}
${GLOBAL_UTILS}
${GLOBAL_UTILS_DBUS}
${GLOBAL_UTILS_KEYBOARDMONITOR}
${WIDGETS}
${SESSION_WIDGETS}
${AUTHENTICATE}
${INTERFACE}
${QT_DBUS_EXTENDED}
${DBUS_DATA_TYPES}
src/app/dde-lock.cpp
src/dde-lock/lockframe.cpp
src/dde-lock/lockworker.cpp
src/dde-lock/dbus/dbuslockagent.cpp
src/dde-lock/dbus/dbuslockfrontservice.cpp
src/dde-lock/dbus/dbusshutdownagent.cpp
src/dde-lock/dbus/dbusshutdownfrontservice.cpp
)
add_executable(dde-lock
${LOCK_SRCS}
${QRCS}
)
target_include_directories(dde-lock PUBLIC
${PAM_INCLUDE_DIR}
${DTKWIDGET_INCLUDE_DIR}
${DTKCORE_INCLUDE_DIR}
${XCB_EWMH_INCLUDE_DIRS}
${Qt5Gui_PRIVATE_INCLUDE_DIRS}
${PROJECT_BINARY_DIR}
${QGSettings_INCLUDE_DIRS}
${Qt5X11Extras_INCLUDE_DIRS}
${PROJECT_SOURCE_DIR}/src/dde-lock
${PROJECT_SOURCE_DIR}/src/dde-lock/dbus
${Greeter_INCLUDE_DIRS}
)
target_link_libraries(dde-lock PRIVATE
${Qt_LIBS}
${PAM_LIBRARIES}
${XCB_EWMH_LIBRARIES}
${DtkWidget_LIBRARIES}
${DtkCore_LIBRARIES}
${Qt5Widgets_LIBRARIES}
${Qt5Concurrent_LIBRARIES}
${Qt5X11Extras_LIBRARIES}
${Qt5DBus_LIBRARIES}
${Qt5Network_LIBRARIES}
${QGSettings_LIBRARIES}
${Greeter_LIBRARIES}
${DEEPIN_PW_CHECK}
)
set(DEEPIN_PW_CHECK libdeepin_pw_check.so)
set(GREETER_SRCS
${transaction_DBUS_SCRS}
${GLOBAL_UTILS}
${GLOBAL_UTILS_DBUS}
${GLOBAL_UTILS_KEYBOARDMONITOR}
${WIDGETS}
${SESSION_WIDGETS}
${AUTHENTICATE}
${INTERFACE}
${DBUS_DATA_TYPES}
src/app/lightdm-deepin-greeter.cpp
src/lightdm-deepin-greeter/loginframe.cpp
src/lightdm-deepin-greeter/greeterworker.cpp
src/lightdm-deepin-greeter/logincontent.cpp
src/lightdm-deepin-greeter/logintipswindow.cpp
src/lightdm-deepin-greeter/pwqualitymanager.cpp
src/lightdm-deepin-greeter/passwordlevelwidget.cpp
src/lightdm-deepin-greeter/changepasswordwidget.cpp
)
add_executable(lightdm-deepin-greeter
${GREETER_SRCS}
${QRCS}
)
target_include_directories(lightdm-deepin-greeter PUBLIC
${PAM_INCLUDE_DIR}
${DTKWIDGET_INCLUDE_DIR}
${DTKCORE_INCLUDE_DIR}
${XCB_EWMH_INCLUDE_DIRS}
${Qt5Gui_PRIVATE_INCLUDE_DIRS}
${PROJECT_BINARY_DIR}
${QGSettings_INCLUDE_DIRS}
${Qt5X11Extras_INCLUDE_DIRS}
${Greeter_INCLUDE_DIRS}
${PROJECT_SOURCE_DIR}/src/lightdm-deepin-greeter
)
target_compile_definitions(lightdm-deepin-greeter
PRIVATE ENABLE_SESSION
)
if (WAIT_DEEPIN_ACCOUNTS_SERVICE)
target_compile_definitions(lightdm-deepin-greeter
PUBLIC ENABLE_WAITING_ACCOUNTS_SERVICE
)
endif()
target_link_libraries(lightdm-deepin-greeter PRIVATE
${Qt_LIBS}
${PAM_LIBRARIES}
${XCB_EWMH_LIBRARIES}
${DtkWidget_LIBRARIES}
${DtkCore_LIBRARIES}
${Qt5Widgets_LIBRARIES}
${Qt5Concurrent_LIBRARIES}
${Qt5X11Extras_LIBRARIES}
${Qt5DBus_LIBRARIES}
${Qt5Network_LIBRARIES}
${QGSettings_LIBRARIES}
${Greeter_LIBRARIES}
${DEEPIN_PW_CHECK}
)
if(CONTRAST_BACKGROUND)
target_compile_definitions(dde-lock PRIVATE CONTRAST_BACKGROUND)
target_compile_definitions(lightdm-deepin-greeter PRIVATE CONTRAST_BACKGROUND)
endif()
# plugins
add_subdirectory(modules)
add_subdirectory(tests)
if(NOT DSS_CHECK_ACCESSIBILITY)
set_source_files_properties(${PROJECT_SOURCE_DIR}/src/global_util/accessibilitycheckerex.h
TARGET_DIRECTORY dde-lock dde-lock-test lightdm-deepin-greeter lightdm-deepin-greeter-test
PROPERTIES SKIP_AUTOMOC ON)
else()
add_compile_definitions(-DDSS_CHECK_ACCESSIBILITY)
endif()
# bin
install(TARGETS dde-lock lightdm-deepin-greeter DESTINATION ${CMAKE_INSTALL_BINDIR})
install(FILES files/deepin-greeter DESTINATION ${CMAKE_INSTALL_BINDIR})
file(GLOB SCRIPTS scripts/*)
install(PROGRAMS ${SCRIPTS} DESTINATION ${CMAKE_INSTALL_SYSCONFDIR}/deepin/greeters.d)
file(GLOB QM_FILES "translations/*.qm")
install(FILES ${QM_FILES} DESTINATION ${CMAKE_INSTALL_DATADIR}/dde-session-shell/translations)
install(FILES qt-theme.ini DESTINATION ${CMAKE_INSTALL_SYSCONFDIR}/lightdm/deepin)
install(FILES files/lightdm-deepin-greeter.desktop DESTINATION ${CMAKE_INSTALL_DATADIR}/xgreeters/)
install(FILES files/dde-lock.desktop DESTINATION ${CMAKE_INSTALL_DATADIR}/applications/)
install(FILES files/dde-session-shell.conf DESTINATION ${CMAKE_INSTALL_DATADIR}/dde-session-shell/)
install(FILES files/lightdm-deepin-greeter.conf DESTINATION ${CMAKE_INSTALL_DATADIR}/deepin-authentication/privileges/)
# services
file(GLOB SERVICES files/*.service)
install(FILES ${SERVICES} DESTINATION ${CMAKE_INSTALL_DATADIR}/dbus-1/services)
#schemas
install(FILES xml/com.deepin.dde.session-shell.gschema.xml DESTINATION ${CMAKE_INSTALL_DATADIR}/glib-2.0/schemas)
# dev
file(GLOB INTERFACE interface/*.h)
install(FILES ${INTERFACE} DESTINATION ${CMAKE_INSTALL_INCLUDEDIR}/dde-session-shell)
file(GLOB CMAKE_CONFIG cmake/*.cmake)
install(FILES ${CMAKE_CONFIG} DESTINATION ${CMAKE_INSTALL_LIBDIR}/cmake/DdeSessionShell)
configure_file(
${CMAKE_SOURCE_DIR}/cmake/DdeSessionShellConfig.cmake.in
${CMAKE_CURRENT_BINARY_DIR}/DdeSessionShellConfig.cmake
@ONLY)
install(FILES ${CMAKE_CURRENT_BINARY_DIR}/DdeSessionShellConfig.cmake
DESTINATION ${CMAKE_INSTALL_LIBDIR}/cmake/DdeSessionShell)
# pam
file(GLOB PAM_CONFIG files/pam.d/*)
install(FILES ${PAM_CONFIG} DESTINATION ${CMAKE_INSTALL_SYSCONFDIR}/pam.d/)
# config
dconfig_meta_files(APPID org.deepin.dde.lock FILES configs/org.deepin.dde.lock.json)
dconfig_meta_files(APPID org.deepin.dde.lightdm-deepin-greeter FILES configs/org.deepin.dde.lightdm-deepin-greeter.json)