BUILD.gn 4.3 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179
  1. # Copyright 2020 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/chromeos/ui_mode.gni")
  5. import("//build/config/features.gni")
  6. import("//build/config/linux/gtk/gtk.gni")
  7. import("//build/config/linux/pkg_config.gni")
  8. import("//build/config/ozone.gni")
  9. import("//build/config/ui.gni")
  10. import("//printing/buildflags/buildflags.gni")
  11. import("//testing/test.gni")
  12. import("//tools/generate_stubs/rules.gni")
  13. assert(is_linux || is_chromeos_lacros || is_chromeos,
  14. "This file should only be referenced on Linux")
  15. assert(use_gio, "GIO is required for building with GTK")
  16. source_set("gtk_types") {
  17. visibility = [ ":gtk_stubs" ]
  18. public = [ "gtk_types.h" ]
  19. }
  20. pkg_config("gtk_internal_config") {
  21. # We dlopen() GTK, so make sure not to add a link-time dependency on it.
  22. ignore_libs = true
  23. # Gtk requires gmodule, but it does not list it as a dependency in some
  24. # misconfigured systems.
  25. packages = [
  26. "gmodule-2.0",
  27. "gthread-2.0",
  28. ]
  29. if (gtk_version == 3) {
  30. packages += [
  31. "gtk+-3.0",
  32. "gtk+-unix-print-3.0",
  33. ]
  34. } else {
  35. assert(gtk_version == 4)
  36. packages += [
  37. "gtk4",
  38. "gtk4-unix-print",
  39. ]
  40. }
  41. }
  42. group("gtk_config") {
  43. public_configs = [ ":gtk_internal_config" ]
  44. }
  45. generate_stubs("gtk_stubs") {
  46. visibility = [ ":gtk" ]
  47. sigs = [
  48. "gdk_pixbuf.sigs",
  49. "gdk.sigs",
  50. "gsk.sigs",
  51. "gtk.sigs",
  52. "gio.sigs",
  53. ]
  54. extra_header = "gtk.fragment"
  55. output_name = "gtk_stubs"
  56. public_deps = [
  57. ":gtk_config",
  58. ":gtk_types",
  59. ]
  60. logging_function = "LogNoop()"
  61. logging_include = "ui/gtk/log_noop.h"
  62. }
  63. component("gtk") {
  64. visibility = [ "//ui/linux:linux_ui_factory" ]
  65. public = [ "gtk_ui_factory.h" ]
  66. sources = [
  67. "gtk_color_mixers.cc",
  68. "gtk_color_mixers.h",
  69. "gtk_compat.cc",
  70. "gtk_compat.h",
  71. "gtk_key_bindings_handler.cc",
  72. "gtk_key_bindings_handler.h",
  73. "gtk_ui.cc",
  74. "gtk_ui.h",
  75. "gtk_ui_factory.cc",
  76. "gtk_ui_platform.h",
  77. "gtk_ui_platform_stub.cc",
  78. "gtk_ui_platform_stub.h",
  79. "gtk_util.cc",
  80. "gtk_util.h",
  81. "input_method_context_impl_gtk.cc",
  82. "input_method_context_impl_gtk.h",
  83. "native_theme_gtk.cc",
  84. "native_theme_gtk.h",
  85. "nav_button_provider_gtk.cc",
  86. "nav_button_provider_gtk.h",
  87. "printing/print_dialog_gtk.cc",
  88. "printing/print_dialog_gtk.h",
  89. "printing/printing_gtk_util.cc",
  90. "printing/printing_gtk_util.h",
  91. "select_file_dialog_linux_gtk.cc",
  92. "select_file_dialog_linux_gtk.h",
  93. "settings_provider.h",
  94. "settings_provider_gsettings.cc",
  95. "settings_provider_gsettings.h",
  96. "settings_provider_gtk.cc",
  97. "settings_provider_gtk.h",
  98. "window_frame_provider_gtk.cc",
  99. "window_frame_provider_gtk.h",
  100. ]
  101. defines = [ "IS_GTK_IMPL" ]
  102. configs += [
  103. "//build/config/linux/pangocairo",
  104. "//build/linux:gio_config",
  105. ]
  106. deps = [
  107. ":gtk_stubs",
  108. "//base",
  109. "//printing/buildflags",
  110. "//skia",
  111. # GTK pulls pangoft2, which requires HarfBuzz symbols. When linking
  112. # our own HarfBuzz avoid mixing symbols from system HarfBuzz and
  113. # our own through the indirect dependency to harfbuzz-ng here.
  114. "//third_party:freetype_harfbuzz",
  115. "//ui/aura",
  116. "//ui/base",
  117. "//ui/base:buildflags",
  118. "//ui/base/ime",
  119. "//ui/base/ime/linux",
  120. "//ui/color",
  121. "//ui/color:mixers",
  122. "//ui/display",
  123. "//ui/events",
  124. "//ui/events:dom_keyboard_layout",
  125. "//ui/events:dom_keycode_converter",
  126. "//ui/gfx",
  127. "//ui/gfx:native_widget_types",
  128. "//ui/gfx/geometry",
  129. "//ui/linux:linux_ui_impl",
  130. "//ui/native_theme",
  131. "//ui/shell_dialogs",
  132. "//ui/strings",
  133. "//ui/views",
  134. "//url",
  135. ]
  136. if (enable_basic_printing) {
  137. deps += [ "//printing" ]
  138. }
  139. if (use_cups) {
  140. deps += [ "//printing/mojom" ]
  141. }
  142. if (ozone_platform_x11) {
  143. sources += [
  144. "x/gtk_event_loop_x11.cc",
  145. "x/gtk_event_loop_x11.h",
  146. "x/gtk_ui_platform_x11.cc",
  147. "x/gtk_ui_platform_x11.h",
  148. ]
  149. deps += [
  150. "//ui/base/x",
  151. "//ui/events/platform/x11",
  152. "//ui/gfx/x",
  153. ]
  154. }
  155. if (ozone_platform_wayland) {
  156. sources += [
  157. "wayland/gtk_ui_platform_wayland.cc",
  158. "wayland/gtk_ui_platform_wayland.h",
  159. ]
  160. }
  161. # TODO: This should be removed.
  162. deps += [ "//ui/ozone" ]
  163. }