| 123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145 |
- #!/usr/bin/env python
- from misc.utility.scons_hints import *
- Import("env")
- File = env.File
- # TODO: Add warning to headers and code about their autogenerated status.
- if env["use_sowrap"]:
- # We have to implement separate builders for so wrappers as the
- # autogenerated Wayland protocol wrapper must include them instead of the
- # native libraries.
- WAYLAND_BUILDERS_SOWRAP = {
- "WAYLAND_API_HEADER": Builder(
- action=env.Run(
- r"wayland-scanner -c client-header < ${SOURCE} | "
- r"sed 's:wayland-client-core\.h:../dynwrappers/wayland-client-core-so_wrap\.h:' > ${TARGET}",
- ),
- single_source=True,
- ),
- "WAYLAND_API_CODE": Builder(
- action=env.Run(
- r"wayland-scanner -c private-code < ${SOURCE} | "
- r"sed 's:wayland-util\.h:../dynwrappers/wayland-client-core-so_wrap\.h:' > ${TARGET}",
- ),
- single_source=True,
- ),
- }
- env.Append(BUILDERS=WAYLAND_BUILDERS_SOWRAP)
- else:
- WAYLAND_BUILDERS = {
- "WAYLAND_API_HEADER": Builder(
- action=env.Run(r"wayland-scanner -c client-header < ${SOURCE} > ${TARGET}"),
- single_source=True,
- ),
- "WAYLAND_API_CODE": Builder(
- action=env.Run(r"wayland-scanner -c private-code < ${SOURCE} > ${TARGET}"),
- single_source=True,
- ),
- }
- env.Append(BUILDERS=WAYLAND_BUILDERS)
- def generate_from_xml(name, path):
- header = env.WAYLAND_API_HEADER(File(f"protocol/{name}.gen.h"), path)
- source = env.WAYLAND_API_CODE(File(f"protocol/{name}.gen.c"), path)
- env.NoCache(header, source)
- return source
- generated_sources = [
- # 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"
- ),
- generate_from_xml(
- "xdg_toplevel_icon", "#thirdparty/wayland-protocols/staging/xdg-toplevel-icon/xdg-toplevel-icon-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",
- ),
- generate_from_xml(
- "pointer_gestures", "#thirdparty/wayland-protocols/unstable/pointer-gestures/pointer-gestures-unstable-v1.xml"
- ),
- generate_from_xml(
- "primary_selection",
- "#thirdparty/wayland-protocols/unstable/primary-selection/primary-selection-unstable-v1.xml",
- ),
- generate_from_xml(
- "relative_pointer", "#thirdparty/wayland-protocols/unstable/relative-pointer/relative-pointer-unstable-v1.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"
- ),
- 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"
- ),
- generate_from_xml("linux_dmabuf_v1", "#thirdparty/wayland-protocols/stable/linux-dmabuf/linux-dmabuf-v1.xml"),
- generate_from_xml(
- "linux_explicit_synchronization_unstable_v1",
- "#thirdparty/wayland-protocols/unstable/linux-explicit-synchronization/linux-explicit-synchronization-unstable-v1.xml",
- ),
- generate_from_xml("fifo_v1", "#thirdparty/wayland-protocols/staging/fifo/fifo-v1.xml"),
- generate_from_xml("commit_timing_v1", "#thirdparty/wayland-protocols/staging/commit-timing/commit-timing-v1.xml"),
- generate_from_xml(
- "linux_drm_syncobj_v1", "#thirdparty/wayland-protocols/staging/linux-drm-syncobj/linux-drm-syncobj-v1.xml"
- ),
- generate_from_xml(
- "tearing_control_v1", "#thirdparty/wayland-protocols/staging/tearing-control/tearing-control-v1.xml"
- ),
- generate_from_xml("wayland-drm", "#thirdparty/wayland-protocols/mesa/wayland-drm.xml"),
- generate_from_xml("godot_embedding_compositor", "godot-embedding-compositor.xml"),
- ]
- source_files = generated_sources + [
- File("detect_prime_egl.cpp"),
- File("display_server_wayland.cpp"),
- File("key_mapping_xkb.cpp"),
- File("wayland_thread.cpp"),
- File("wayland_embedder.cpp"),
- ]
- if env["use_sowrap"]:
- source_files.append(
- [
- File("dynwrappers/wayland-cursor-so_wrap.c"),
- File("dynwrappers/wayland-client-core-so_wrap.c"),
- File("dynwrappers/wayland-egl-core-so_wrap.c"),
- ]
- )
- if env["libdecor"]:
- source_files.append(File("dynwrappers/libdecor-so_wrap.c"))
- if env["vulkan"]:
- source_files.append(File("rendering_context_driver_vulkan_wayland.cpp"))
- if env["opengl3"]:
- source_files.append(File("egl_manager_wayland.cpp"))
- source_files.append(File("egl_manager_wayland_gles.cpp"))
- Return("source_files")
|