BUILD.gn 5.9 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197
  1. # Copyright 2017 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("//testing/test.gni")
  6. use_barhopper = is_chrome_branded && is_chromeos
  7. source_set("lib") {
  8. sources = [
  9. "shape_detection_service.cc",
  10. "shape_detection_service.h",
  11. "text_detection_impl.h",
  12. ]
  13. deps = [
  14. "//build:branding_buildflags",
  15. "//build:chromeos_buildflags",
  16. "//mojo/public/cpp/bindings",
  17. "//ui/gfx",
  18. "//ui/gfx/geometry",
  19. ]
  20. if (is_mac) {
  21. sources += [
  22. "detection_utils_mac.h",
  23. "detection_utils_mac.mm",
  24. "face_detection_impl_mac.h",
  25. "face_detection_impl_mac.mm",
  26. "face_detection_impl_mac_vision.h",
  27. "face_detection_impl_mac_vision.mm",
  28. "face_detection_provider_mac.h",
  29. "face_detection_provider_mac.mm",
  30. "text_detection_impl_mac.h",
  31. "text_detection_impl_mac.mm",
  32. ]
  33. frameworks = [ "QuartzCore.framework" ]
  34. weak_frameworks = [ "Vision.framework" ]
  35. } else if (is_win) {
  36. sources += [
  37. "detection_utils_win.cc",
  38. "detection_utils_win.h",
  39. "face_detection_impl_win.cc",
  40. "face_detection_impl_win.h",
  41. "face_detection_provider_win.cc",
  42. "face_detection_provider_win.h",
  43. "text_detection_impl_win.cc",
  44. "text_detection_impl_win.h",
  45. ]
  46. } else if (is_android) {
  47. # No C++ sources needed, face and text detection is provided by Java.
  48. } else {
  49. sources += [
  50. "face_detection_provider_impl.cc",
  51. "face_detection_provider_impl.h",
  52. "text_detection_impl.cc",
  53. ]
  54. }
  55. if (is_mac) {
  56. # On macOS there is a barcode detection API available from the platform.
  57. sources += [
  58. "barcode_detection_impl_mac.h",
  59. "barcode_detection_impl_mac.mm",
  60. "barcode_detection_impl_mac_vision.h",
  61. "barcode_detection_impl_mac_vision.mm",
  62. "barcode_detection_impl_mac_vision_api.h",
  63. "barcode_detection_impl_mac_vision_api.mm",
  64. "barcode_detection_provider_mac.h",
  65. "barcode_detection_provider_mac.mm",
  66. ]
  67. } else if (is_android) {
  68. # No C++ sources needed, barcode detection is provided by Java.
  69. } else if (use_barhopper) {
  70. sources += [
  71. "barcode_detection_impl_barhopper.cc",
  72. "barcode_detection_impl_barhopper.h",
  73. "barcode_detection_provider_barhopper.cc",
  74. "barcode_detection_provider_barhopper.h",
  75. ]
  76. deps += [ "//third_party/barhopper" ]
  77. } else {
  78. # Otherwise, use a stub implementation.
  79. sources += [
  80. "barcode_detection_provider_impl.cc",
  81. "barcode_detection_provider_impl.h",
  82. ]
  83. }
  84. configs += [ "//build/config/compiler:wexit_time_destructors" ]
  85. public_deps = [
  86. "//base",
  87. "//media/capture",
  88. "//services/shape_detection/public/mojom",
  89. ]
  90. if (is_android) {
  91. deps += [ ":shape_detection_jni_headers" ]
  92. }
  93. }
  94. if (is_android) {
  95. generate_jni("shape_detection_jni_headers") {
  96. sources = [
  97. "android/java/src/org/chromium/shape_detection/InterfaceRegistrar.java",
  98. ]
  99. }
  100. android_library("shape_detection_java") {
  101. sources = [
  102. "android/java/src/org/chromium/shape_detection/BarcodeDetectionImpl.java",
  103. "android/java/src/org/chromium/shape_detection/BarcodeDetectionProviderImpl.java",
  104. "android/java/src/org/chromium/shape_detection/BitmapUtils.java",
  105. "android/java/src/org/chromium/shape_detection/FaceDetectionImpl.java",
  106. "android/java/src/org/chromium/shape_detection/FaceDetectionImplGmsCore.java",
  107. "android/java/src/org/chromium/shape_detection/FaceDetectionProviderImpl.java",
  108. "android/java/src/org/chromium/shape_detection/InterfaceRegistrar.java",
  109. "android/java/src/org/chromium/shape_detection/TextDetectionImpl.java",
  110. ]
  111. deps = [
  112. "$google_play_services_package:google_play_services_base_java",
  113. "$google_play_services_package:google_play_services_basement_java",
  114. "$google_play_services_package:google_play_services_vision_common_java",
  115. "$google_play_services_package:google_play_services_vision_java",
  116. "//base:base_java",
  117. "//base:jni_java",
  118. "//mojo/public/java:base_java",
  119. "//mojo/public/java:bindings_java",
  120. "//mojo/public/java:system_java",
  121. "//mojo/public/java/system:system_impl_java",
  122. "//services/shape_detection/public/mojom:mojom_java",
  123. "//skia/public/mojom:mojom_java",
  124. "//third_party/android_deps:chromium_play_services_availability_java",
  125. "//ui/gfx/geometry/mojom:mojom_java",
  126. ]
  127. }
  128. }
  129. source_set("tests") {
  130. testonly = true
  131. sources = []
  132. if (is_mac) {
  133. sources += [
  134. "barcode_detection_impl_mac_unittest.mm",
  135. "barcode_detection_provider_mac_unittest.mm",
  136. "face_detection_impl_mac_unittest.mm",
  137. "text_detection_impl_mac_unittest.mm",
  138. ]
  139. frameworks = [
  140. "CoreFoundation.framework",
  141. "CoreGraphics.framework",
  142. "QuartzCore.framework",
  143. ]
  144. }
  145. if (is_win) {
  146. sources += [
  147. "face_detection_impl_win_unittest.cc",
  148. "text_detection_impl_win_unittest.cc",
  149. ]
  150. }
  151. if (use_barhopper) {
  152. sources += [ "barcode_detection_impl_barhopper_unittest.cc" ]
  153. }
  154. deps = [
  155. ":lib",
  156. "//base",
  157. "//base/test:test_support",
  158. "//mojo/public/cpp/test_support:test_utils",
  159. "//skia",
  160. "//testing/gmock",
  161. "//testing/gtest",
  162. "//ui/gfx",
  163. "//ui/gl",
  164. ]
  165. data = [
  166. "//services/test/data/codabar.png",
  167. "//services/test/data/code_39.png",
  168. "//services/test/data/code_93.png",
  169. "//services/test/data/code_128.png",
  170. "//services/test/data/data_matrix.png",
  171. "//services/test/data/ean_8.png",
  172. "//services/test/data/ean_13.png",
  173. "//services/test/data/itf.png",
  174. "//services/test/data/mona_lisa.jpg",
  175. "//services/test/data/pdf417.png",
  176. "//services/test/data/qr_code.png",
  177. "//services/test/data/text_detection.png",
  178. "//services/test/data/the_beatles.jpg",
  179. "//services/test/data/upc_a.png",
  180. "//services/test/data/upc_e.png",
  181. ]
  182. }