BUILD.gn 6.1 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206207208209210211212213214215216217218219220221222223224225226227228229230231232233234235236237238239240241242243244245
  1. # Copyright 2015 The Chromium Authors. All rights reserved.
  2. # Use of this source code is governed by a BSD-style license that can be
  3. # found in the LICENSE file.
  4. import("//build/config/linux/pkg_config.gni")
  5. import("//third_party/wayland/features.gni")
  6. import("//tools/generate_stubs/rules.gni")
  7. if (!use_system_libwayland) {
  8. config("wayland_config") {
  9. include_dirs = [
  10. "include",
  11. "include/src",
  12. "include/protocol",
  13. "src/cursor",
  14. "src/egl",
  15. "src/src",
  16. ]
  17. # TODO(thomasanderson): Remove this once
  18. # https://patchwork.freedesktop.org/patch/242086/ lands.
  19. cflags = [ "-Wno-macro-redefined" ]
  20. }
  21. source_set("wayland_util") {
  22. sources = [
  23. "src/src/wayland-private.h",
  24. "src/src/wayland-util.c",
  25. "src/src/wayland-util.h",
  26. ]
  27. configs -= [ "//build/config/compiler:chromium_code" ]
  28. configs += [ "//build/config/compiler:no_chromium_code" ]
  29. public_configs = [ ":wayland_config" ]
  30. }
  31. static_library("wayland_private") {
  32. sources = [
  33. "src/src/connection.c",
  34. "src/src/wayland-os.c",
  35. "src/src/wayland-os.h",
  36. ]
  37. deps = [ ":wayland_util" ]
  38. configs -= [ "//build/config/compiler:chromium_code" ]
  39. configs += [
  40. "//build/config/compiler:no_chromium_code",
  41. "//build/config/linux/libffi",
  42. ":wayland_config",
  43. ]
  44. }
  45. static_library("wayland_protocol") {
  46. sources = [ "protocol/wayland-protocol.c" ]
  47. deps = [ ":wayland_util" ]
  48. configs -= [ "//build/config/compiler:chromium_code" ]
  49. configs += [ "//build/config/compiler:no_chromium_code" ]
  50. public_configs = [ ":wayland_config" ]
  51. }
  52. static_library("wayland_server") {
  53. sources = [
  54. "include/protocol/wayland-server-protocol.h",
  55. "src/src/event-loop.c",
  56. "src/src/wayland-server.c",
  57. "src/src/wayland-shm.c",
  58. ]
  59. include_dirs = [ "include/" ]
  60. deps = [
  61. ":wayland_private",
  62. ":wayland_protocol",
  63. ":wayland_util",
  64. ]
  65. configs -= [ "//build/config/compiler:chromium_code" ]
  66. configs += [
  67. "//build/config/compiler:no_chromium_code",
  68. "//build/config/linux/libffi",
  69. ]
  70. public_configs = [ ":wayland_config" ]
  71. }
  72. static_library("wayland_client") {
  73. sources = [
  74. "include/protocol/wayland-client-protocol.h",
  75. "src/src/wayland-client.c",
  76. ]
  77. deps = [
  78. ":wayland_private",
  79. ":wayland_protocol",
  80. ":wayland_util",
  81. ]
  82. configs -= [ "//build/config/compiler:chromium_code" ]
  83. configs += [
  84. "//build/config/compiler:no_chromium_code",
  85. "//build/config/linux/libffi",
  86. ]
  87. public_configs = [ ":wayland_config" ]
  88. }
  89. static_library("wayland_egl") {
  90. sources = [
  91. "src/egl/wayland-egl-backend.h",
  92. "src/egl/wayland-egl-core.h",
  93. "src/egl/wayland-egl.c",
  94. "src/egl/wayland-egl.h",
  95. ]
  96. deps = [ ":wayland_util" ]
  97. configs -= [ "//build/config/compiler:chromium_code" ]
  98. configs += [ "//build/config/compiler:no_chromium_code" ]
  99. public_configs = [ ":wayland_config" ]
  100. }
  101. static_library("wayland_cursor") {
  102. sources = [
  103. "src/cursor/cursor-data.h",
  104. "src/cursor/os-compatibility.c",
  105. "src/cursor/os-compatibility.h",
  106. "src/cursor/wayland-cursor.c",
  107. "src/cursor/wayland-cursor.h",
  108. "src/cursor/xcursor.c",
  109. "src/cursor/xcursor.h",
  110. ]
  111. configs -= [ "//build/config/compiler:chromium_code" ]
  112. configs += [ "//build/config/compiler:no_chromium_code" ]
  113. public_configs = [ ":wayland_config" ]
  114. }
  115. }
  116. if (!use_system_wayland_scanner) {
  117. config("wayland_scanner_config") {
  118. cflags = [
  119. "-Wno-int-conversion",
  120. "-Wno-implicit-function-declaration",
  121. ]
  122. include_dirs = [ "include/" ]
  123. }
  124. executable("wayland_scanner") {
  125. sources = [ "src/src/scanner.c" ]
  126. deps = [
  127. ":wayland_util",
  128. "//third_party/expat:expat",
  129. ]
  130. configs -= [ "//build/config/compiler:chromium_code" ]
  131. configs += [
  132. "//build/config/compiler:no_chromium_code",
  133. ":wayland_scanner_config",
  134. ]
  135. }
  136. }
  137. if (use_system_libwayland) {
  138. pkg_config("wayland_client_config") {
  139. packages = [ "wayland-client" ]
  140. }
  141. pkg_config("wayland_cursor_config") {
  142. packages = [ "wayland-cursor" ]
  143. }
  144. pkg_config("wayland_server_config") {
  145. packages = [ "wayland-server" ]
  146. }
  147. pkg_config("wayland_egl_config") {
  148. packages = [ "wayland-egl" ]
  149. }
  150. group("wayland_client") {
  151. public_configs = [ ":wayland_client_config" ]
  152. }
  153. group("wayland_cursor") {
  154. public_configs = [ ":wayland_cursor_config" ]
  155. }
  156. group("wayland_server") {
  157. public_configs = [ ":wayland_server_config" ]
  158. }
  159. group("wayland_util") {
  160. public_configs = [ ":wayland_client_config" ]
  161. }
  162. group("wayland_egl") {
  163. public_configs = [ ":wayland_egl_config" ]
  164. }
  165. generate_stubs("wayland_wrappers") {
  166. visibility = [ ":wayland_stubs" ]
  167. extra_header = "stubs/libwayland.fragment"
  168. sigs = [
  169. "stubs/libwayland-client.sigs",
  170. "stubs/libwayland-cursor.sigs",
  171. "stubs/libwayland-egl.sigs",
  172. ]
  173. output_name = "libwayland_stubs"
  174. deps = [ "//base" ]
  175. }
  176. # This is a source_set, not a component, because we don't want to leak
  177. # our own wayland symbols in component builds, which can interfere with
  178. # the system libEGL's usage of wayland.
  179. source_set("wayland_stubs") {
  180. public_deps = [ ":wayland_wrappers" ]
  181. sources = [
  182. # Provide data symbols which generate_stubs.py cannot wrap -- only
  183. # functions are wrappable. wayland-protocol.c contains only data and
  184. # no code.
  185. "protocol/wayland-protocol.c",
  186. # Provide implementations of C variadic functions, which
  187. # generate_stubs.py cannot generate forwarding-functions for.
  188. "stubs/libwayland_variadic_support.cc",
  189. ]
  190. # This is a hack to hide the symbols annoted with
  191. # attribute((visibility("default"))) in wayland-protocol.c since libwayland
  192. # currently doesn't provide a way to override this behavior. This can be
  193. # removed once https://gitlab.freedesktop.org/wayland/wayland/-/issues/179
  194. # is fixed and we can switch to overriding WL_EXPORT directly.
  195. defines = [ "visibility(x)=visibility(\"hidden\")" ]
  196. }
  197. }