godot/platform/linuxbsd/wayland/SCsub

Ignoring revisions in .git-blame-ignore-revs. Click here to bypass and see the normal blame view.

130 lines
4.8 KiB
Text
Raw Normal View History

#!/usr/bin/env python
from misc.utility.scons_hints import *
Import("env")
2025-10-08 17:11:20 -05:00
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)
2025-06-10 08:06:03 +01:00
def generate_from_xml(name, path):
2025-10-08 17:11:20 -05:00
header = env.WAYLAND_API_HEADER(File(f"protocol/{name}.gen.h"), path)
source = env.WAYLAND_API_CODE(File(f"protocol/{name}.gen.c"), path)
2025-06-10 08:06:03 +01:00
env.NoCache(header, source)
2025-10-08 17:11:20 -05:00
return source
2025-06-10 08:06:03 +01:00
2025-10-08 17:11:20 -05:00
generated_sources = [
2025-06-10 08:06:03 +01:00
# 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"
),
2025-06-10 08:06:03 +01:00
# 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",
),
2025-06-10 08:06:03 +01:00
generate_from_xml(
"pointer_gestures", "#thirdparty/wayland-protocols/unstable/pointer-gestures/pointer-gestures-unstable-v1.xml"
),
2025-06-10 08:06:03 +01:00
generate_from_xml(
"primary_selection",
"#thirdparty/wayland-protocols/unstable/primary-selection/primary-selection-unstable-v1.xml",
),
2025-06-10 08:06:03 +01:00
generate_from_xml(
"relative_pointer", "#thirdparty/wayland-protocols/unstable/relative-pointer/relative-pointer-unstable-v1.xml"
),
2025-06-10 08:06:03 +01:00
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"
),
2025-06-10 08:06:03 +01:00
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"
),
2025-06-10 08:06:03 +01:00
]
2024-11-17 22:40:39 +02:00
2025-10-08 17:11:20 -05:00
source_files = generated_sources + [
File("detect_prime_egl.cpp"),
File("display_server_wayland.cpp"),
File("key_mapping_xkb.cpp"),
File("wayland_thread.cpp"),
]
if env["use_sowrap"]:
source_files.append(
[
2025-10-08 17:11:20 -05:00
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"]:
2025-10-08 17:11:20 -05:00
source_files.append(File("dynwrappers/libdecor-so_wrap.c"))
if env["vulkan"]:
2025-10-08 17:11:20 -05:00
source_files.append(File("rendering_context_driver_vulkan_wayland.cpp"))
if env["opengl3"]:
2025-10-08 17:11:20 -05:00
source_files.append(File("egl_manager_wayland.cpp"))
source_files.append(File("egl_manager_wayland_gles.cpp"))
2025-10-08 17:11:20 -05:00
Return("source_files")