CMakeLists.txt 3 KB
Newer Older
1
2
cmake_minimum_required(VERSION 3.0)

3
project(PowerDevil)
4
set(PROJECT_VERSION "5.20.80")
5
set(PROJECT_VERSION_MAJOR 5)
6

7
set(QT_MIN_VERSION "5.15.0")
8
set(KF5_MIN_VERSION "5.74")
9

10
find_package(ECM ${KF5_MIN_VERSION} REQUIRED NO_MODULE)
11
set(CMAKE_MODULE_PATH ${ECM_MODULE_PATH}  ${CMAKE_CURRENT_SOURCE_DIR}/cmake)
12

Kai Uwe Broulik's avatar
Kai Uwe Broulik committed
13
include(ECMSetupVersion)
14
include(ECMQtDeclareLoggingCategory)
15
16
17
include(FeatureSummary)
include(KDEInstallDirs)
include(KDECMakeSettings)
18
include(KDECompilerSettings NO_POLICY_SCOPE)
19
include(KDEClangFormat)
20
21

find_package(Qt5 ${QT_MIN_VERSION} CONFIG REQUIRED COMPONENTS Widgets DBus X11Extras)
22
find_package(KF5 ${KF5_MIN_VERSION} REQUIRED COMPONENTS Activities Auth IdleTime Config DBusAddons Solid I18n GlobalAccel KIO NotifyConfig Wayland DocTools Crash Notifications)
23
find_package(KF5Screen CONFIG REQUIRED)
24
find_package(LibKWorkspace CONFIG REQUIRED)
25

26
find_package(KF5BluezQt ${KF5_MIN_VERSION})
27
28
29
30
31
set_package_properties(KF5BluezQt
    PROPERTIES DESCRIPTION "Qt wrapper for BlueZ 5 DBus API"
    TYPE OPTIONAL
    PURPOSE "Support for wireless energy saving actions"
)
32
find_package(KF5NetworkManagerQt ${KF5_MIN_VERSION})
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
set_package_properties(KF5NetworkManagerQt
    PROPERTIES DESCRIPTION "Qt wrapper for NetworkManager API"
    TYPE OPTIONAL
    PURPOSE "Support for wireless energy saving actions"
)

set(HAVE_WIRELESS_SUPPORT FALSE)
if(KF5NetworkManagerQt_FOUND AND KF5BluezQt_FOUND)
    set(HAVE_WIRELESS_SUPPORT TRUE)
endif()
add_feature_info(
    "Wireless power saving"
    HAVE_WIRELESS_SUPPORT
    "Support turning off signal-transmitting devices to save energy"
)

49
50
find_package(LibKWorkspace ${PROJECT_VERSION} REQUIRED)

Kai Uwe Broulik's avatar
Kai Uwe Broulik committed
51
find_package(UDev REQUIRED)
Dario Freddi's avatar
Dario Freddi committed
52

53
find_package(XCB REQUIRED COMPONENTS XCB RANDR DPMS)
54

55
56
57
58
59
60
61
find_package(Libcap)
set_package_properties(Libcap PROPERTIES
    TYPE OPTIONAL
    PURPOSE "Needed for scheduled wakeup which can wake from suspend (CAP_WAKE_ALARM)"
)
set(HAVE_LIBCAP ${Libcap_FOUND})

62
63
64
option(HAVE_DDCUTIL "DDCUtil library support" OFF)
if(HAVE_DDCUTIL)
    find_package(DDCUtil REQUIRED)
65
    add_definitions(-DWITH_DDCUTIL)
66
67
68
69
70
    set_package_properties(DDCUtil
        PROPERTIES DESCRIPTION "DDCUtil library support"
        TYPE OPTIONAL
        PURPOSE "Set monitor settings over DDC/CI channel"
    )
Jonathan Riddell's avatar
Jonathan Riddell committed
71
else()
Yuri Chornoivan's avatar
Yuri Chornoivan committed
72
    add_feature_info("DDCUtil" HAVE_DDCUTIL "DDCUtil library support is disabled by default as recommended by authors, add -DHAVE_DDCUTIL=On to enable")
73
74
endif()

Dario Freddi's avatar
Dario Freddi committed
75
include_directories (
76
77
    ${CMAKE_CURRENT_BINARY_DIR}
    ${CMAKE_CURRENT_SOURCE_DIR}/daemon
Dario Freddi's avatar
Dario Freddi committed
78
79
)

80
add_definitions(-DQT_NO_KEYWORDS)
Nicolas Fella's avatar
Nicolas Fella committed
81
add_definitions(-DQT_NO_FOREACH)
82

Dario Freddi's avatar
Dario Freddi committed
83
add_subdirectory(daemon)
Àlex Fiestas's avatar
Àlex Fiestas committed
84
add_subdirectory(kcmodule)
85
add_subdirectory(doc)
Dario Freddi's avatar
Dario Freddi committed
86

87
install( FILES powerdevil.categories  DESTINATION  ${KDE_INSTALL_LOGGINGCATEGORIESDIR})
88
install( FILES powerdevil.notifyrc DESTINATION ${KDE_INSTALL_KNOTIFY5RCDIR} )
89

90
91
92
93
# add clang-format target for all our real source files
file(GLOB_RECURSE ALL_CLANG_FORMAT_SOURCE_FILES *.cpp *.h)
kde_clang_format(${ALL_CLANG_FORMAT_SOURCE_FILES})

94
feature_summary(WHAT ALL INCLUDE_QUIET_PACKAGES FATAL_ON_MISSING_REQUIRED_PACKAGES)