SCsub 7.7 KB

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