-
-
Notifications
You must be signed in to change notification settings - Fork 2
/
Copy pathfeatures.cmake
475 lines (445 loc) · 16.8 KB
/
features.cmake
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
# SPDX-FileCopyrightText: 2023 Pier Luigi Fiorini <[email protected]>
# SPDX-License-Identifier: BSD-3-Clause
if(NOT COMMAND aurora_generate_wayland_protocol_server_sources)
## Find Aurora Scanner:
find_package(AuroraScanner REQUIRED)
endif()
## Find Wayland:
set(WAYLAND_MIN_VERSION "1.15")
find_package(Wayland "${WAYLAND_MIN_VERSION}" COMPONENTS Server REQUIRED)
## Find wayland-protocols:
find_package(WaylandProtocols 1.15 REQUIRED)
## Find Qt:
set(QT_MIN_VERSION "6.6")
find_package(Qt6 "${QT_MIN_VERSION}"
REQUIRED
COMPONENTS
Core
DBus
Xml
Gui
Test
)
find_package(Qt6
QUIET
OPTIONAL_COMPONENTS
OpenGL
Qml
Quick
)
#### Features
# datadevice
option(FEATURE_aurora_datadevice "Wayland data device" ON)
add_feature_info("Aurora::DataDevice" FEATURE_aurora_datadevice "Build support for drag and drop")
set(LIRI_FEATURE_aurora_datadevice "$<IF:${FEATURE_aurora_datadevice},1,0>")
# xkbcommon
option(FEATURE_aurora_xkbcommon "Handling of keyboard descriptions" ON)
if(FEATURE_aurora_xkbcommon)
find_package(XkbCommon QUIET)
if(NOT TARGET XkbCommon::XkbCommon)
message(WARNING "You need xkbcommon for Aurora::XkbCommon")
set(FEATURE_aurora_xkbcommon OFF)
endif()
endif()
add_feature_info("Aurora::XkbCommon" FEATURE_aurora_xkbcommon "Build support for handling of keyboard descriptions")
set(LIRI_FEATURE_aurora_xkbcommon "$<IF:${FEATURE_aurora_xkbcommon},1,0>")
# brcm
option(FEATURE_aurora_brcm "Raspberry Pi" ON)
if(FEATURE_aurora_brcm)
find_package(EGL QUIET)
if(NOT TARGET EGL::EGL)
message(WARNING "You need EGL for Aurora::Brcm")
set(FEATURE_aurora_brcm OFF)
endif()
endif()
add_feature_info("Aurora::Brcm" FEATURE_aurora_brcm "Build Wayland compositor with Raspberry Pi hardware integration")
if(FEATURE_aurora_brcm)
liri_config_compile_test(egl_brcm
LABEL
"Broadcom EGL (Raspberry Pi)"
LIBRARIES
EGL::EGL
CODE "
#include <EGL/egl.h>
#include <bcm_host.h>
int main(void)
{
vc_dispmanx_display_open(0);
return 0;
}
")
if(NOT TEST_egl_brcm)
message(WARNING "You need egl-brcm for Aurora::Brcm")
set(FEATURE_aurora_brcm OFF)
endif()
endif()
set(LIRI_FEATURE_aurora_brcm "$<IF:${FEATURE_aurora_brcm},1,0>")
# compositor-quick
option(FEATURE_aurora_compositor_quick "QtQuick integration for Wayland compositor" ON)
if(FEATURE_aurora_compositor_quick)
if(NOT TARGET Qt6::Quick)
message(WARNING "You need Qt Quick for Aurora::WaylandCompositorQuick")
set(FEATURE_aurora_compositor_quick OFF)
endif()
endif()
add_feature_info("Aurora::WaylandCompositorQuick" FEATURE_aurora_compositor_quick "Build QtQuick integration for Wayland compositor")
set(LIRI_FEATURE_aurora_compositor_quick "$<IF:${FEATURE_aurora_compositor_quick},1,0>")
# dmabuf-client-buffer
option(FEATURE_aurora_dmabuf_client_buffer "Linux dma-buf client buffer integration" ON)
if(FEATURE_aurora_dmabuf_client_buffer)
find_package(EGL QUIET)
find_package(Libdrm QUIET)
if(NOT TARGET EGL::EGL)
message(WARNING "You need EGL for Aurora::DmabufClientBuffer")
set(FEATURE_aurora_dmabuf_client_buffer OFF)
endif()
if(NOT TARGET PkgConfig::Libdrm)
message(WARNING "You need libdrm for Aurora::DmabufClientBuffer")
set(FEATURE_aurora_dmabuf_client_buffer OFF)
endif()
if(NOT TARGET Qt6::OpenGL)
message(WARNING "You need Qt OpenGL for Aurora::DmabufClientBuffer")
set(FEATURE_aurora_dmabuf_client_buffer OFF)
endif()
endif()
if(FEATURE_aurora_dmabuf_client_buffer)
liri_config_compile_test(dmabuf_client_buffer
LABEL
"Linux client dma-buf buffer sharing"
LIBRARIES
EGL::EGL
PkgConfig::Libdrm
CODE "
#include <EGL/egl.h>
#include <EGL/eglext.h>
#include <drm_mode.h>
#include <drm_fourcc.h>
int main(void)
{
// Test if DMA BUF is supported
#ifndef EGL_LINUX_DMA_BUF_EXT
# error DMA BUF Extension not available
#endif
// Test if DMA BUF import modifier extension is supported
#ifndef EGL_EXT_image_dma_buf_import_modifiers
# error DMA BUF Import modifier extension not available
#endif
return 0;
}
")
if(NOT TEST_dmabuf_client_buffer)
message(WARNING "You need EGL_LINUX_DMA_BUF_EXT for Aurora::DmabufClientBuffer")
set(FEATURE_aurora_dmabuf_client_buffer OFF)
endif()
endif()
add_feature_info("Aurora::DmabufClientBuffer" FEATURE_aurora_dmabuf_client_buffer "Build Linux dma-buf client buffer integration")
set(LIRI_FEATURE_aurora_dmabuf_client_buffer "$<IF:${FEATURE_aurora_dmabuf_client_buffer},1,0>")
# dmabuf-server-buffer
option(FEATURE_aurora_dmabuf_server_buffer "Linux dma-buf server buffer integration" ON)
if(FEATURE_aurora_dmabuf_server_buffer)
find_package(EGL QUIET)
find_package(Libdrm QUIET)
if(NOT TARGET EGL::EGL)
message(WARNING "You need EGL for Aurora::DmabufServerBuffer")
set(FEATURE_aurora_dmabuf_server_buffer OFF)
endif()
if(NOT TARGET PkgConfig::Libdrm)
message(WARNING "You need libdrm for Aurora::DmabufServerBuffer")
set(FEATURE_aurora_dmabuf_server_buffer OFF)
endif()
if(NOT TARGET Qt6::OpenGL)
message(WARNING "You need Qt OpenGL for Aurora::DmabufServerBuffer")
set(FEATURE_aurora_dmabuf_server_buffer OFF)
endif()
endif()
if(FEATURE_aurora_dmabuf_server_buffer)
liri_config_compile_test(dmabuf_server_buffer
LABEL
"Linux dma-buf Buffer Sharing"
LIBRARIES
EGL::EGL
PkgConfig::Libdrm
CODE "
#include <EGL/egl.h>
#include <EGL/eglext.h>
#include <drm_fourcc.h>
int main(void)
{
#ifdef EGL_LINUX_DMA_BUF_EXT
return 0;
#else
# error Requires EGL_LINUX_DMA_BUF_EXT
return 1;
#endif
return 0;
}
")
if(NOT TEST_dmabuf_server_buffer)
message(WARNING "You need EGL_LINUX_DMA_BUF_EXT for Aurora::DmabufServerBuffer")
set(FEATURE_aurora_dmabuf_server_buffer OFF)
endif()
endif()
add_feature_info("Aurora::DmabufServerBuffer" FEATURE_aurora_dmabuf_server_buffer "Build Wayland compositor with Linux dma-buf server buffer integration")
set(LIRI_FEATURE_aurora_dmabuf_server_buffer "$<IF:${FEATURE_aurora_dmabuf_server_buffer},1,0>")
# drm-atomic
option(FEATURE_aurora_drm_atomic "DRM atomic" ON)
add_feature_info("Aurora::DrmAtomic" FEATURE_aurora_drm_atomic "Build platform plugin with DRM atomic support")
set(LIRI_FEATURE_aurora_drm_atomic "$<IF:${FEATURE_aurora_drm_atomic},1,0>")
# drm-egl-server-buffer
option(FEATURE_aurora_drm_egl_server_buffer "DRM EGL" ON)
if(FEATURE_aurora_drm_egl_server_buffer)
find_package(EGL QUIET)
if(NOT TARGET EGL::EGL)
message(WARNING "You need EGL for Aurora::DrmEglServerBuffer")
set(FEATURE_aurora_drm_egl_server_buffer OFF)
endif()
endif()
if(FEATURE_aurora_drm_egl_server_buffer)
liri_config_compile_test(drm_egl_server
LABEL
"DRM EGL Server"
LIBRARIES
EGL::EGL
CODE "
#include <EGL/egl.h>
#include <EGL/eglext.h>
int main(void)
{
#ifdef EGL_MESA_drm_image
return 0;
#else
# error Requires EGL_MESA_drm_image to be defined
return 1;
#endif
return 0;
}
")
if(NOT TEST_drm_egl_server)
message(WARNING "You need EGL_MESA_drm_image for Aurora::DmabufServerBuffer")
set(FEATURE_aurora_drm_egl_server_buffer OFF)
endif()
endif()
add_feature_info("Aurora::DrmEglServerBuffer" FEATURE_aurora_drm_egl_server_buffer "Build Wayland compositor with DRM EGL hardware integration")
set(LIRI_FEATURE_aurora_drm_egl_server_buffer "$<IF:${FEATURE_aurora_drm_egl_server_buffer},1,0>")
# wayland-egl
option(FEATURE_aurora_wayland_egl "Wayland EGL" ON)
if(FEATURE_aurora_wayland_egl)
find_package(EGL QUIET)
find_package(Wayland "${WAYLAND_MIN_VERSION}" COMPONENTS Egl QUIET)
if(NOT TARGET EGL::EGL)
message(WARNING "You need EGL for Aurora::WaylandEgl")
set(FEATURE_aurora_wayland_egl OFF)
endif()
if(NOT TARGET Wayland::Egl)
message(WARNING "You need libdrm for Aurora::WaylandEgl")
set(FEATURE_aurora_wayland_egl OFF)
endif()
if(NOT TARGET Qt6::OpenGL)
message(WARNING "You need Qt OpenGL for Aurora::WaylandEgl")
set(FEATURE_aurora_wayland_egl OFF)
endif()
endif()
add_feature_info("Aurora::WaylandEgl" FEATURE_aurora_wayland_egl "Build Wayland compositor with Wayland EGL hardware integration")
set(LIRI_FEATURE_aurora_wayland_egl "$<IF:${FEATURE_aurora_wayland_egl},1,0>")
# libhybris-egl-server-buffer
option(FEATURE_aurora_libhybris_egl_server_buffer "libhybris EGL" ON)
if(FEATURE_aurora_libhybris_egl_server_buffer)
find_package(EGL QUIET)
if(NOT TARGET EGL::EGL)
message(WARNING "You need EGL for Aurora::LibhybrisEgl")
set(FEATURE_aurora_libhybris_egl_server_buffer OFF)
endif()
if(NOT TARGET Qt6::OpenGL)
message(WARNING "You need Qt OpenGL for Aurora::LibhybrisEgl")
set(FEATURE_aurora_libhybris_egl_server_buffer OFF)
endif()
endif()
if(FEATURE_aurora_libhybris_egl_server_buffer)
liri_config_compile_test(libhybris_egl_server
LABEL
"libhybris EGL Server"
LIBRARIES
EGL::EGL
CODE "
#include <EGL/egl.h>
#include <EGL/eglext.h>
#include <hybris/eglplatformcommon/hybris_nativebufferext.h>
int main(void)
{
#ifdef EGL_HYBRIS_native_buffer
return 0;
#else
# error Requires EGL_HYBRIS_native_buffer to be defined
return 1;
#endif
return 0;
}
")
if(NOT TEST_libhybris_egl_server)
message(WARNING "You need EGL_HYBRIS_native_buffer for Aurora::LibhybrisEgl")
set(FEATURE_aurora_libhybris_egl_server_buffer OFF)
endif()
endif()
add_feature_info("Aurora::LibhybrisEgl" FEATURE_aurora_libhybris_egl_server_buffer "Build Wayland compositor with libhybris EGL hardware integration")
set(LIRI_FEATURE_aurora_libhybris_egl_server_buffer "$<IF:${FEATURE_aurora_libhybris_egl_server_buffer},1,0>")
# qpa
option(FEATURE_aurora_qpa "Qt platform plugin for Wayland compositors" ON)
if(FEATURE_aurora_qpa)
find_package(EGL QUIET)
find_package(Libudev QUIET)
find_package(Libinput QUIET)
find_package(Libdrm QUIET)
find_package(Gbm QUIET)
if(NOT TARGET EGL::EGL)
message(WARNING "You need EGL for Aurora::QPA")
set(FEATURE_aurora_qpa OFF)
endif()
if(NOT TARGET PkgConfig::Libudev)
message(WARNING "You need udev for Aurora::QPA")
set(FEATURE_aurora_qpa OFF)
endif()
if(NOT TARGET PkgConfig::Libinput)
message(WARNING "You need libinput for Aurora::QPA")
set(FEATURE_aurora_qpa OFF)
endif()
if(NOT TARGET PkgConfig::Libdrm)
message(WARNING "You need libdrm for Aurora::QPA")
set(FEATURE_aurora_qpa OFF)
endif()
if(NOT TARGET PkgConfig::Gbm)
message(WARNING "You need gbm for Aurora::QPA")
set(FEATURE_aurora_qpa OFF)
endif()
#if(NOT TARGET Qt${QT_MAJOR_VERSION}FontDatabaseSupport::Qt${QT_MAJOR_VERSION}FontDatabaseSupport)
# message(WARNING "You need Qt${QT_MAJOR_VERSION}FontDatabaseSupport for Aurora::QPA")
# set(FEATURE_aurora_qpa OFF)
#endif()
#if(NOT TARGET Qt${QT_MAJOR_VERSION}ThemeSupport::Qt${QT_MAJOR_VERSION}ThemeSupport)
# message(WARNING "You need Qt${QT_MAJOR_VERSION}ThemeSupport for Aurora::QPA")
# set(FEATURE_aurora_qpa OFF)
#endif()
#if(NOT TARGET Qt${QT_MAJOR_VERSION}EventDispatcherSupport::Qt${QT_MAJOR_VERSION}EventDispatcherSupport)
# message(WARNING "You need Qt${QT_MAJOR_VERSION}EventDispatcherSupport for Aurora::QPA")
# set(FEATURE_aurora_qpa OFF)
#endif()
#if(NOT TARGET Qt${QT_MAJOR_VERSION}EglSupport::Qt${QT_MAJOR_VERSION}EglSupport)
# message(WARNING "You need Qt${QT_MAJOR_VERSION}EglSupport for Aurora::QPA")
# set(FEATURE_aurora_qpa OFF)
#endif()
#if(NOT TARGET Qt${QT_MAJOR_VERSION}PlatformCompositorSupport::Qt${QT_MAJOR_VERSION}PlatformCompositorSupport)
# message(WARNING "You need Qt${QT_MAJOR_VERSION}PlatformCompositorSupport for Aurora::QPA")
# set(FEATURE_aurora_qpa OFF)
#endif()
#if(NOT TARGET Qt${QT_MAJOR_VERSION}ServiceSupport::Qt${QT_MAJOR_VERSION}ServiceSupport)
# message(WARNING "You need Qt${QT_MAJOR_VERSION}ServiceSupport for Aurora::QPA")
# set(FEATURE_aurora_qpa OFF)
#endif()
#if(NOT TARGET Qt${QT_MAJOR_VERSION}FbSupport::Qt${QT_MAJOR_VERSION}FbSupport)
# message(WARNING "You need Qt${QT_MAJOR_VERSION}FbSupport for Aurora::QPA")
# set(FEATURE_aurora_qpa OFF)
#endif()
if(NOT FEATURE_aurora_xkbcommon)
message(WARNING "You need XkbCommon support for Aurora::QPA")
set(FEATURE_aurora_qpa OFF)
endif()
endif()
add_feature_info("Aurora::QPA" FEATURE_aurora_qpa "Build Qt platform plugin for Wayland compositors")
set(LIRI_FEATURE_aurora_qpa "$<IF:${FEATURE_aurora_qpa},1,0>")
# x11
if(FEATURE_aurora_qpa)
option(FEATURE_aurora_qpa_x11 "Qt platform plugin for Wayland compositors: X11 support" ON)
if(FEATURE_aurora_qpa_x11)
find_package(X11)
if(NOT X11_FOUND)
message(WARNING "You need X11 for Aurora::QPA::X11")
set(FEATURE_aurora_qpa_x11 OFF)
endif()
find_package(XCB COMPONENTS XCB)
if(NOT XCB_FOUND)
message(WARNING "You need XCB for Aurora::QPA::X11")
set(FEATURE_aurora_qpa_x11 OFF)
endif()
endif()
else()
set(FEATURE_aurora_qpa_x11 OFF)
endif()
add_feature_info("Aurora::QPA::X11" FEATURE_aurora_qpa "Build X11 support for the Qt platform plugin for Wayland compositors")
set(LIRI_FEATURE_aurora_qpa_x11 "$<IF:${FEATURE_aurora_qpa_x11},1,0>")
# shm-emulation-server
option(FEATURE_aurora_shm_emulation_server "Shm emulation server" ON)
if(FEATURE_aurora_shm_emulation_server)
if(NOT TARGET Qt6::OpenGL)
message(WARNING "You need Qt OpenGL for Aurora::ShmEmulationServer")
set(FEATURE_aurora_shm_emulation_server OFF)
endif()
endif()
add_feature_info("Aurora::ShmEmulationServer" FEATURE_aurora_shm_emulation_server "Build Wayland compositor with shm emulation server buffer integration")
set(LIRI_FEATURE_aurora_shm_emulation_server "$<IF:${FEATURE_aurora_shm_emulation_server},1,0>")
# vulkan-server-buffer
option(FEATURE_aurora_vulkan_server_buffer "Vulkan" ON)
if(FEATURE_aurora_vulkan_server_buffer)
find_package(Vulkan QUIET)
if(NOT TARGET Qt6::OpenGL)
message(WARNING "You need Qt OpenGL for Aurora::VulkanServerBuffer")
set(FEATURE_aurora_vulkan_server_buffer OFF)
endif()
if(NOT TARGET PkgConfig::Vulkan)
message(WARNING "You need Vulkan for Aurora::VulkanServerBuffer")
set(FEATURE_aurora_vulkan_server_buffer OFF)
endif()
endif()
if(FEATURE_aurora_vulkan_server_buffer)
liri_config_compile_test(vulkan_server_buffer
LABEL
"Vulkan Buffer Sharing"
DEFINITIONS
-DVK_USE_PLATFORM_WAYLAND_KHR=1
LIBRARIES
PkgConfig::Vulkan
CODE "
#include <vulkan/vulkan.h>
int main(void)
{
VkExportMemoryAllocateInfoKHR exportAllocInfo = {};
exportAllocInfo.sType = VK_STRUCTURE_TYPE_EXPORT_MEMORY_ALLOCATE_INFO_KHR;
exportAllocInfo.handleTypes = VK_EXTERNAL_MEMORY_HANDLE_TYPE_OPAQUE_FD_BIT_KHR;
return 0;
}
")
if(NOT TEST_vulkan_server_buffer)
message(WARNING "You need Vulkan for Aurora::VulkanServerBuffer")
set(FEATURE_aurora_vulkan_server_buffer OFF)
endif()
endif()
add_feature_info("Aurora::VulkanServerBuffer" FEATURE_aurora_vulkan_server_buffer "Build Wayland compositor with Vulkan-based server buffer integration")
set(LIRI_FEATURE_aurora_vulkan_server_buffer "$<IF:${FEATURE_aurora_vulkan_server_buffer},1,0>")
# xwayland
option(FEATURE_aurora_xwayland "XWayland" ON)
if(FEATURE_aurora_xwayland)
find_package(X11 QUIET)
find_package(XCB QUIET)
find_package(XKB QUIET)
find_package(Xcursor QUIET)
if(NOT X11_FOUND)
message(WARNING "You need X11 for Aurora::XWayland")
set(FEATURE_aurora_xwayland OFF)
endif()
if(NOT XCB_FOUND)
message(WARNING "You need XCB for Aurora::XWayland")
set(FEATURE_aurora_xwayland OFF)
endif()
if(NOT XKB_FOUND)
message(WARNING "You need XKB for Aurora::XWayland")
set(FEATURE_aurora_xwayland OFF)
endif()
if(NOT TARGET PkgConfig::Xcursor)
message(WARNING "You need Xcursor for Aurora::XWayland")
set(FEATURE_aurora_xwayland OFF)
endif()
endif()
add_feature_info("Aurora::XWayland" FEATURE_aurora_xwayland "Build XWayland support")
set(LIRI_FEATURE_aurora_xwayland "$<IF:${FEATURE_aurora_xwayland},1,0>")
## Summary:
if(NOT LIRI_SUPERBUILD)
feature_summary(WHAT ENABLED_FEATURES DISABLED_FEATURES)
endif()