Debian Codegraph @

platform/linuxbsd/wayland/SCsub

raw symbols SCIP
1 #!/usr/bin/env python
2 from misc.utility.scons_hints import *
3
4 Import("env")
5
6 File = env.File
7
8 # TODO: Add warning to headers and code about their autogenerated status.
9 if env["use_sowrap"]:
10 # We have to implement separate builders for so wrappers as the
11 # autogenerated Wayland protocol wrapper must include them instead of the
12 # native libraries.
13
14 WAYLAND_BUILDERS_SOWRAP = {
15 "WAYLAND_API_HEADER": Builder(
16 action=env.Run(
17 r"wayland-scanner -c client-header < ${SOURCE} | "
18 r"sed 's:wayland-client-core\.h:../dynwrappers/wayland-client-core-so_wrap\.h:' > ${TARGET}",
19 ),
20 single_source=True,
21 ),
22 "WAYLAND_API_CODE": Builder(
23 action=env.Run(
24 r"wayland-scanner -c private-code < ${SOURCE} | "
25 r"sed 's:wayland-util\.h:../dynwrappers/wayland-client-core-so_wrap\.h:' > ${TARGET}",
26 ),
27 single_source=True,
28 ),
29 }
30 env.Append(BUILDERS=WAYLAND_BUILDERS_SOWRAP)
31 else:
32 WAYLAND_BUILDERS = {
33 "WAYLAND_API_HEADER": Builder(
34 action=env.Run(r"wayland-scanner -c client-header < ${SOURCE} > ${TARGET}"),
35 single_source=True,
36 ),
37 "WAYLAND_API_CODE": Builder(
38 action=env.Run(r"wayland-scanner -c private-code < ${SOURCE} > ${TARGET}"),
39 single_source=True,
40 ),
41 }
42 env.Append(BUILDERS=WAYLAND_BUILDERS)
43
44
45 def generate_from_xml(name, path):
46 header = env.WAYLAND_API_HEADER(File(f"protocol/{name}.gen.h"), path)
47 source = env.WAYLAND_API_CODE(File(f"protocol/{name}.gen.c"), path)
48 env.NoCache(header, source)
49
50 return source
51
52
53 generated_sources = [
54 # Core protocol
55 generate_from_xml("wayland", "#thirdparty/wayland/protocol/wayland.xml"),
56 # Stable protocols
57 generate_from_xml("tablet", "#thirdparty/wayland-protocols/stable/tablet/tablet-v2.xml"),
58 generate_from_xml("viewporter", "#thirdparty/wayland-protocols/stable/viewporter/viewporter.xml"),
59 generate_from_xml("xdg_shell", "#thirdparty/wayland-protocols/stable/xdg-shell/xdg-shell.xml"),
60 # Staging protocols
61 generate_from_xml("cursor_shape", "#thirdparty/wayland-protocols/staging/cursor-shape/cursor-shape-v1.xml"),
62 generate_from_xml(
63 "fractional_scale", "#thirdparty/wayland-protocols/staging/fractional-scale/fractional-scale-v1.xml"
64 ),
65 generate_from_xml("xdg_activation", "#thirdparty/wayland-protocols/staging/xdg-activation/xdg-activation-v1.xml"),
66 generate_from_xml(
67 "xdg_system_bell", "#thirdparty/wayland-protocols/staging/xdg-system-bell/xdg-system-bell-v1.xml"
68 ),
69 generate_from_xml(
70 "xdg_toplevel_icon", "#thirdparty/wayland-protocols/staging/xdg-toplevel-icon/xdg-toplevel-icon-v1.xml"
71 ),
72 # Unstable protocols
73 generate_from_xml(
74 "idle_inhibit", "#thirdparty/wayland-protocols/unstable/idle-inhibit/idle-inhibit-unstable-v1.xml"
75 ),
76 generate_from_xml(
77 "pointer_constraints",
78 "#thirdparty/wayland-protocols/unstable/pointer-constraints/pointer-constraints-unstable-v1.xml",
79 ),
80 generate_from_xml(
81 "pointer_gestures", "#thirdparty/wayland-protocols/unstable/pointer-gestures/pointer-gestures-unstable-v1.xml"
82 ),
83 generate_from_xml(
84 "primary_selection",
85 "#thirdparty/wayland-protocols/unstable/primary-selection/primary-selection-unstable-v1.xml",
86 ),
87 generate_from_xml(
88 "relative_pointer", "#thirdparty/wayland-protocols/unstable/relative-pointer/relative-pointer-unstable-v1.xml"
89 ),
90 generate_from_xml("text_input", "#thirdparty/wayland-protocols/unstable/text-input/text-input-unstable-v3.xml"),
91 generate_from_xml(
92 "xdg_decoration", "#thirdparty/wayland-protocols/unstable/xdg-decoration/xdg-decoration-unstable-v1.xml"
93 ),
94 generate_from_xml(
95 "xdg_foreign_v1", "#thirdparty/wayland-protocols/unstable/xdg-foreign/xdg-foreign-unstable-v1.xml"
96 ), # Note: deprecated
97 generate_from_xml(
98 "xdg_foreign_v2", "#thirdparty/wayland-protocols/unstable/xdg-foreign/xdg-foreign-unstable-v2.xml"
99 ),
100 generate_from_xml("linux_dmabuf_v1", "#thirdparty/wayland-protocols/stable/linux-dmabuf/linux-dmabuf-v1.xml"),
101 generate_from_xml(
102 "linux_explicit_synchronization_unstable_v1",
103 "#thirdparty/wayland-protocols/unstable/linux-explicit-synchronization/linux-explicit-synchronization-unstable-v1.xml",
104 ),
105 generate_from_xml("fifo_v1", "#thirdparty/wayland-protocols/staging/fifo/fifo-v1.xml"),
106 generate_from_xml("commit_timing_v1", "#thirdparty/wayland-protocols/staging/commit-timing/commit-timing-v1.xml"),
107 generate_from_xml(
108 "linux_drm_syncobj_v1", "#thirdparty/wayland-protocols/staging/linux-drm-syncobj/linux-drm-syncobj-v1.xml"
109 ),
110 generate_from_xml(
111 "tearing_control_v1", "#thirdparty/wayland-protocols/staging/tearing-control/tearing-control-v1.xml"
112 ),
113 generate_from_xml("wayland-drm", "#thirdparty/wayland-protocols/mesa/wayland-drm.xml"),
114 generate_from_xml("godot_embedding_compositor", "godot-embedding-compositor.xml"),
115 ]
116
117 source_files = generated_sources + [
118 File("detect_prime_egl.cpp"),
119 File("display_server_wayland.cpp"),
120 File("key_mapping_xkb.cpp"),
121 File("wayland_thread.cpp"),
122 File("wayland_embedder.cpp"),
123 ]
124
125 if env["use_sowrap"]:
126 source_files.append(
127 [
128 File("dynwrappers/wayland-cursor-so_wrap.c"),
129 File("dynwrappers/wayland-client-core-so_wrap.c"),
130 File("dynwrappers/wayland-egl-core-so_wrap.c"),
131 ]
132 )
133
134 if env["libdecor"]:
135 source_files.append(File("dynwrappers/libdecor-so_wrap.c"))
136
137
138 if env["vulkan"]:
139 source_files.append(File("rendering_context_driver_vulkan_wayland.cpp"))
140
141 if env["opengl3"]:
142 source_files.append(File("egl_manager_wayland.cpp"))
143 source_files.append(File("egl_manager_wayland_gles.cpp"))
144
145 Return("source_files")