SCsub 6.5 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197
  1. #!/usr/bin/env python
  2. Import("env")
  3. # TODO: Add warning to headers and code about their autogenerated status.
  4. if env["use_sowrap"]:
  5. # We have to implement separate builders for so wrappers as the
  6. # autogenerated Wayland protocol wrapper must include them instead of the
  7. # native libraries.
  8. WAYLAND_BUILDERS_SOWRAP = {
  9. "WAYLAND_API_HEADER": Builder(
  10. action=Action(
  11. "wayland-scanner -c client-header < ${SOURCE} | sed 's:wayland-client-core\.h:../dynwrappers/wayland-client-core-so_wrap\.h:' > ${TARGET}",
  12. 'Generating Wayland client header: "${TARGET}"',
  13. ),
  14. single_source=True,
  15. ),
  16. "WAYLAND_API_CODE": Builder(
  17. action=Action(
  18. "wayland-scanner -c private-code < ${SOURCE} | sed 's:wayland-util\.h:../dynwrappers/wayland-client-core-so_wrap\.h:' > ${TARGET}",
  19. 'Generating Wayland protocol marshalling code: "${TARGET}"',
  20. ),
  21. single_source=True,
  22. ),
  23. }
  24. env.Append(BUILDERS=WAYLAND_BUILDERS_SOWRAP)
  25. else:
  26. WAYLAND_BUILDERS = {
  27. "WAYLAND_API_HEADER": Builder(
  28. action=Action(
  29. "wayland-scanner -c client-header < ${SOURCE} > ${TARGET}",
  30. 'Generating Wayland client header: "${TARGET}"',
  31. ),
  32. single_source=True,
  33. ),
  34. "WAYLAND_API_CODE": Builder(
  35. action=Action(
  36. "wayland-scanner -c private-code < ${SOURCE} > ${TARGET}",
  37. 'Generating Wayland protocol marshalling code: "${TARGET}"',
  38. ),
  39. single_source=True,
  40. ),
  41. }
  42. env.Append(BUILDERS=WAYLAND_BUILDERS)
  43. env.WAYLAND_API_HEADER(target="protocol/wayland.gen.h", source="#thirdparty/wayland/protocol/wayland.xml")
  44. env.WAYLAND_API_CODE(target="protocol/wayland.gen.c", source="#thirdparty/wayland/protocol/wayland.xml")
  45. env.WAYLAND_API_HEADER(
  46. target="protocol/viewporter.gen.h", source="#thirdparty/wayland-protocols/stable/viewporter/viewporter.xml"
  47. )
  48. env.WAYLAND_API_CODE(
  49. target="protocol/viewporter.gen.c", source="#thirdparty/wayland-protocols/stable/viewporter/viewporter.xml"
  50. )
  51. env.WAYLAND_API_HEADER(
  52. target="protocol/fractional_scale.gen.h",
  53. source="#thirdparty/wayland-protocols/staging/fractional-scale/fractional-scale-v1.xml",
  54. )
  55. env.WAYLAND_API_CODE(
  56. target="protocol/fractional_scale.gen.c",
  57. source="#thirdparty/wayland-protocols/staging/fractional-scale/fractional-scale-v1.xml",
  58. )
  59. env.WAYLAND_API_HEADER(
  60. target="protocol/xdg_shell.gen.h", source="#thirdparty/wayland-protocols/stable/xdg-shell/xdg-shell.xml"
  61. )
  62. env.WAYLAND_API_CODE(
  63. target="protocol/xdg_shell.gen.c", source="#thirdparty/wayland-protocols/stable/xdg-shell/xdg-shell.xml"
  64. )
  65. env.WAYLAND_API_HEADER(
  66. target="protocol/xdg_decoration.gen.h",
  67. source="#thirdparty/wayland-protocols/unstable/xdg-decoration/xdg-decoration-unstable-v1.xml",
  68. )
  69. env.WAYLAND_API_CODE(
  70. target="protocol/xdg_decoration.gen.c",
  71. source="#thirdparty/wayland-protocols/unstable/xdg-decoration/xdg-decoration-unstable-v1.xml",
  72. )
  73. env.WAYLAND_API_HEADER(
  74. target="protocol/xdg_activation.gen.h",
  75. source="#thirdparty/wayland-protocols/staging/xdg-activation/xdg-activation-v1.xml",
  76. )
  77. env.WAYLAND_API_CODE(
  78. target="protocol/xdg_activation.gen.c",
  79. source="#thirdparty/wayland-protocols/staging/xdg-activation/xdg-activation-v1.xml",
  80. )
  81. env.WAYLAND_API_HEADER(
  82. target="protocol/relative_pointer.gen.h",
  83. source="#thirdparty/wayland-protocols/unstable/relative-pointer/relative-pointer-unstable-v1.xml",
  84. )
  85. env.WAYLAND_API_CODE(
  86. target="protocol/relative_pointer.gen.c",
  87. source="#thirdparty/wayland-protocols/unstable/relative-pointer/relative-pointer-unstable-v1.xml",
  88. )
  89. env.WAYLAND_API_HEADER(
  90. target="protocol/pointer_constraints.gen.h",
  91. source="#thirdparty/wayland-protocols/unstable/pointer-constraints/pointer-constraints-unstable-v1.xml",
  92. )
  93. env.WAYLAND_API_CODE(
  94. target="protocol/pointer_constraints.gen.c",
  95. source="#thirdparty/wayland-protocols/unstable/pointer-constraints/pointer-constraints-unstable-v1.xml",
  96. )
  97. env.WAYLAND_API_HEADER(
  98. target="protocol/pointer_gestures.gen.h",
  99. source="#thirdparty/wayland-protocols/unstable/pointer-gestures/pointer-gestures-unstable-v1.xml",
  100. )
  101. env.WAYLAND_API_CODE(
  102. target="protocol/pointer_gestures.gen.c",
  103. source="#thirdparty/wayland-protocols/unstable/pointer-gestures/pointer-gestures-unstable-v1.xml",
  104. )
  105. env.WAYLAND_API_HEADER(
  106. target="protocol/primary_selection.gen.h",
  107. source="#thirdparty/wayland-protocols/unstable/primary-selection/primary-selection-unstable-v1.xml",
  108. )
  109. env.WAYLAND_API_CODE(
  110. target="protocol/primary_selection.gen.c",
  111. source="#thirdparty/wayland-protocols/unstable/primary-selection/primary-selection-unstable-v1.xml",
  112. )
  113. env.WAYLAND_API_HEADER(
  114. target="protocol/idle_inhibit.gen.h",
  115. source="#thirdparty/wayland-protocols/unstable/idle-inhibit/idle-inhibit-unstable-v1.xml",
  116. )
  117. env.WAYLAND_API_CODE(
  118. target="protocol/idle_inhibit.gen.c",
  119. source="#thirdparty/wayland-protocols/unstable/idle-inhibit/idle-inhibit-unstable-v1.xml",
  120. )
  121. env.WAYLAND_API_HEADER(
  122. target="protocol/tablet.gen.h",
  123. source="#thirdparty/wayland-protocols/unstable/tablet/tablet-unstable-v2.xml",
  124. )
  125. env.WAYLAND_API_CODE(
  126. target="protocol/tablet.gen.c",
  127. source="#thirdparty/wayland-protocols/unstable/tablet/tablet-unstable-v2.xml",
  128. )
  129. source_files = [
  130. "protocol/wayland.gen.c",
  131. "protocol/viewporter.gen.c",
  132. "protocol/fractional_scale.gen.c",
  133. "protocol/xdg_shell.gen.c",
  134. "protocol/xdg_decoration.gen.c",
  135. "protocol/xdg_activation.gen.c",
  136. "protocol/relative_pointer.gen.c",
  137. "protocol/pointer_constraints.gen.c",
  138. "protocol/pointer_gestures.gen.c",
  139. "protocol/primary_selection.gen.c",
  140. "protocol/idle_inhibit.gen.c",
  141. "protocol/tablet.gen.c",
  142. "display_server_wayland.cpp",
  143. "wayland_thread.cpp",
  144. "key_mapping_xkb.cpp",
  145. "detect_prime_egl.cpp",
  146. ]
  147. if env["use_sowrap"]:
  148. source_files.append(
  149. [
  150. "dynwrappers/wayland-cursor-so_wrap.c",
  151. "dynwrappers/wayland-client-core-so_wrap.c",
  152. "dynwrappers/wayland-egl-core-so_wrap.c",
  153. ]
  154. )
  155. if env["libdecor"]:
  156. source_files.append("dynwrappers/libdecor-so_wrap.c")
  157. if env["vulkan"]:
  158. source_files.append("vulkan_context_wayland.cpp")
  159. if env["opengl3"]:
  160. source_files.append("egl_manager_wayland.cpp")
  161. objects = []
  162. for source_file in source_files:
  163. objects.append(env.Object(source_file))
  164. Return("objects")