-
-
Notifications
You must be signed in to change notification settings - Fork 19
/
CMakeLists.txt
211 lines (171 loc) · 6.49 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
cmake_minimum_required(VERSION 3.16)
set(PROJECT_VERSION "5.81.80")
project(plasma-framework VERSION ${PROJECT_VERSION})
set(QT_MIN_VERSION "6.5.0")
set(KF6_MIN_VERSION "5.240.0")
set(CMAKE_CXX_STANDARD 20)
set(CMAKE_CXX_STANDARD_REQUIRED ON)
find_package(ECM ${KF6_MIN_VERSION} REQUIRED NO_MODULE)
set(CMAKE_MODULE_PATH ${ECM_MODULE_PATH} )
include(FeatureSummary)
include(KDEInstallDirs)
include(KDECMakeSettings)
include(KDEGitCommitHooks)
include(KDECompilerSettings NO_POLICY_SCOPE)
include(ECMGenerateExportHeader)
include(ECMGenerateHeaders)
include(CMakePackageConfigHelpers)
include(ECMSetupVersion)
include(ECMQtDeclareLoggingCategory)
include(ECMAddQch)
include(KDEPackageAppTemplates)
include(ECMGenerateQmlTypes)
include(ECMMarkNonGuiExecutable)
include(ECMDeprecationSettings)
include(ECMQmlModule)
option(BUILD_QCH "Build API documentation in QCH format (for e.g. Qt Assistant, Qt Creator & KDevelop)" OFF)
add_feature_info(QCH ${BUILD_QCH} "API documentation in QCH format (for e.g. Qt Assistant, Qt Creator & KDevelop)")
ecm_setup_version(PROJECT
VARIABLE_PREFIX PLASMA
VERSION_HEADER "${CMAKE_CURRENT_BINARY_DIR}/plasma_version.h"
PACKAGE_VERSION_FILE "${CMAKE_CURRENT_BINARY_DIR}/PlasmaConfigVersion.cmake"
SOVERSION 6)
################# now find all used packages #################
find_package(Qt6 ${QT_MIN_VERSION} REQUIRED NO_MODULE COMPONENTS Quick Gui Qml Svg QuickControls2 DBus)
find_package(KF6 ${KF6_MIN_VERSION} REQUIRED
COMPONENTS
Archive
Config
ConfigWidgets
CoreAddons
GlobalAccel
GuiAddons
I18n
IconThemes
KIO
WindowSystem
Notifications
Package
KirigamiPlatform
KCMUtils
Svg
)
find_package(PlasmaActivities REQUIRED ${PROJECT_VERSION})
# Wayland features
find_package(PlasmaWaylandProtocols 1.10.0 REQUIRED)
find_package(Qt6WaylandClient ${QT_MIN_VERSION} REQUIRED CONFIG)
find_package(Wayland 1.9 REQUIRED Client)
option(WITHOUT_X11 "Build without X11 support (skips finding X11)." OFF)
if(NOT WITHOUT_X11)
#optional features
find_package(X11 MODULE)
set_package_properties(X11 PROPERTIES DESCRIPTION "X11 libraries"
URL "https://www.x.org/"
TYPE OPTIONAL
)
find_package(XCB MODULE COMPONENTS XCB COMPOSITE DAMAGE SHAPE XFIXES RENDER)
set_package_properties(XCB PROPERTIES DESCRIPTION "X protocol C-language Binding"
URL "https://xcb.freedesktop.org/"
TYPE OPTIONAL
)
if(X11_FOUND AND XCB_XCB_FOUND)
set(HAVE_X11 1)
#X11_Xrender discovery is done by FindX11
#add_feature_info("X Rendering Extension (libXrender)" X11_Xrender_FOUND "Support for compositing, rendering operations, and alpha-blending. STRONGLY RECOMMENDED")
set(HAVE_XCB_SHAPE ${XCB_SHAPE_FOUND})
else()
set(HAVE_X11 0)
set(HAVE_XCB_SHAPE 0)
endif()
endif()
find_package(OpenGL)
set_package_properties(OpenGL PROPERTIES DESCRIPTION "The OpenGL libraries"
URL "https://www.opengl.org/"
TYPE OPTIONAL
)
find_package(EGL)
set_package_properties(EGL PROPERTIES
PURPOSE "Fallback when OpenGL not available because of missing GLVND"
TYPE OPTIONAL
)
get_target_property(QtGui_Enabled_Features Qt6::Gui QT_ENABLED_PUBLIC_FEATURES)
if(OpenGL_GLX_FOUND AND HAVE_X11 AND (QtGui_Enabled_Features MATCHES "opengl"))
add_feature_info(GLX OpenGL_GLX_FOUND "OpenGL GLX libraries.")
set(HAVE_GLX 1)
else()
set(HAVE_GLX 0)
endif()
# OpenGL_EGL_FOUND is defined by FindOpenGL
if(TARGET OpenGL::EGL)
add_feature_info(EGL OpenGL_EGL_FOUND
"A platform-agnostic mechanism for creating rendering surfaces for use with other graphics libraries, such as OpenGL|ES and OpenVG.")
set(HAVE_EGL 1)
else()
set(HAVE_EGL 0)
message(STATUS "OpenGL::EGL is not available")
endif()
#########################################################################
ecm_set_disabled_deprecation_versions(
QT 6.4
KF 5.102
)
#add_definitions(-Wno-deprecated)
include(PlasmaMacros.cmake)
#########################################################################
option(BUILD_EXAMPLES "Build and install Plasma examples." OFF)
option(BUILD_COVERAGE "Build Plasma Frameworks with gcov support" OFF)
if (BUILD_EXAMPLES)
find_package(KF6DBusAddons ${KF6_MIN_VERSION})
endif()
if(BUILD_COVERAGE)
set(CMAKE_CXX_FLAGS "${CMAKE_CXX_FLAGS} -fprofile-arcs -ftest-coverage")
set(CMAKE_EXE_LINKER_FLAGS "${CMAKE_EXE_LINKER_FLAGS} -lgcov")
endif()
# make plasma_version.h available
include_directories(${CMAKE_CURRENT_BINARY_DIR})
################# list the subdirectories #################
add_definitions(-DTRANSLATION_DOMAIN=\"libplasma6\")
ki18n_install(po)
add_subdirectory(src)
if (BUILD_EXAMPLES)
add_subdirectory(examples)
endif()
if (BUILD_TESTING)
add_subdirectory(autotests)
add_subdirectory(tests)
endif()
add_subdirectory(templates)
################ create PlasmaConfig.cmake and install it ###########################
# create a Config.cmake and a ConfigVersion.cmake file and install them
set(CMAKECONFIG_INSTALL_DIR "${KDE_INSTALL_CMAKEPACKAGEDIR}/Plasma")
if (BUILD_QCH)
ecm_install_qch_export(
TARGETS Plasma_QCH
FILE PlasmaQchTargets.cmake
DESTINATION "${CMAKECONFIG_INSTALL_DIR}"
COMPONENT Devel
)
set(PACKAGE_INCLUDE_QCHTARGETS "include(\"\${CMAKE_CURRENT_LIST_DIR}/PlasmaQchTargets.cmake\")")
endif()
configure_package_config_file(
"${CMAKE_CURRENT_SOURCE_DIR}/PlasmaConfig.cmake.in"
"${CMAKE_CURRENT_BINARY_DIR}/PlasmaConfig.cmake"
INSTALL_DESTINATION ${CMAKECONFIG_INSTALL_DIR}
PATH_VARS CMAKE_INSTALL_PREFIX
)
install(FILES
"${CMAKE_CURRENT_BINARY_DIR}/PlasmaConfig.cmake"
"${CMAKE_CURRENT_BINARY_DIR}/PlasmaConfigVersion.cmake"
"${CMAKE_CURRENT_SOURCE_DIR}/PlasmaMacros.cmake"
DESTINATION "${CMAKECONFIG_INSTALL_DIR}"
COMPONENT Devel
)
install(EXPORT PlasmaTargets
DESTINATION "${CMAKECONFIG_INSTALL_DIR}"
FILE PlasmaTargets.cmake
NAMESPACE Plasma::
COMPONENT Devel)
install(FILES ${CMAKE_CURRENT_BINARY_DIR}/plasma_version.h
DESTINATION ${KDE_INSTALL_INCLUDEDIR}/Plasma COMPONENT Devel )
feature_summary(WHAT ALL FATAL_ON_MISSING_REQUIRED_PACKAGES)
kde_configure_git_pre_commit_hook(CHECKS CLANG_FORMAT)