-
-
Notifications
You must be signed in to change notification settings - Fork 87
/
CMakeLists.txt
219 lines (178 loc) · 7.38 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
cmake_minimum_required(VERSION 3.16)
project(breeze)
set(PROJECT_VERSION "6.2.80")
set(PROJECT_VERSION_MAJOR 6)
set(KF5_MIN_VERSION "5.102.0")
set(KF6_MIN_VERSION "6.5.0")
set(KDE_COMPILERSETTINGS_LEVEL "5.82")
set(QT5_MIN_VERSION "5.15.2")
set(QT_MIN_VERSION "6.7.0")
include(GenerateExportHeader)
include(WriteBasicConfigVersionFile)
include(FeatureSummary)
find_package(ECM ${KF5_MIN_VERSION} REQUIRED NO_MODULE)
set(CMAKE_MODULE_PATH ${CMAKE_MODULE_PATH} ${ECM_MODULE_PATH} ${CMAKE_SOURCE_DIR}/cmake)
set(CMAKE_CXX_STANDARD 20)
set(CMAKE_CXX_STANDARD_REQUIRED ON)
# We need this because we can't include KDECMakeSettings here, because that
# would need KDEInstallDirs, which we can only include in the qt{5,6} builds
# to get the correct installation dirs for each Qt version.
option(BUILD_TESTING "Build the testing tree." ON)
if(BUILD_TESTING)
enable_testing()
endif()
include(CMakePackageConfigHelpers)
include(ECMInstallIcons)
include(ECMQtDeclareLoggingCategory)
include(KDECompilerSettings NO_POLICY_SCOPE)
include(KDEClangFormat)
include(KDEGitCommitHooks)
include(GtkUpdateIconCache)
option(BUILD_QT5 "Build Qt5 style" ON)
option(BUILD_QT6 "Build with Qt6" ON)
set(QT_NO_CREATE_VERSIONLESS_TARGETS ON)
set(QT_NO_CREATE_VERSIONLESS_FUNCTIONS ON)
# For KDE CI only. As the current infrastructure doesn't allow us to set CMAKE options per build variant
if($ENV{CI_JOB_NAME_SLUG} MATCHES "qt5")
set(BUILD_QT5 ON)
set(BUILD_QT6 OFF)
elseif($ENV{CI_JOB_NAME_SLUG} MATCHES "qt6")
set(BUILD_QT5 OFF)
set(BUILD_QT6 ON)
endif()
function(build_Qt5)
set(QT_MAJOR_VERSION 5)
include(KDEInstallDirs5)
include(KDECMakeSettings)
find_package(Qt5 ${QT5_MIN_VERSION} REQUIRED CONFIG COMPONENTS Widgets)
if(UNIX AND NOT APPLE AND NOT ANDROID)
find_package(Qt5 ${QT5_MIN_VERSION} CONFIG REQUIRED DBus)
set(HAVE_QTDBUS ${Qt5DBus_FOUND})
find_package(KF5FrameworkIntegration ${KF5_MIN_VERSION} CONFIG )
set_package_properties(KF${QT_MAJOR_VERSION}FrameworkIntegration PROPERTIES
DESCRIPTION "KF${QT_MAJOR_VERSION} Framework Integration"
URL "https://projects.kde.org/projects/frameworks/frameworkintegration"
TYPE OPTIONAL
PURPOSE "Required to use KStyle convenience functionalities in style")
find_package(Qt5 ${QT5_MIN_VERSION} OPTIONAL_COMPONENTS X11Extras)
set_package_properties(KF${QT_MAJOR_VERSION}FrameworkIntegration PROPERTIES
DESCRIPTION "KF${QT_MAJOR_VERSION} Framework Integration"
URL "https://projects.kde.org/projects/frameworks/frameworkintegration"
TYPE OPTIONAL
PURPOSE "Required to use KStyle convenience functionalities in style")
endif()
find_package(KF5 ${KF5_MIN_VERSION} REQUIRED COMPONENTS
CoreAddons
Config
ConfigWidgets
GuiAddons
IconThemes
WindowSystem)
find_package(Qt5 ${QT5_MIN_VERSION} OPTIONAL_COMPONENTS Quick)
if(${Qt5Quick_FOUND})
find_package(KF5 ${KF5_MIN_VERSION} REQUIRED COMPONENTS Kirigami2)
endif()
set(BREEZE_HAVE_KSTYLE ${KF5FrameworkIntegration_FOUND})
set(BREEZE_HAVE_QTQUICK ${Qt5Quick_FOUND})
add_subdirectory(kstyle kstyle5)
add_subdirectory(libbreezecommon libbreezecommon5)
unset(QUERY_EXECUTABLE CACHE)
endfunction()
if(BUILD_QT5)
build_Qt5()
endif()
function(build_Qt6)
set(QT_MAJOR_VERSION 6)
include(KDEInstallDirs6)
include(KDECMakeSettings)
if(UNIX AND NOT APPLE AND NOT ANDROID)
find_package(Qt6 ${REQUIRED_QT_VERSION} CONFIG REQUIRED DBus)
set(HAVE_QTDBUS ${Qt6DBus_FOUND})
option(WITH_DECORATIONS "Build Breeze window decorations for KWin" ON)
option(WITH_WALLPAPERS "Install Breeze default wallpapers" ON)
find_package(KF6FrameworkIntegration ${KF6_MIN_VERSION} CONFIG )
set_package_properties(KF${QT_MAJOR_VERSION}FrameworkIntegration PROPERTIES
DESCRIPTION "KF6 Framework Integration"
URL "https://projects.kde.org/projects/frameworks/frameworkintegration"
TYPE OPTIONAL
PURPOSE "Required to use KStyle convenience functionalities in style")
find_package(KF6KCMUtils ${KF6_MIN_VERSION})
set_package_properties(KF6KCMUtils PROPERTIES
TYPE REQUIRED
DESCRIPTION "Helps create configuration modules"
PURPOSE "KCMUtils used for the configuration modules or the decoration and Qt Style"
)
else()
set(WITH_DECORATIONS OFF)
set(WITH_WALLPAPERS OFF)
endif()
find_package(Qt6 ${QT_MIN_VERSION} REQUIRED CONFIG COMPONENTS Widgets)
find_package(KF6 ${KF6_MIN_VERSION} REQUIRED COMPONENTS
CoreAddons
ColorScheme
Config
GuiAddons
I18n
IconThemes
WindowSystem)
find_package(Qt6 ${QT_MIN_VERSION} OPTIONAL_COMPONENTS Quick)
if(${Qt6Quick_FOUND})
find_package(KF6KirigamiPlatform ${KF6_MIN_VERSION} REQUIRED)
endif()
set(BREEZE_HAVE_KSTYLE ${KF6FrameworkIntegration_FOUND})
set(BREEZE_HAVE_QTQUICK ${Qt6Quick_FOUND})
# https://bugreports.qt.io/browse/QTBUG-114706
add_library(Qt::Core ALIAS Qt6::Core)
add_library(Qt::Gui ALIAS Qt6::Gui)
add_library(Qt::OpenGL ALIAS Qt6::OpenGL)
add_library(Qt::Network ALIAS Qt6::Network)
if(Qt6_VERSION_MINOR GREATER 6)
add_library(Qt::PlatformModuleInternal ALIAS Qt6::PlatformModuleInternal)
endif()
add_subdirectory(kstyle kstyle6)
add_subdirectory(libbreezecommon libbreezecommon6)
add_subdirectory(misc)
if(WITH_DECORATIONS)
find_package(KDecoration3 REQUIRED)
add_subdirectory(kdecoration)
endif()
if (WITH_WALLPAPERS)
add_subdirectory(wallpapers)
endif()
ki18n_install(po)
# create a Config.cmake and a ConfigVersion.cmake file and install them
include(ECMSetupVersion)
ecm_setup_version(${PROJECT_VERSION} VARIABLE_PREFIX BREEZE
PACKAGE_VERSION_FILE "${CMAKE_CURRENT_BINARY_DIR}/BreezeConfigVersion.cmake"
)
set(CMAKECONFIG_INSTALL_DIR "${KDE_INSTALL_CMAKEPACKAGEDIR}/Breeze")
configure_package_config_file("${CMAKE_CURRENT_SOURCE_DIR}/BreezeConfig.cmake.in"
"${CMAKE_CURRENT_BINARY_DIR}/BreezeConfig.cmake"
PATH_VARS KDE_INSTALL_FULL_DATADIR
INSTALL_DESTINATION ${CMAKECONFIG_INSTALL_DIR}
)
install(FILES "${CMAKE_CURRENT_BINARY_DIR}/BreezeConfig.cmake"
"${CMAKE_CURRENT_BINARY_DIR}/BreezeConfigVersion.cmake"
DESTINATION "${CMAKECONFIG_INSTALL_DIR}"
COMPONENT Devel
)
unset(QUERY_EXECUTABLE CACHE)
endfunction()
if(BUILD_QT6)
build_Qt6()
endif()
function(build_colors_and_cursors)
# While it is technically not 100% correct to use versionless
# KDEInstallDirs while (maybe) building for both Qt versions,
# it doesn't really matter at the end, because colors and cursors
# only use ICONDIR and DATADIR which both do not depend on the version
include(KDEInstallDirs)
add_subdirectory(colors)
add_subdirectory(cursors)
endfunction()
build_colors_and_cursors()
# 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})
kde_configure_git_pre_commit_hook(CHECKS CLANG_FORMAT)
feature_summary(WHAT ALL FATAL_ON_MISSING_REQUIRED_PACKAGES)