BUILD.gn 4.2 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159
  1. # Copyright 2021 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("//printing/buildflags/buildflags.gni")
  6. if (use_cups && is_chromeos) {
  7. import("//printing/backend/tools/code_generator.gni")
  8. ipp_handler_map_path = "$target_gen_dir/backend/ipp_handler_map.cc"
  9. ipp_code_generate("ipp_handlers_generate") {
  10. outputs = [ ipp_handler_map_path ]
  11. args = [ "--ipp-handler-map=" +
  12. rebase_path(ipp_handler_map_path, root_build_dir) ]
  13. }
  14. }
  15. component("backend") {
  16. # Avoid producing a very generic "backend.dll" or "libbackend.so".
  17. output_name = "printing_backend"
  18. sources = [
  19. "print_backend.cc",
  20. "print_backend.h",
  21. "print_backend_consts.cc",
  22. "print_backend_consts.h",
  23. "print_backend_dummy.cc",
  24. "print_backend_utils.cc",
  25. "print_backend_utils.h",
  26. "printing_restrictions.cc",
  27. "printing_restrictions.h",
  28. ]
  29. public_configs = []
  30. cflags = []
  31. defines = [ "IS_PRINT_BACKEND_IMPL" ]
  32. public_deps = [ "//printing/buildflags" ]
  33. deps = [
  34. "//base",
  35. "//build:chromeos_buildflags",
  36. "//printing:printing_base",
  37. "//printing/mojom",
  38. "//ui/gfx/geometry",
  39. "//url",
  40. ]
  41. if (is_chromeos) {
  42. # PRINT_BACKEND_AVAILABLE disables the default dummy implementation
  43. # print backend and enables a custom implementation instead.
  44. defines += [ "PRINT_BACKEND_AVAILABLE" ]
  45. sources += [ "print_backend_chromeos.cc" ]
  46. }
  47. if (is_win) {
  48. # PRINT_BACKEND_AVAILABLE disables the default dummy implementation of the
  49. # print backend and enables a custom implementation instead.
  50. defines += [ "PRINT_BACKEND_AVAILABLE" ]
  51. sources += [
  52. "print_backend_win.cc",
  53. "printing_info_win.cc",
  54. "printing_info_win.h",
  55. "win_helper.cc",
  56. "win_helper.h",
  57. ]
  58. deps += [ "//services/data_decoder/public/cpp:safe_xml_parser" ]
  59. }
  60. if (use_cups) {
  61. public_configs += [ "//printing:cups" ]
  62. if (is_linux || is_chromeos) {
  63. # CUPS 1.6 deprecated the PPD APIs, but we will stay with this API
  64. # for now as the suitability of the replacement is unclear.
  65. # More info: crbug.com/226176
  66. cflags += [ "-Wno-deprecated-declarations" ]
  67. }
  68. if (is_mac) {
  69. # CUPS 1.6 deprecated the PPD APIs. We need to evaluate the
  70. # effect of migrating Mac. More info: crbug.com/226176
  71. cflags += [ "-Wno-deprecated-declarations" ]
  72. }
  73. # PRINT_BACKEND_AVAILABLE disables the default dummy implementation
  74. # of the print backend and enables a custom implementation instead.
  75. defines += [ "PRINT_BACKEND_AVAILABLE" ]
  76. if (use_cups_ipp) {
  77. sources += [
  78. "cups_connection.cc",
  79. "cups_connection.h",
  80. "cups_deleters.cc",
  81. "cups_deleters.h",
  82. "cups_ipp_constants.cc",
  83. "cups_ipp_constants.h",
  84. "cups_ipp_helper.cc",
  85. "cups_ipp_helper.h",
  86. "cups_ipp_utils.cc",
  87. "cups_ipp_utils.h",
  88. "cups_jobs.cc",
  89. "cups_jobs.h",
  90. "cups_printer.cc",
  91. "cups_printer.h",
  92. "print_backend_cups_ipp.cc",
  93. "print_backend_cups_ipp.h",
  94. ]
  95. }
  96. if (is_chromeos) {
  97. deps += [ ":ipp_handlers_generate" ]
  98. sources += [
  99. "cups_connection_pool.cc",
  100. "cups_connection_pool.h",
  101. "ipp_handler_map.h",
  102. "ipp_handlers.cc",
  103. "ipp_handlers.h",
  104. ipp_handler_map_path,
  105. ]
  106. }
  107. if (!is_chromeos_ash) {
  108. # TODO(crbug.com/1062136): Remove the original CUPS backend for macOS
  109. # when Cloud Print support is terminated. Follow up after Jan 1, 2021.
  110. sources += [
  111. "cups_helper.cc",
  112. "cups_helper.h",
  113. "print_backend_cups.cc",
  114. "print_backend_cups.h",
  115. ]
  116. # We still build the utils for fuzzing if not already built.
  117. if (use_fuzzing_engine && !use_cups_ipp) {
  118. sources += [
  119. "cups_ipp_constants.cc",
  120. "cups_ipp_constants.h",
  121. "cups_ipp_helper.cc",
  122. "cups_ipp_helper.h",
  123. ]
  124. }
  125. }
  126. }
  127. }
  128. source_set("test_support") {
  129. testonly = true
  130. sources = [
  131. "test_print_backend.cc",
  132. "test_print_backend.h",
  133. ]
  134. deps = [
  135. ":backend",
  136. "//base",
  137. "//printing/mojom",
  138. ]
  139. }