Explorar o código

Wayland: Simplify including protocols

ArchercatNEO hai 1 mes
pai
achega
367cabf692

+ 48 - 136
platform/linuxbsd/wayland/SCsub

@@ -39,152 +39,66 @@ else:
     }
     }
     env.Append(BUILDERS=WAYLAND_BUILDERS)
     env.Append(BUILDERS=WAYLAND_BUILDERS)
 
 
-env.NoCache(
-    env.WAYLAND_API_HEADER("protocol/wayland.gen.h", "#thirdparty/wayland/protocol/wayland.xml"),
-    env.WAYLAND_API_CODE("protocol/wayland.gen.c", "#thirdparty/wayland/protocol/wayland.xml"),
-    env.WAYLAND_API_HEADER(
-        "protocol/viewporter.gen.h", "#thirdparty/wayland-protocols/stable/viewporter/viewporter.xml"
-    ),
-    env.WAYLAND_API_CODE("protocol/viewporter.gen.c", "#thirdparty/wayland-protocols/stable/viewporter/viewporter.xml"),
-    env.WAYLAND_API_HEADER(
-        "protocol/cursor_shape.gen.h",
-        "#thirdparty/wayland-protocols/staging/cursor-shape/cursor-shape-v1.xml",
-    ),
-    env.WAYLAND_API_CODE(
-        "protocol/cursor_shape.gen.c",
-        "#thirdparty/wayland-protocols/staging/cursor-shape/cursor-shape-v1.xml",
-    ),
-    env.WAYLAND_API_HEADER(
-        "protocol/fractional_scale.gen.h",
-        "#thirdparty/wayland-protocols/staging/fractional-scale/fractional-scale-v1.xml",
-    ),
-    env.WAYLAND_API_CODE(
-        "protocol/fractional_scale.gen.c",
-        "#thirdparty/wayland-protocols/staging/fractional-scale/fractional-scale-v1.xml",
-    ),
-    env.WAYLAND_API_HEADER("protocol/xdg_shell.gen.h", "#thirdparty/wayland-protocols/stable/xdg-shell/xdg-shell.xml"),
-    env.WAYLAND_API_CODE("protocol/xdg_shell.gen.c", "#thirdparty/wayland-protocols/stable/xdg-shell/xdg-shell.xml"),
-    env.WAYLAND_API_HEADER(
-        "protocol/xdg_decoration.gen.h",
-        "#thirdparty/wayland-protocols/unstable/xdg-decoration/xdg-decoration-unstable-v1.xml",
-    ),
-    env.WAYLAND_API_CODE(
-        "protocol/xdg_decoration.gen.c",
-        "#thirdparty/wayland-protocols/unstable/xdg-decoration/xdg-decoration-unstable-v1.xml",
-    ),
-    env.WAYLAND_API_HEADER(
-        "protocol/xdg_activation.gen.h",
-        "#thirdparty/wayland-protocols/staging/xdg-activation/xdg-activation-v1.xml",
-    ),
-    env.WAYLAND_API_CODE(
-        "protocol/xdg_activation.gen.c",
-        "#thirdparty/wayland-protocols/staging/xdg-activation/xdg-activation-v1.xml",
-    ),
-    env.WAYLAND_API_HEADER(
-        "protocol/relative_pointer.gen.h",
-        "#thirdparty/wayland-protocols/unstable/relative-pointer/relative-pointer-unstable-v1.xml",
-    ),
-    env.WAYLAND_API_CODE(
-        "protocol/relative_pointer.gen.c",
-        "#thirdparty/wayland-protocols/unstable/relative-pointer/relative-pointer-unstable-v1.xml",
-    ),
-    env.WAYLAND_API_HEADER(
-        "protocol/pointer_constraints.gen.h",
-        "#thirdparty/wayland-protocols/unstable/pointer-constraints/pointer-constraints-unstable-v1.xml",
-    ),
-    env.WAYLAND_API_CODE(
-        "protocol/pointer_constraints.gen.c",
+
+def generate_from_xml(name, path):
+    header = env.WAYLAND_API_HEADER(f"protocol/{name}.gen.h", path)
+    source = env.WAYLAND_API_CODE(f"protocol/{name}.gen.c", path)
+    env.NoCache(header, source)
+
+    return env.Object(f"protocol/{name}.gen.c")
+
+
+objects = [
+    # Core protocol
+    generate_from_xml("wayland", "#thirdparty/wayland/protocol/wayland.xml"),
+    # Stable protocols
+    generate_from_xml("tablet", "#thirdparty/wayland-protocols/stable/tablet/tablet-v2.xml"),
+    generate_from_xml("viewporter", "#thirdparty/wayland-protocols/stable/viewporter/viewporter.xml"),
+    generate_from_xml("xdg_shell", "#thirdparty/wayland-protocols/stable/xdg-shell/xdg-shell.xml"),
+    # Staging protocols
+    generate_from_xml("cursor_shape", "#thirdparty/wayland-protocols/staging/cursor-shape/cursor-shape-v1.xml"),
+    generate_from_xml(
+        "fractional_scale", "#thirdparty/wayland-protocols/staging/fractional-scale/fractional-scale-v1.xml"
+    ),
+    generate_from_xml("xdg_activation", "#thirdparty/wayland-protocols/staging/xdg-activation/xdg-activation-v1.xml"),
+    generate_from_xml(
+        "xdg_system_bell", "#thirdparty/wayland-protocols/staging/xdg-system-bell/xdg-system-bell-v1.xml"
+    ),
+    # Unstable protocols
+    generate_from_xml(
+        "idle_inhibit", "#thirdparty/wayland-protocols/unstable/idle-inhibit/idle-inhibit-unstable-v1.xml"
+    ),
+    generate_from_xml(
+        "pointer_constraints",
         "#thirdparty/wayland-protocols/unstable/pointer-constraints/pointer-constraints-unstable-v1.xml",
         "#thirdparty/wayland-protocols/unstable/pointer-constraints/pointer-constraints-unstable-v1.xml",
     ),
     ),
-    env.WAYLAND_API_HEADER(
-        "protocol/pointer_gestures.gen.h",
-        "#thirdparty/wayland-protocols/unstable/pointer-gestures/pointer-gestures-unstable-v1.xml",
-    ),
-    env.WAYLAND_API_CODE(
-        "protocol/pointer_gestures.gen.c",
-        "#thirdparty/wayland-protocols/unstable/pointer-gestures/pointer-gestures-unstable-v1.xml",
+    generate_from_xml(
+        "pointer_gestures", "#thirdparty/wayland-protocols/unstable/pointer-gestures/pointer-gestures-unstable-v1.xml"
     ),
     ),
-    env.WAYLAND_API_HEADER(
-        "protocol/primary_selection.gen.h",
+    generate_from_xml(
+        "primary_selection",
         "#thirdparty/wayland-protocols/unstable/primary-selection/primary-selection-unstable-v1.xml",
         "#thirdparty/wayland-protocols/unstable/primary-selection/primary-selection-unstable-v1.xml",
     ),
     ),
-    env.WAYLAND_API_CODE(
-        "protocol/primary_selection.gen.c",
-        "#thirdparty/wayland-protocols/unstable/primary-selection/primary-selection-unstable-v1.xml",
-    ),
-    env.WAYLAND_API_HEADER(
-        "protocol/idle_inhibit.gen.h",
-        "#thirdparty/wayland-protocols/unstable/idle-inhibit/idle-inhibit-unstable-v1.xml",
-    ),
-    env.WAYLAND_API_CODE(
-        "protocol/idle_inhibit.gen.c",
-        "#thirdparty/wayland-protocols/unstable/idle-inhibit/idle-inhibit-unstable-v1.xml",
-    ),
-    env.WAYLAND_API_HEADER(
-        "protocol/tablet.gen.h",
-        "#thirdparty/wayland-protocols/unstable/tablet/tablet-unstable-v2.xml",
-    ),
-    env.WAYLAND_API_CODE(
-        "protocol/tablet.gen.c",
-        "#thirdparty/wayland-protocols/unstable/tablet/tablet-unstable-v2.xml",
-    ),
-    env.WAYLAND_API_HEADER(
-        "protocol/text_input.gen.h",
-        "#thirdparty/wayland-protocols/unstable/text-input/text-input-unstable-v3.xml",
-    ),
-    env.WAYLAND_API_CODE(
-        "protocol/text_input.gen.c",
-        "#thirdparty/wayland-protocols/unstable/text-input/text-input-unstable-v3.xml",
-    ),
-    env.WAYLAND_API_HEADER(
-        "protocol/xdg_foreign_v1.gen.h",
-        "#thirdparty/wayland-protocols/unstable/xdg-foreign/xdg-foreign-unstable-v1.xml",
-    ),
-    env.WAYLAND_API_CODE(
-        "protocol/xdg_foreign_v1.gen.c",
-        "#thirdparty/wayland-protocols/unstable/xdg-foreign/xdg-foreign-unstable-v1.xml",
+    generate_from_xml(
+        "relative_pointer", "#thirdparty/wayland-protocols/unstable/relative-pointer/relative-pointer-unstable-v1.xml"
     ),
     ),
-    env.WAYLAND_API_HEADER(
-        "protocol/xdg_foreign_v2.gen.h",
-        "#thirdparty/wayland-protocols/unstable/xdg-foreign/xdg-foreign-unstable-v2.xml",
+    generate_from_xml("text_input", "#thirdparty/wayland-protocols/unstable/text-input/text-input-unstable-v3.xml"),
+    generate_from_xml(
+        "xdg_decoration", "#thirdparty/wayland-protocols/unstable/xdg-decoration/xdg-decoration-unstable-v1.xml"
     ),
     ),
-    env.WAYLAND_API_CODE(
-        "protocol/xdg_foreign_v2.gen.c",
-        "#thirdparty/wayland-protocols/unstable/xdg-foreign/xdg-foreign-unstable-v2.xml",
+    generate_from_xml(
+        "xdg_foreign_v1", "#thirdparty/wayland-protocols/unstable/xdg-foreign/xdg-foreign-unstable-v1.xml"
+    ),  # Note: deprecated
+    generate_from_xml(
+        "xdg_foreign_v2", "#thirdparty/wayland-protocols/unstable/xdg-foreign/xdg-foreign-unstable-v2.xml"
     ),
     ),
-    env.WAYLAND_API_HEADER(
-        "protocol/xdg_system_bell.gen.h",
-        "#thirdparty/wayland-protocols/staging/xdg-system-bell/xdg-system-bell-v1.xml",
-    ),
-    env.WAYLAND_API_CODE(
-        "protocol/xdg_system_bell.gen.c",
-        "#thirdparty/wayland-protocols/staging/xdg-system-bell/xdg-system-bell-v1.xml",
-    ),
-)
-
+]
 
 
 source_files = [
 source_files = [
-    "protocol/wayland.gen.c",
-    "protocol/viewporter.gen.c",
-    "protocol/cursor_shape.gen.c",
-    "protocol/fractional_scale.gen.c",
-    "protocol/xdg_shell.gen.c",
-    "protocol/xdg_system_bell.gen.c",
-    "protocol/xdg_foreign_v1.gen.c",
-    "protocol/xdg_foreign_v2.gen.c",
-    "protocol/xdg_decoration.gen.c",
-    "protocol/xdg_activation.gen.c",
-    "protocol/relative_pointer.gen.c",
-    "protocol/pointer_constraints.gen.c",
-    "protocol/pointer_gestures.gen.c",
-    "protocol/primary_selection.gen.c",
-    "protocol/idle_inhibit.gen.c",
-    "protocol/tablet.gen.c",
-    "protocol/text_input.gen.c",
+    "detect_prime_egl.cpp",
     "display_server_wayland.cpp",
     "display_server_wayland.cpp",
-    "wayland_thread.cpp",
     "key_mapping_xkb.cpp",
     "key_mapping_xkb.cpp",
-    "detect_prime_egl.cpp",
+    "wayland_thread.cpp",
 ]
 ]
 
 
 if env["use_sowrap"]:
 if env["use_sowrap"]:
@@ -207,8 +121,6 @@ if env["opengl3"]:
     source_files.append("egl_manager_wayland.cpp")
     source_files.append("egl_manager_wayland.cpp")
     source_files.append("egl_manager_wayland_gles.cpp")
     source_files.append("egl_manager_wayland_gles.cpp")
 
 
-objects = []
-
 for source_file in source_files:
 for source_file in source_files:
     objects.append(env.Object(source_file))
     objects.append(env.Object(source_file))
 
 

+ 0 - 0
thirdparty/wayland-protocols/unstable/tablet/README → thirdparty/wayland-protocols/stable/tablet/README


+ 0 - 0
thirdparty/wayland-protocols/unstable/tablet/tablet-unstable-v2.xml → thirdparty/wayland-protocols/stable/tablet/tablet-v2.xml