Skip to content

Commit fda6fae

Browse files
committed
Merge pull request #107356 from ArchercatNEO/wayland-protocols-scsub
Wayland: Simplify including protocols
2 parents cb6c7c6 + 367cabf commit fda6fae

File tree

3 files changed

+48
-136
lines changed

3 files changed

+48
-136
lines changed

platform/linuxbsd/wayland/SCsub

Lines changed: 48 additions & 136 deletions
Original file line numberDiff line numberDiff line change
@@ -39,152 +39,66 @@ else:
3939
}
4040
env.Append(BUILDERS=WAYLAND_BUILDERS)
4141

42-
env.NoCache(
43-
env.WAYLAND_API_HEADER("protocol/wayland.gen.h", "#thirdparty/wayland/protocol/wayland.xml"),
44-
env.WAYLAND_API_CODE("protocol/wayland.gen.c", "#thirdparty/wayland/protocol/wayland.xml"),
45-
env.WAYLAND_API_HEADER(
46-
"protocol/viewporter.gen.h", "#thirdparty/wayland-protocols/stable/viewporter/viewporter.xml"
47-
),
48-
env.WAYLAND_API_CODE("protocol/viewporter.gen.c", "#thirdparty/wayland-protocols/stable/viewporter/viewporter.xml"),
49-
env.WAYLAND_API_HEADER(
50-
"protocol/cursor_shape.gen.h",
51-
"#thirdparty/wayland-protocols/staging/cursor-shape/cursor-shape-v1.xml",
52-
),
53-
env.WAYLAND_API_CODE(
54-
"protocol/cursor_shape.gen.c",
55-
"#thirdparty/wayland-protocols/staging/cursor-shape/cursor-shape-v1.xml",
56-
),
57-
env.WAYLAND_API_HEADER(
58-
"protocol/fractional_scale.gen.h",
59-
"#thirdparty/wayland-protocols/staging/fractional-scale/fractional-scale-v1.xml",
60-
),
61-
env.WAYLAND_API_CODE(
62-
"protocol/fractional_scale.gen.c",
63-
"#thirdparty/wayland-protocols/staging/fractional-scale/fractional-scale-v1.xml",
64-
),
65-
env.WAYLAND_API_HEADER("protocol/xdg_shell.gen.h", "#thirdparty/wayland-protocols/stable/xdg-shell/xdg-shell.xml"),
66-
env.WAYLAND_API_CODE("protocol/xdg_shell.gen.c", "#thirdparty/wayland-protocols/stable/xdg-shell/xdg-shell.xml"),
67-
env.WAYLAND_API_HEADER(
68-
"protocol/xdg_decoration.gen.h",
69-
"#thirdparty/wayland-protocols/unstable/xdg-decoration/xdg-decoration-unstable-v1.xml",
70-
),
71-
env.WAYLAND_API_CODE(
72-
"protocol/xdg_decoration.gen.c",
73-
"#thirdparty/wayland-protocols/unstable/xdg-decoration/xdg-decoration-unstable-v1.xml",
74-
),
75-
env.WAYLAND_API_HEADER(
76-
"protocol/xdg_activation.gen.h",
77-
"#thirdparty/wayland-protocols/staging/xdg-activation/xdg-activation-v1.xml",
78-
),
79-
env.WAYLAND_API_CODE(
80-
"protocol/xdg_activation.gen.c",
81-
"#thirdparty/wayland-protocols/staging/xdg-activation/xdg-activation-v1.xml",
82-
),
83-
env.WAYLAND_API_HEADER(
84-
"protocol/relative_pointer.gen.h",
85-
"#thirdparty/wayland-protocols/unstable/relative-pointer/relative-pointer-unstable-v1.xml",
86-
),
87-
env.WAYLAND_API_CODE(
88-
"protocol/relative_pointer.gen.c",
89-
"#thirdparty/wayland-protocols/unstable/relative-pointer/relative-pointer-unstable-v1.xml",
90-
),
91-
env.WAYLAND_API_HEADER(
92-
"protocol/pointer_constraints.gen.h",
93-
"#thirdparty/wayland-protocols/unstable/pointer-constraints/pointer-constraints-unstable-v1.xml",
94-
),
95-
env.WAYLAND_API_CODE(
96-
"protocol/pointer_constraints.gen.c",
42+
43+
def generate_from_xml(name, path):
44+
header = env.WAYLAND_API_HEADER(f"protocol/{name}.gen.h", path)
45+
source = env.WAYLAND_API_CODE(f"protocol/{name}.gen.c", path)
46+
env.NoCache(header, source)
47+
48+
return env.Object(f"protocol/{name}.gen.c")
49+
50+
51+
objects = [
52+
# Core protocol
53+
generate_from_xml("wayland", "#thirdparty/wayland/protocol/wayland.xml"),
54+
# Stable protocols
55+
generate_from_xml("tablet", "#thirdparty/wayland-protocols/stable/tablet/tablet-v2.xml"),
56+
generate_from_xml("viewporter", "#thirdparty/wayland-protocols/stable/viewporter/viewporter.xml"),
57+
generate_from_xml("xdg_shell", "#thirdparty/wayland-protocols/stable/xdg-shell/xdg-shell.xml"),
58+
# Staging protocols
59+
generate_from_xml("cursor_shape", "#thirdparty/wayland-protocols/staging/cursor-shape/cursor-shape-v1.xml"),
60+
generate_from_xml(
61+
"fractional_scale", "#thirdparty/wayland-protocols/staging/fractional-scale/fractional-scale-v1.xml"
62+
),
63+
generate_from_xml("xdg_activation", "#thirdparty/wayland-protocols/staging/xdg-activation/xdg-activation-v1.xml"),
64+
generate_from_xml(
65+
"xdg_system_bell", "#thirdparty/wayland-protocols/staging/xdg-system-bell/xdg-system-bell-v1.xml"
66+
),
67+
# Unstable protocols
68+
generate_from_xml(
69+
"idle_inhibit", "#thirdparty/wayland-protocols/unstable/idle-inhibit/idle-inhibit-unstable-v1.xml"
70+
),
71+
generate_from_xml(
72+
"pointer_constraints",
9773
"#thirdparty/wayland-protocols/unstable/pointer-constraints/pointer-constraints-unstable-v1.xml",
9874
),
99-
env.WAYLAND_API_HEADER(
100-
"protocol/pointer_gestures.gen.h",
101-
"#thirdparty/wayland-protocols/unstable/pointer-gestures/pointer-gestures-unstable-v1.xml",
102-
),
103-
env.WAYLAND_API_CODE(
104-
"protocol/pointer_gestures.gen.c",
105-
"#thirdparty/wayland-protocols/unstable/pointer-gestures/pointer-gestures-unstable-v1.xml",
75+
generate_from_xml(
76+
"pointer_gestures", "#thirdparty/wayland-protocols/unstable/pointer-gestures/pointer-gestures-unstable-v1.xml"
10677
),
107-
env.WAYLAND_API_HEADER(
108-
"protocol/primary_selection.gen.h",
78+
generate_from_xml(
79+
"primary_selection",
10980
"#thirdparty/wayland-protocols/unstable/primary-selection/primary-selection-unstable-v1.xml",
11081
),
111-
env.WAYLAND_API_CODE(
112-
"protocol/primary_selection.gen.c",
113-
"#thirdparty/wayland-protocols/unstable/primary-selection/primary-selection-unstable-v1.xml",
114-
),
115-
env.WAYLAND_API_HEADER(
116-
"protocol/idle_inhibit.gen.h",
117-
"#thirdparty/wayland-protocols/unstable/idle-inhibit/idle-inhibit-unstable-v1.xml",
118-
),
119-
env.WAYLAND_API_CODE(
120-
"protocol/idle_inhibit.gen.c",
121-
"#thirdparty/wayland-protocols/unstable/idle-inhibit/idle-inhibit-unstable-v1.xml",
122-
),
123-
env.WAYLAND_API_HEADER(
124-
"protocol/tablet.gen.h",
125-
"#thirdparty/wayland-protocols/unstable/tablet/tablet-unstable-v2.xml",
126-
),
127-
env.WAYLAND_API_CODE(
128-
"protocol/tablet.gen.c",
129-
"#thirdparty/wayland-protocols/unstable/tablet/tablet-unstable-v2.xml",
130-
),
131-
env.WAYLAND_API_HEADER(
132-
"protocol/text_input.gen.h",
133-
"#thirdparty/wayland-protocols/unstable/text-input/text-input-unstable-v3.xml",
134-
),
135-
env.WAYLAND_API_CODE(
136-
"protocol/text_input.gen.c",
137-
"#thirdparty/wayland-protocols/unstable/text-input/text-input-unstable-v3.xml",
138-
),
139-
env.WAYLAND_API_HEADER(
140-
"protocol/xdg_foreign_v1.gen.h",
141-
"#thirdparty/wayland-protocols/unstable/xdg-foreign/xdg-foreign-unstable-v1.xml",
142-
),
143-
env.WAYLAND_API_CODE(
144-
"protocol/xdg_foreign_v1.gen.c",
145-
"#thirdparty/wayland-protocols/unstable/xdg-foreign/xdg-foreign-unstable-v1.xml",
82+
generate_from_xml(
83+
"relative_pointer", "#thirdparty/wayland-protocols/unstable/relative-pointer/relative-pointer-unstable-v1.xml"
14684
),
147-
env.WAYLAND_API_HEADER(
148-
"protocol/xdg_foreign_v2.gen.h",
149-
"#thirdparty/wayland-protocols/unstable/xdg-foreign/xdg-foreign-unstable-v2.xml",
85+
generate_from_xml("text_input", "#thirdparty/wayland-protocols/unstable/text-input/text-input-unstable-v3.xml"),
86+
generate_from_xml(
87+
"xdg_decoration", "#thirdparty/wayland-protocols/unstable/xdg-decoration/xdg-decoration-unstable-v1.xml"
15088
),
151-
env.WAYLAND_API_CODE(
152-
"protocol/xdg_foreign_v2.gen.c",
153-
"#thirdparty/wayland-protocols/unstable/xdg-foreign/xdg-foreign-unstable-v2.xml",
89+
generate_from_xml(
90+
"xdg_foreign_v1", "#thirdparty/wayland-protocols/unstable/xdg-foreign/xdg-foreign-unstable-v1.xml"
91+
), # Note: deprecated
92+
generate_from_xml(
93+
"xdg_foreign_v2", "#thirdparty/wayland-protocols/unstable/xdg-foreign/xdg-foreign-unstable-v2.xml"
15494
),
155-
env.WAYLAND_API_HEADER(
156-
"protocol/xdg_system_bell.gen.h",
157-
"#thirdparty/wayland-protocols/staging/xdg-system-bell/xdg-system-bell-v1.xml",
158-
),
159-
env.WAYLAND_API_CODE(
160-
"protocol/xdg_system_bell.gen.c",
161-
"#thirdparty/wayland-protocols/staging/xdg-system-bell/xdg-system-bell-v1.xml",
162-
),
163-
)
164-
95+
]
16596

16697
source_files = [
167-
"protocol/wayland.gen.c",
168-
"protocol/viewporter.gen.c",
169-
"protocol/cursor_shape.gen.c",
170-
"protocol/fractional_scale.gen.c",
171-
"protocol/xdg_shell.gen.c",
172-
"protocol/xdg_system_bell.gen.c",
173-
"protocol/xdg_foreign_v1.gen.c",
174-
"protocol/xdg_foreign_v2.gen.c",
175-
"protocol/xdg_decoration.gen.c",
176-
"protocol/xdg_activation.gen.c",
177-
"protocol/relative_pointer.gen.c",
178-
"protocol/pointer_constraints.gen.c",
179-
"protocol/pointer_gestures.gen.c",
180-
"protocol/primary_selection.gen.c",
181-
"protocol/idle_inhibit.gen.c",
182-
"protocol/tablet.gen.c",
183-
"protocol/text_input.gen.c",
98+
"detect_prime_egl.cpp",
18499
"display_server_wayland.cpp",
185-
"wayland_thread.cpp",
186100
"key_mapping_xkb.cpp",
187-
"detect_prime_egl.cpp",
101+
"wayland_thread.cpp",
188102
]
189103

190104
if env["use_sowrap"]:
@@ -207,8 +121,6 @@ if env["opengl3"]:
207121
source_files.append("egl_manager_wayland.cpp")
208122
source_files.append("egl_manager_wayland_gles.cpp")
209123

210-
objects = []
211-
212124
for source_file in source_files:
213125
objects.append(env.Object(source_file))
214126

0 commit comments

Comments
 (0)