Fix: warnings in media/capture/filters
[platform/framework/web/chromium-efl.git] / pdf / BUILD.gn
1 # Copyright 2014 The Chromium Authors
2 # Use of this source code is governed by a BSD-style license that can be
3 # found in the LICENSE file.
4
5 import("//build/buildflag_header.gni")
6 import("//build/config/features.gni")
7 import("//pdf/features.gni")
8 import("//ppapi/buildflags/buildflags.gni")
9 import("//printing/buildflags/buildflags.gni")
10 import("//testing/libfuzzer/fuzzer_test.gni")
11 import("//testing/test.gni")
12 import("//third_party/pdfium/pdfium.gni")
13 import("//tools/grit/repack.gni")
14 import("//v8/gni/v8.gni")
15
16 if (is_ios) {
17   import("//build/config/ios/bundle_data_from_filelist.gni")
18 }
19
20 # Generate a buildflag header for compile-time checking of PDF support.
21 buildflag_header("buildflags") {
22   header = "buildflags.h"
23   flags = [
24     "ENABLE_INK=$enable_ink",
25     "ENABLE_PDF=$enable_pdf",
26   ]
27 }
28
29 if (enable_pdf) {
30   config("strict") {
31     configs = [ "//build/config/compiler:wexit_time_destructors" ]
32   }
33
34   config("pdfium_includes") {
35     include_dirs = [ "//third_party/pdfium" ]
36   }
37
38   static_library("pdf") {
39     sources = [ "pdf.cc" ]
40
41     configs += [ ":strict" ]
42
43     public = [ "pdf.h" ]
44
45     deps = [
46       ":features",
47       ":internal",
48       "//base",
49       "//build:chromeos_buildflags",
50       "//ui/gfx/geometry",
51     ]
52   }
53
54   source_set("features") {
55     sources = [ "pdf_features.cc" ]
56
57     configs += [ ":strict" ]
58
59     public = [ "pdf_features.h" ]
60
61     deps = [
62       "//base",
63       "//build:chromeos_buildflags",
64     ]
65   }
66
67   source_set("internal") {
68     visibility = [ ":*" ]
69
70     sources = [
71       "accessibility.cc",
72       "accessibility.h",
73       "document_attachment_info.cc",
74       "document_attachment_info.h",
75       "document_layout.cc",
76       "document_layout.h",
77       "document_metadata.cc",
78       "document_metadata.h",
79       "draw_utils/coordinates.cc",
80       "draw_utils/coordinates.h",
81       "draw_utils/shadow.cc",
82       "draw_utils/shadow.h",
83       "file_extension.cc",
84       "file_extension.h",
85       "metrics_handler.cc",
86       "metrics_handler.h",
87       "page_orientation.cc",
88       "page_orientation.h",
89       "paint_aggregator.cc",
90       "paint_aggregator.h",
91       "paint_manager.cc",
92       "paint_manager.h",
93       "paint_ready_rect.cc",
94       "paint_ready_rect.h",
95       "parsed_params.cc",
96       "parsed_params.h",
97       "pdf_engine.h",
98       "pdf_init.cc",
99       "pdf_init.h",
100       "pdf_transform.cc",
101       "pdf_transform.h",
102       "pdf_utils/dates.cc",
103       "pdf_utils/dates.h",
104       "pdfium/pdfium_api_string_buffer_adapter.cc",
105       "pdfium/pdfium_api_string_buffer_adapter.h",
106       "pdfium/pdfium_document.cc",
107       "pdfium/pdfium_document.h",
108       "pdfium/pdfium_engine.cc",
109       "pdfium/pdfium_engine.h",
110       "pdfium/pdfium_engine_exports.cc",
111       "pdfium/pdfium_engine_exports.h",
112       "pdfium/pdfium_form_filler.cc",
113       "pdfium/pdfium_form_filler.h",
114       "pdfium/pdfium_mem_buffer_file_write.cc",
115       "pdfium/pdfium_mem_buffer_file_write.h",
116       "pdfium/pdfium_page.cc",
117       "pdfium/pdfium_page.h",
118       "pdfium/pdfium_permissions.cc",
119       "pdfium/pdfium_permissions.h",
120       "pdfium/pdfium_print.cc",
121       "pdfium/pdfium_print.h",
122       "pdfium/pdfium_range.cc",
123       "pdfium/pdfium_range.h",
124       "pdfium/pdfium_unsupported_features.cc",
125       "pdfium/pdfium_unsupported_features.h",
126       "preview_mode_client.cc",
127       "preview_mode_client.h",
128       "ui/document_properties.cc",
129       "ui/document_properties.h",
130       "ui/file_name.cc",
131       "ui/file_name.h",
132       "ui/thumbnail.cc",
133       "ui/thumbnail.h",
134     ]
135
136     public_configs = [ ":pdfium_includes" ]
137
138     configs += [ ":strict" ]
139
140     public_deps = [
141       "//printing/mojom",
142       "//skia",
143       "//v8",
144     ]
145
146     deps = [
147       ":accessibility",
148       ":buildflags",
149       ":content_restriction",
150       ":features",
151       "//base",
152       "//base:i18n",
153       "//build:chromeos_buildflags",
154       "//components/strings",
155       "//gin",
156       "//pdf/loader",
157       "//third_party/blink/public:blink_headers",
158       "//third_party/blink/public/common:headers",
159       "//third_party/icu",
160       "//third_party/pdfium",
161       "//ui/base",
162       "//ui/base/cursor/mojom:cursor_type",
163       "//ui/events:events_base",
164       "//ui/events/blink",
165       "//ui/gfx/codec",
166       "//ui/gfx/range",
167     ]
168
169     if (enable_basic_printing) {
170       deps += [ "//printing" ]
171     }
172
173     if (is_linux || is_chromeos || is_tizen) {
174       sources += [
175         "pdfium/pdfium_font_linux.cc",
176         "pdfium/pdfium_font_linux.h",
177       ]
178
179       deps += [
180         ":font_table_linux",
181         "//components/services/font/public/cpp",
182       ]
183     }
184   }
185
186   source_set("assert_enums") {
187     visibility = [ ":*" ]
188
189     testonly = true
190
191     sources = [ "pdfium/pdfium_assert_matching_enums.cc" ]
192
193     deps = [
194       ":accessibility",
195       ":content_restriction",
196       ":internal",
197       ":pdf",
198       "//third_party/blink/public/common:headers",
199       "//third_party/pdfium",
200       "//ui/base",
201     ]
202   }
203
204   source_set("content_restriction") {
205     # Exists separately to expose this header for testing.
206     public = [ "content_restriction.h" ]
207   }
208
209   source_set("accessibility") {
210     visibility = [
211       ":*",
212       "//components:components_browsertests${exec_target_suffix}",
213       "//components/pdf/renderer",
214       "//components/pdf/renderer:unit_tests",
215     ]
216
217     sources = [
218       "accessibility_helper.cc",
219       "accessibility_helper.h",
220       "accessibility_structs.cc",
221       "accessibility_structs.h",
222       "pdf_accessibility_action_handler.h",
223       "pdf_accessibility_data_handler.h",
224       "pdf_accessibility_image_fetcher.h",
225     ]
226
227     configs += [ ":strict" ]
228
229     deps = [
230       "//base",
231       "//skia",
232       "//ui/gfx/geometry",
233     ]
234   }
235
236   static_library("pdf_view_web_plugin") {
237     assert(enable_plugins, "The PDF viewer relies on plugin infrastructure")
238
239     visibility = [
240       ":*",
241       "//components/pdf/renderer",
242     ]
243
244     sources = [
245       "pdf_view_web_plugin.cc",
246       "post_message_receiver.cc",
247       "post_message_receiver.h",
248       "v8_value_converter.h",
249     ]
250
251     configs += [ ":strict" ]
252
253     public = [ "pdf_view_web_plugin.h" ]
254
255     public_deps = [ "//pdf/mojom" ]
256
257     deps = [
258       ":accessibility",
259       ":buildflags",
260       ":content_restriction",
261       ":features",
262       ":internal",
263       "//base",
264       "//base:i18n",
265       "//cc/paint",
266       "//gin",
267       "//net",
268       "//pdf/loader",
269       "//services/network/public/mojom:url_loader_base",
270       "//skia",
271       "//third_party/blink/public:blink_headers",
272       "//third_party/blink/public/common:headers",
273       "//ui/base/cursor",
274       "//ui/base/cursor/mojom:cursor_type",
275       "//ui/events/blink",
276       "//ui/gfx/range",
277       "//v8",
278     ]
279
280     if (enable_basic_printing) {
281       deps += [ "//printing" ]
282     }
283   }
284
285   source_set("pdf_test_utils") {
286     visibility = [ "//pdf/*" ]
287
288     testonly = true
289
290     sources = [
291       "test/mock_web_associated_url_loader.cc",
292       "test/mock_web_associated_url_loader.h",
293       "test/test_client.cc",
294       "test/test_client.h",
295       "test/test_document_loader.cc",
296       "test/test_document_loader.h",
297       "test/test_helpers.cc",
298       "test/test_helpers.h",
299       "test/test_pdfium_engine.cc",
300       "test/test_pdfium_engine.h",
301     ]
302
303     deps = [
304       ":internal",
305       "//base",
306       "//cc:test_support",
307       "//pdf/loader",
308       "//testing/gmock",
309       "//testing/gtest",
310       "//third_party/blink/public:blink",
311       "//ui/gfx/range",
312       "//ui/latency:latency",
313     ]
314   }
315
316   if (is_linux || is_chromeos || is_tizen) {
317     # TODO(crbug.com/702990): After PPAPI deprecation, there will only be one
318     # caller left. Move inside the file with the caller.
319     static_library("font_table_linux") {
320       sources = [ "font_table_linux.cc" ]
321
322       configs += [ ":strict" ]
323
324       public = [ "font_table_linux.h" ]
325
326       deps = [ "//base" ]
327     }
328   }
329
330   test("pdf_unittests") {
331     testonly = true
332
333     sources = [
334       "document_layout_unittest.cc",
335       "draw_utils/coordinates_unittest.cc",
336       "file_extension_unittest.cc",
337       "page_orientation_unittest.cc",
338       "paint_manager_unittest.cc",
339       "parsed_params_unittest.cc",
340       "pdf_transform_unittest.cc",
341       "pdf_utils/dates_unittest.cc",
342       "pdf_view_web_plugin_unittest.cc",
343       "pdfium/accessibility_unittest.cc",
344       "pdfium/findtext_unittest.cc",
345       "pdfium/pdfium_engine_exports_unittest.cc",
346       "pdfium/pdfium_engine_unittest.cc",
347       "pdfium/pdfium_form_filler_unittest.cc",
348       "pdfium/pdfium_page_unittest.cc",
349       "pdfium/pdfium_permissions_unittest.cc",
350       "pdfium/pdfium_print_unittest.cc",
351       "pdfium/pdfium_range_unittest.cc",
352       "pdfium/pdfium_test_base.cc",
353       "pdfium/pdfium_test_base.h",
354       "test/run_all_unittests.cc",
355       "ui/document_properties_unittest.cc",
356       "ui/file_name_unittest.cc",
357       "ui/thumbnail_unittest.cc",
358     ]
359
360     data = [ "test/data/" ]
361
362     deps = [
363       ":accessibility",
364       ":assert_enums",
365       ":buildflags",
366       ":content_restriction",
367       ":features",
368       ":internal",
369       ":pdf",
370       ":pdf_test_utils",
371       ":pdf_view_web_plugin",
372       "//base",
373       "//base:i18n",
374       "//base/test:test_support",
375       "//cc:test_support",
376       "//gin",
377       "//mojo/core/embedder",
378       "//mojo/public/cpp/bindings",
379       "//net",
380       "//pdf/loader",
381       "//pdf/loader:unit_tests",
382       "//skia",
383       "//testing/gmock",
384       "//testing/gtest",
385       "//third_party/blink/public:blink",
386       "//third_party/blink/public:test_support",
387       "//third_party/blink/public/common:headers",
388       "//third_party/pdfium",
389       "//tools/v8_context_snapshot:buildflags",
390       "//ui/base",
391       "//ui/base/cursor",
392       "//ui/events/blink:blink",
393       "//ui/gfx:test_support",
394       "//ui/gfx/geometry",
395       "//ui/gfx/range",
396       "//v8",
397     ]
398
399     if (enable_basic_printing) {
400       deps += [ "//printing" ]
401     }
402
403     if (v8_use_external_startup_data) {
404       deps += [
405         "//tools/v8_context_snapshot",
406         "//tools/v8_context_snapshot:buildflags",
407       ]
408       configs += [ "//v8:external_startup_data" ]
409     }
410
411     data_deps = [
412       ":pdf_unittests_pak",
413       "//ui/resources:ui_test_pak_data",
414     ]
415
416     assert_no_deps = [
417       "//ppapi/c/*",
418       "//ppapi/cpp/*",
419     ]
420   }
421
422   repack("pdf_unittests_pak") {
423     sources =
424         [ "$root_gen_dir/components/strings/components_strings_en-US.pak" ]
425     output = "$root_out_dir/pdf_tests_resources.pak"
426     deps = [ "//components/strings" ]
427   }
428
429   fuzzer_test("pdf_dates_fuzzer") {
430     sources = [ "pdf_utils/dates_fuzzer.cc" ]
431
432     deps = [
433       ":internal",
434       "//base",
435     ]
436   }
437 } else {
438   # Dummy groups when PDF support is disabled so targets can unconditionally
439   # depend on it.
440   group("features") {
441   }
442   group("pdf") {
443   }
444 }
445
446 if (is_ios) {
447   bundle_data_from_filelist("pdf_test_bundle_data") {
448     testonly = true
449     filelist_name = "test/pdf_test_bundle_data.filelist"
450   }
451 }