OLD | NEW |
1 # Copyright 2014 The Chromium Authors. All rights reserved. | 1 # Copyright 2014 The Chromium Authors. All rights reserved. |
2 # Use of this source code is governed by a BSD-style license that can be | 2 # Use of this source code is governed by a BSD-style license that can be |
3 # found in the LICENSE file. | 3 # found in the LICENSE file. |
4 | 4 |
| 5 import("//build/buildflag_header.gni") |
5 import("//build/config/features.gni") | 6 import("//build/config/features.gni") |
| 7 import("//pdf/features.gni") |
6 import("//testing/test.gni") | 8 import("//testing/test.gni") |
7 import("//third_party/pdfium/pdfium.gni") | 9 import("//third_party/pdfium/pdfium.gni") |
8 | 10 |
9 assert(enable_pdf) | 11 # Generate a buildflag header for compile-time checking of PDF support. |
| 12 buildflag_header("features") { |
| 13 header = "features.h" |
| 14 flags = [ "ENABLE_PDF=$enable_pdf" ] |
| 15 } |
10 | 16 |
11 pdf_engine = 0 # 0 PDFium | 17 if (enable_pdf) { |
| 18 pdf_engine = 0 # 0 PDFium |
12 | 19 |
13 static_library("pdf") { | 20 static_library("pdf") { |
14 deps = [ | 21 deps = [ |
15 "//base", | 22 "//base", |
16 "//gin", | 23 "//gin", |
17 "//net", | 24 "//net", |
18 "//ppapi/cpp:objects", | 25 "//ppapi/cpp:objects", |
19 "//ppapi/cpp/private:internal_module", | 26 "//ppapi/cpp/private:internal_module", |
20 "//ui/base", | 27 "//ui/base", |
21 ] | |
22 | |
23 sources = [ | |
24 "chunk_stream.cc", | |
25 "chunk_stream.h", | |
26 "document_loader.cc", | |
27 "document_loader.h", | |
28 "draw_utils.cc", | |
29 "draw_utils.h", | |
30 "out_of_process_instance.cc", | |
31 "out_of_process_instance.h", | |
32 "paint_aggregator.cc", | |
33 "paint_aggregator.h", | |
34 "paint_manager.cc", | |
35 "paint_manager.h", | |
36 "pdf.cc", | |
37 "pdf.h", | |
38 "pdf_engine.h", | |
39 "preview_mode_client.cc", | |
40 "preview_mode_client.h", | |
41 ] | |
42 | |
43 if (pdf_engine == 0) { | |
44 deps += [ | |
45 "//pdf/pdfium/fuzzers", | |
46 "//third_party/pdfium", | |
47 ] | 28 ] |
48 | 29 |
49 sources += [ | 30 sources = [ |
50 "pdfium/pdfium_api_string_buffer_adapter.cc", | 31 "chunk_stream.cc", |
51 "pdfium/pdfium_api_string_buffer_adapter.h", | 32 "chunk_stream.h", |
52 "pdfium/pdfium_assert_matching_enums.cc", | 33 "document_loader.cc", |
53 "pdfium/pdfium_engine.cc", | 34 "document_loader.h", |
54 "pdfium/pdfium_engine.h", | 35 "draw_utils.cc", |
55 "pdfium/pdfium_mem_buffer_file_read.cc", | 36 "draw_utils.h", |
56 "pdfium/pdfium_mem_buffer_file_read.h", | 37 "out_of_process_instance.cc", |
57 "pdfium/pdfium_mem_buffer_file_write.cc", | 38 "out_of_process_instance.h", |
58 "pdfium/pdfium_mem_buffer_file_write.h", | 39 "paint_aggregator.cc", |
59 "pdfium/pdfium_page.cc", | 40 "paint_aggregator.h", |
60 "pdfium/pdfium_page.h", | 41 "paint_manager.cc", |
61 "pdfium/pdfium_range.cc", | 42 "paint_manager.h", |
62 "pdfium/pdfium_range.h", | 43 "pdf.cc", |
| 44 "pdf.h", |
| 45 "pdf_engine.h", |
| 46 "preview_mode_client.cc", |
| 47 "preview_mode_client.h", |
| 48 ] |
| 49 |
| 50 if (pdf_engine == 0) { |
| 51 deps += [ |
| 52 "//pdf/pdfium/fuzzers", |
| 53 "//third_party/pdfium", |
| 54 ] |
| 55 |
| 56 sources += [ |
| 57 "pdfium/pdfium_api_string_buffer_adapter.cc", |
| 58 "pdfium/pdfium_api_string_buffer_adapter.h", |
| 59 "pdfium/pdfium_assert_matching_enums.cc", |
| 60 "pdfium/pdfium_engine.cc", |
| 61 "pdfium/pdfium_engine.h", |
| 62 "pdfium/pdfium_mem_buffer_file_read.cc", |
| 63 "pdfium/pdfium_mem_buffer_file_read.h", |
| 64 "pdfium/pdfium_mem_buffer_file_write.cc", |
| 65 "pdfium/pdfium_mem_buffer_file_write.h", |
| 66 "pdfium/pdfium_page.cc", |
| 67 "pdfium/pdfium_page.h", |
| 68 "pdfium/pdfium_range.cc", |
| 69 "pdfium/pdfium_range.h", |
| 70 ] |
| 71 } |
| 72 |
| 73 defines = [ "PDFIUM_PRINT_TEXT_WITH_GDI" ] |
| 74 if (pdf_enable_xfa) { |
| 75 defines += [ "PDF_ENABLE_XFA" ] |
| 76 } |
| 77 } |
| 78 |
| 79 test("pdf_unittests") { |
| 80 sources = [ |
| 81 "chunk_stream_unittest.cc", |
| 82 "run_all_unittests.cc", |
| 83 ] |
| 84 |
| 85 deps = [ |
| 86 ":pdf", |
| 87 "//base", |
| 88 "//base/test:test_support", |
| 89 "//ppapi/c", |
| 90 "//ppapi/cpp", |
| 91 "//testing/gmock", |
| 92 "//testing/gtest", |
63 ] | 93 ] |
64 } | 94 } |
65 | 95 } else { |
66 defines = [ "PDFIUM_PRINT_TEXT_WITH_GDI" ] | 96 # Dummy group when PDF support is disabled so targets can unconditionally |
67 if (pdf_enable_xfa) { | 97 # depend on it. |
68 defines += [ "PDF_ENABLE_XFA" ] | 98 group("pdf") { |
69 } | 99 } |
70 } | 100 } |
71 | |
72 test("pdf_unittests") { | |
73 sources = [ | |
74 "chunk_stream_unittest.cc", | |
75 "run_all_unittests.cc", | |
76 ] | |
77 | |
78 deps = [ | |
79 ":pdf", | |
80 "//base", | |
81 "//base/test:test_support", | |
82 "//ppapi/c", | |
83 "//ppapi/cpp", | |
84 "//testing/gmock", | |
85 "//testing/gtest", | |
86 ] | |
87 } | |
OLD | NEW |