-
Notifications
You must be signed in to change notification settings - Fork 8
/
CMakeLists.txt
579 lines (559 loc) · 14.4 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
379
380
381
382
383
384
385
386
387
388
389
390
391
392
393
394
395
396
397
398
399
400
401
402
403
404
405
406
407
408
409
410
411
412
413
414
415
416
417
418
419
420
421
422
423
424
425
426
427
428
429
430
431
432
433
434
435
436
437
438
439
440
441
442
443
444
445
446
447
448
449
450
451
452
453
454
455
456
457
458
459
460
461
462
463
464
465
466
467
468
469
470
471
472
473
474
475
476
477
478
479
480
481
482
483
484
485
486
487
488
489
490
491
492
493
494
495
496
497
498
499
500
501
502
503
504
505
506
507
508
509
510
511
512
513
514
515
516
517
518
519
520
521
522
523
524
525
526
527
528
529
530
531
532
533
534
535
536
537
538
539
540
541
542
543
544
545
546
547
548
549
550
551
552
553
554
555
556
557
558
559
560
561
562
563
564
565
566
567
568
569
570
571
572
573
574
575
576
577
578
579
#
# Draco Desktop Environment <https://dracolinux.org>
# Copyright (c) 2019, Ole-André Rodlie <[email protected]>
# All rights reserved.
#
# This program is free software; you can redistribute it and/or modify
# it under the terms of the GNU General Public License as published by
# the Free Software Foundation; either version 2 of the License, or
# (at your option) any later version.
#
# This program is distributed in the hope that it will be useful,
# but WITHOUT ANY WARRANTY; without even the implied warranty of
# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
# GNU General Public License for more details.
#
# You should have received a copy of the GNU General Public License
# along with this program. If not, see <http://www.gnu.org/licenses/>
#
cmake_minimum_required(VERSION 3.0)
include(GNUInstallDirs)
project(draco VERSION 0.9.1)
#set(PROJECT_VERSION_EXTRA)
set(CMAKE_CXX_STANDARD 11)
set(CMAKE_AUTOMOC ON)
set(CMAKE_AUTORCC ON)
set(CMAKE_AUTOUIC ON)
set(CMAKE_MODULE_PATH ${CMAKE_MODULE_PATH} "${CMAKE_SOURCE_DIR}/share/cmake")
include_directories(${CMAKE_BINARY_DIR})
set(LIB_NAME Draco)
set(PUBLISHER dracolinux)
set(DOMAIN org.${PUBLISHER})
set(XDG_OPEN ${DOMAIN}.XDG)
set(POWER_SERVICE_NAME ${DOMAIN}.Power)
set(POWERD_SERVICE_NAME ${DOMAIN}.Powerd)
set(STORAGE_SERVICE_NAME ${DOMAIN}.Storage)
set(DESKTOP_SERVICE_NAME ${DOMAIN}.Desktop)
set(SETTINGS_SERVICE_NAME ${DOMAIN}.Settings)
set(
POWERD_SERVICE_USER
"root"
CACHE
STRING
"Run powerd service as this user (needs access to /sys)."
)
set(
POWERD_SERVICE_GROUP
"power"
CACHE
STRING
"group that have access to powerd service, this should be all desktop users."
)
add_definitions(-DDESKTOP_APP="${PROJECT_NAME}")
add_definitions(-DDESKTOP_APP_NAME="${LIB_NAME}")
add_definitions(-DDESKTOP_APP_DOMAIN="${DOMAIN}")
add_definitions(-DDESKTOP_APP_VERSION="${PROJECT_VERSION}")
add_definitions(-DDESKTOP_APP_VERSION_EXTRA="${PROJECT_VERSION_EXTRA}")
add_definitions(-DDESKTOP_SERVICE_NAME="${DESKTOP_SERVICE_NAME}")
add_definitions(-DSETTINGS_SERVICE_NAME="${SETTINGS_SERVICE_NAME}")
add_definitions(-DPOWER_SERVICE_NAME="${POWER_SERVICE_NAME}")
add_definitions(-DPOWERD_SERVICE_NAME="${POWERD_SERVICE_NAME}")
add_definitions(-DSTORAGE_SERVICE_NAME="${STORAGE_SERVICE_NAME}")
add_definitions(-DDAEMON_APP_NAME="${PUBLISHER}.Powerd")
add_definitions(-DPUBLISHER="${PUBLISHER}")
add_definitions(-DXDG_OPEN="${XDG_OPEN}")
if(CMAKE_BUILD_TYPE MATCHES "^(release|Release|RELEASE)$")
add_definitions(-DQT_NO_DEBUG_OUTPUT)
else()
add_definitions(-DQT_MESSAGELOGCONTEXT)
message("-- DRACO DEBUG BUILD")
endif()
add_compile_options(-Wall -Wextra)
# qt
find_package(Qt5 REQUIRED Core DBus Gui Widgets Concurrent X11Extras)
# x11
find_package(X11 REQUIRED)
find_package(XCB REQUIRED)
if(NOT XCB_FOUND)
message(FATAL_ERROR "xcb(-*) not found")
endif()
if(NOT X11_Xrandr_FOUND)
message(FATAL_ERROR "libXrandr not found")
endif()
if(NOT X11_Xdamage_FOUND)
message(FATAL_ERROR "libXdamage not found")
endif()
if(NOT X11_Xfixes_FOUND)
message(FATAL_ERROR "libXfixes not found")
endif()
if(${CMAKE_VERSION} VERSION_LESS "3.14.3")
if(NOT X11_Xscreensaver_FOUND)
message(FATAL_ERROR "libXScrnSaver not found")
endif()
else()
if(NOT X11_Xss_FOUND)
message(FATAL_ERROR "libXScrnSaver not found")
endif()
endif()
# libDraco
add_library(
${LIB_NAME}
SHARED
src/lib/draco.cpp
src/lib/power_def.h
src/lib/org.dracolinux.Disks.cpp
src/lib/org.dracolinux.Power.Client.cpp
src/lib/org.dracolinux.Power.Device.cpp
src/lib/org.dracolinux.Power.HotPlugX11.cpp
src/lib/org.dracolinux.Power.Manager.cpp
src/lib/org.dracolinux.Power.ScreenX11.cpp
src/lib/org.dracolinux.Power.Settings.cpp
src/lib/org.dracolinux.Powerd.Manager.Backlight.cpp
src/lib/org.dracolinux.Powerd.Manager.CPU.cpp
src/lib/org.dracolinux.Powerd.Manager.RTC.cpp
src/lib/org.dracolinux.Powerd.Manager.cpp
src/lib/org.freedesktop.PowerManagement.cpp
src/lib/org.freedesktop.ScreenSaver.cpp
src/lib/org.freedesktop.UDisks2.cpp
src/lib/hotkey/qhotkey.cpp
src/lib/hotkey/qhotkey_x11.cpp
src/lib/hotkey/qhotkey_p.h
src/lib/lumina/DesktopSettings.cpp
src/lib/lumina/LDesktopUtils.cpp
src/lib/lumina/LIconCache.cpp
src/lib/lumina/LUtils.cpp
src/lib/lumina/LuminaRandR-X11.cpp
src/lib/lumina/LuminaX11.cpp
src/lib/lumina/LuminaXDG.cpp
src/lib/lumina/LFileInfo.cpp
src/lib/lumina/ResizeMenu.cpp
src/lib/lumina/XDGMime.cpp
src/lib/keyboard_common.h
src/lib/qtcopydialog/qtcopydialog.cpp
src/lib/qtcopydialog/qtfilecopier.cpp
src/lib/qtcopydialog/qtcopydialog.ui
src/lib/qtcopydialog/qtoverwritedialog.ui
src/lib/qtcopydialog/qtotherdialog.ui
share/share.qrc
)
set_target_properties(
${LIB_NAME}
PROPERTIES
VERSION
${PROJECT_VERSION}
)
set_target_properties(
${LIB_NAME}
PROPERTIES
SOVERSION
${PROJECT_VERSION_MAJOR}
)
target_include_directories(
${LIB_NAME}
PRIVATE
src/lib
src/lib/lumina
src/lib/qtcopydialog
src/lib/hotkey
)
if(${CMAKE_VERSION} VERSION_LESS "3.14.3")
set(XSS_INCLUDE ${X11_Xscreensaver_INCLUDE_PATH})
set(XSS_LIB ${X11_Xscreensaver_LIB})
else()
set(XSS_INCLUDE ${X11_Xss_INCLUDE_PATH})
set(XSS_LIB ${X11_Xss_LIB})
endif()
target_include_directories(
${LIB_NAME}
PUBLIC
src
${X11_X11_INCLUDE_PATH}
${XCB_INCLUDE_DIRS}
${X11_Xrandr_INCLUDE_PATH}
${X11_Xfixes_INCLUDE_PATH}
${XSS_INCLUDE}
${X11_Xdamage_INCLUDE}
)
target_link_libraries(
${LIB_NAME}
${X11_LIBRARIES}
${XCB_LIBRARIES}
${X11_Xrandr_LIB}
${X11_Xfixes_LIB}
${XSS_LIB}
${X11_Xdamage_LIB}
Qt5::Core
Qt5::DBus
Qt5::Gui
Qt5::Widgets
Qt5::Concurrent
Qt5::X11Extras
)
if(CMAKE_INSTALL_PREFIX_INITIALIZED_TO_DEFAULT)
set(LIB_INSTALL_DIR ${CMAKE_INSTALL_LIBDIR})
else()
set(LIB_INSTALL_DIR ${CMAKE_INSTALL_FULL_LIBDIR})
endif()
# org.dracolinux.Desktop
add_executable(
${DESKTOP_SERVICE_NAME}
src/desktop/main.cpp
src/desktop/LXcbEventFilter.cpp
src/desktop/LWinInfo.cpp
src/desktop/LSession.cpp
src/desktop/AppMenu.cpp
src/desktop/LDesktop.cpp
src/desktop/LDesktopBackground.cpp
src/desktop/LDesktopPluginSpace.cpp
src/desktop/LPanel.cpp
src/desktop/desktop-plugins/LDPlugin.cpp
src/desktop/desktop-plugins/NewDP.h
src/desktop/desktop-plugins/applauncher/AppLauncherPlugin.cpp
src/desktop/desktop-plugins/applauncher/AppLauncherPlugin.h
src/desktop/desktop-plugins/applauncher/OutlineToolButton.h
src/desktop/panel-plugins/LPPlugin.h
src/desktop/panel-plugins/NewPP.h
src/desktop/panel-plugins/LTBWidget.h
src/desktop/panel-plugins/taskmanager/LTaskManagerPlugin.cpp
src/desktop/panel-plugins/taskmanager/LTaskButton.cpp
src/desktop/panel-plugins/systemtray/LSysTray.cpp
src/desktop/panel-plugins/systemtray/TrayIcon.cpp
src/desktop/panel-plugins/clock/LClock.cpp
src/desktop/panel-plugins/desktopswitcher/LDesktopSwitcher.cpp
src/desktop/panel-plugins/showdesktop/LHomeButton.cpp
src/desktop/panel-plugins/appmenu/LAppMenuPlugin.cpp
src/desktop/panel-plugins/applauncher/AppLaunchButton.cpp
src/desktop/panel-plugins/spacer/LSpacer.h
src/desktop/panel-plugins/line/LLine.h
src/desktop/SystemWindow.cpp
src/desktop/SystemWindow.ui
src/desktop/desktop.qrc
)
target_include_directories(
${DESKTOP_SERVICE_NAME}
PRIVATE
src/desktop
src/lib
src/lib/lumina
src/lib/hotkey
src/lib/qtcopydialog
)
target_link_libraries(
${DESKTOP_SERVICE_NAME}
Qt5::Core
Qt5::DBus
Qt5::Gui
Qt5::Widgets
Qt5::Concurrent
Qt5::X11Extras
${LIB_NAME}
)
# org.dracolinux.Powerd
add_executable(
${POWERD_SERVICE_NAME}
src/power/${POWERD_SERVICE_NAME}.cpp
)
target_include_directories(
${POWERD_SERVICE_NAME}
PRIVATE
src/lib
)
target_link_libraries(
${POWERD_SERVICE_NAME}
Qt5::Core
Qt5::DBus
${LIB_NAME}
)
# org.dracolinux.Power
add_executable(
${POWER_SERVICE_NAME}
src/power/${POWER_SERVICE_NAME}.cpp
src/power/${POWER_SERVICE_NAME}.Tray.cpp
)
target_include_directories(
${POWER_SERVICE_NAME}
PRIVATE
src/lib
src/power
${XSS_INCLUDE}
)
target_link_libraries(
${POWER_SERVICE_NAME}
Qt5::Core
Qt5::DBus
Qt5::Gui
Qt5::Widgets
Qt5::X11Extras
${XSS_LIB}
${LIB_NAME}
)
# org.dracolinux.Storage
add_executable(
${STORAGE_SERVICE_NAME}
src/storage/${STORAGE_SERVICE_NAME}.cpp
src/storage/${STORAGE_SERVICE_NAME}.Tray.cpp
)
target_include_directories(
${STORAGE_SERVICE_NAME}
PRIVATE
src/lib
src/lib/lumina
)
target_link_libraries(
${STORAGE_SERVICE_NAME}
Qt5::Core
Qt5::DBus
Qt5::Gui
Qt5::Widgets
${LIB_NAME}
)
# org.dracolinux.XDG
add_executable(
${XDG_OPEN}
src/session/xdg.cpp
src/lib/lumina/AppDialog.h
src/lib/lumina/AppDialog.ui
src/desktop/logo.qrc
)
target_include_directories(
${XDG_OPEN}
PRIVATE
src/lib
src/lib/lumina
)
target_link_libraries(
${XDG_OPEN}
Qt5::Core
Qt5::Gui
Qt5::Widgets
${LIB_NAME}
)
# start-draco
add_executable(
start-${PROJECT_NAME}
src/session/main.cpp
src/session/session.cpp
)
target_include_directories(
start-${PROJECT_NAME}
PRIVATE
src/lib
src/lib/lumina
)
target_link_libraries(
start-${PROJECT_NAME}
Qt5::Core
Qt5::DBus
${LIB_NAME}
)
# draco-settings-x11
add_executable(
${PROJECT_NAME}-settings-x11
src/settings/xconf/main.cpp
src/settings/xconf/MainUI.cpp
src/settings/xconf/ScreenSettings.cpp
src/settings/xconf/MainUI.ui
)
target_include_directories(
${PROJECT_NAME}-settings-x11
PRIVATE
src/lib
src/lib/lumina
)
target_link_libraries(
${PROJECT_NAME}-settings-x11
Qt5::Core
Qt5::Gui
Qt5::Widgets
${LIB_NAME}
)
# draco-settings
add_executable(
${PROJECT_NAME}-settings
src/settings/config/GetPluginDialog.cpp
src/settings/config/LPlugins.cpp
src/settings/config/PanelWidget.cpp
src/settings/config/main.cpp
src/settings/config/mainWindow.cpp
src/settings/config/pages/PageWidget.h
src/settings/config/pages/getPage.cpp
src/settings/config/pages/getPage.h
src/settings/config/pages/page_keyboard.cpp
src/settings/config/pages/page_power.cpp
src/settings/config/pages/page_autostart.cpp
src/settings/config/pages/page_defaultapps.cpp
src/settings/config/pages/page_interface_panels.cpp
src/settings/config/pages/page_main.cpp
src/settings/config/pages/page_main.ui
#src/settings/config/pages/page_session_locale.cpp
src/settings/config/pages/page_session_options.cpp
src/settings/config/pages/page_wallpaper.cpp
src/lib/org.dracolinux.Power.SettingsWidget.cpp
src/lib/lumina/AppDialog.h
src/lib/lumina/AppDialog.ui
src/settings/config/pages/page_keyboard.ui
src/settings/config/pages/page_power.ui
src/settings/config/pages/page_autostart.ui
src/settings/config/pages/page_defaultapps.ui
src/settings/config/pages/page_interface_panels.ui
#src/settings/config/pages/pages/page_session_locale.ui
src/settings/config/pages/page_session_options.ui
src/settings/config/pages/page_wallpaper.ui
src/settings/config/GetPluginDialog.ui
src/settings/config/PanelWidget.ui
src/settings/config/mainWindow.ui
)
target_include_directories(
${PROJECT_NAME}-settings
PRIVATE
src/lib
src/lib/lumina
src/settings/config
src/settings/config/pages
)
target_link_libraries(
${PROJECT_NAME}-settings
Qt5::Core
Qt5::Gui
Qt5::Widgets
${LIB_NAME}
)
# docs
install(
FILES
docs/LICENSE
docs/COPYING
docs/COPYING.LIB
docs/ChangeLog.md
docs/README.md
DESTINATION
${CMAKE_INSTALL_DOCDIR}/${PROJECT_NAME}-${PROJECT_VERSION}${PROJECT_VERSION_EXTRA}
)
# etc
set(DEFAULT_SYSCONFDIR "${CMAKE_INSTALL_PREFIX}/etc")
if(CMAKE_INSTALL_PREFIX STREQUAL "/usr")
set(DEFAULT_SYSCONFDIR "/etc")
endif()
# install
configure_file(
share/daemon/conf.in
${CMAKE_BINARY_DIR}/${POWERD_SERVICE_NAME}.conf
@ONLY
)
configure_file(
share/daemon/service.in
${CMAKE_BINARY_DIR}/${POWERD_SERVICE_NAME}.service
@ONLY
)
configure_file(
share/autostart/${POWER_SERVICE_NAME}.desktop.in
${CMAKE_BINARY_DIR}/${POWER_SERVICE_NAME}.desktop
@ONLY
)
configure_file(
share/autostart/${STORAGE_SERVICE_NAME}.desktop.in
${CMAKE_BINARY_DIR}/${STORAGE_SERVICE_NAME}.desktop
@ONLY
)
configure_file(
share/applications/settings.desktop.in
${CMAKE_BINARY_DIR}/${PROJECT_NAME}-settings.desktop
@ONLY
)
configure_file(
share/applications/settings-x11.desktop.in
${CMAKE_BINARY_DIR}/${PROJECT_NAME}-settings-x11.desktop
@ONLY
)
install(
TARGETS
${LIB_NAME}
DESTINATION
${LIB_INSTALL_DIR}
)
install(
TARGETS
${DESKTOP_SERVICE_NAME}
DESTINATION
${CMAKE_INSTALL_LIBEXECDIR}
)
install(
TARGETS
${POWERD_SERVICE_NAME}
DESTINATION
${CMAKE_INSTALL_LIBEXECDIR}
)
install(
TARGETS
${POWER_SERVICE_NAME}
DESTINATION
${CMAKE_INSTALL_LIBEXECDIR}
)
install(
TARGETS
${STORAGE_SERVICE_NAME}
DESTINATION
${CMAKE_INSTALL_LIBEXECDIR}
)
install(
TARGETS
${XDG_OPEN}
DESTINATION
${CMAKE_INSTALL_LIBEXECDIR}
)
install(
TARGETS
start-${PROJECT_NAME}
DESTINATION
${CMAKE_INSTALL_BINDIR}
)
install(
TARGETS
${PROJECT_NAME}-settings
DESTINATION
${CMAKE_INSTALL_BINDIR}
)
install(
TARGETS
${PROJECT_NAME}-settings-x11
DESTINATION
${CMAKE_INSTALL_BINDIR}
)
install(
FILES
share/xsessions/${PROJECT_NAME}.desktop
DESTINATION
${CMAKE_INSTALL_DATAROOTDIR}/xsessions
)
install(
FILES
${CMAKE_BINARY_DIR}/${POWER_SERVICE_NAME}.desktop
${CMAKE_BINARY_DIR}/${STORAGE_SERVICE_NAME}.desktop
DESTINATION
${DEFAULT_SYSCONFDIR}/xdg/autostart
)
install(
FILES
${CMAKE_BINARY_DIR}/${PROJECT_NAME}-settings.desktop
${CMAKE_BINARY_DIR}/${PROJECT_NAME}-settings-x11.desktop
DESTINATION
${CMAKE_INSTALL_DATAROOTDIR}/applications
)
install(
FILES
${CMAKE_BINARY_DIR}/${POWERD_SERVICE_NAME}.conf
DESTINATION
${DEFAULT_SYSCONFDIR}/dbus-1/system.d
)
install(
FILES
${CMAKE_BINARY_DIR}/${POWERD_SERVICE_NAME}.service
DESTINATION
${CMAKE_INSTALL_DATAROOTDIR}/dbus-1/system-services
)
install(
FILES
share/xinit/xinitrc.draco
DESTINATION
${DEFAULT_SYSCONFDIR}/X11/xinit
)