xref: /aosp_15_r20/external/pdfium/core/fxcrt/BUILD.gn (revision 3ac0a46f773bac49fa9476ec2b1cf3f8da5ec3a4)
1# Copyright 2018 The PDFium Authors
2# Use of this source code is governed by a BSD-style license that can be
3# found in the LICENSE file.
4
5import("//build_overrides/build.gni")
6import("../../pdfium.gni")
7import("../../testing/test.gni")
8
9source_set("unowned_ptr") {
10  sources = [ "unowned_ptr.h" ]
11  deps = [ "../../third_party:pdfium_compiler_specific" ]
12  configs += [ "../../:pdfium_strict_config" ]
13  if (pdf_use_partition_alloc) {
14    public_deps = [
15      "//base/allocator/partition_allocator:partition_alloc_buildflags",
16      "//base/allocator/partition_allocator:raw_ptr",
17    ]
18  }
19}
20
21source_set("fxcrt") {
22  sources = [
23    "autonuller.h",
24    "autorestorer.h",
25    "binary_buffer.cpp",
26    "binary_buffer.h",
27    "byteorder.h",
28    "bytestring.cpp",
29    "bytestring.h",
30    "cfx_bitstream.cpp",
31    "cfx_bitstream.h",
32    "cfx_datetime.cpp",
33    "cfx_datetime.h",
34    "cfx_read_only_span_stream.cpp",
35    "cfx_read_only_span_stream.h",
36    "cfx_read_only_string_stream.cpp",
37    "cfx_read_only_string_stream.h",
38    "cfx_read_only_vector_stream.cpp",
39    "cfx_read_only_vector_stream.h",
40    "cfx_seekablestreamproxy.cpp",
41    "cfx_seekablestreamproxy.h",
42    "cfx_timer.cpp",
43    "cfx_timer.h",
44    "code_point_view.h",
45    "data_vector.h",
46    "fileaccess_iface.h",
47    "fixed_size_data_vector.h",
48    "fixed_try_alloc_zeroed_data_vector.h",
49    "fixed_uninit_data_vector.h",
50    "fixed_zeroed_data_vector.h",
51    "fx_2d_size.h",
52    "fx_bidi.cpp",
53    "fx_bidi.h",
54    "fx_codepage.cpp",
55    "fx_codepage.h",
56    "fx_codepage_forward.h",
57    "fx_coordinates.cpp",
58    "fx_coordinates.h",
59    "fx_extension.cpp",
60    "fx_extension.h",
61    "fx_folder.h",
62    "fx_memcpy_wrappers.h",
63    "fx_memory.cpp",
64    "fx_memory.h",
65    "fx_memory_wrappers.h",
66    "fx_number.cpp",
67    "fx_number.h",
68    "fx_random.cpp",
69    "fx_random.h",
70    "fx_safe_types.h",
71    "fx_stream.cpp",
72    "fx_stream.h",
73    "fx_string.cpp",
74    "fx_string.h",
75    "fx_string_wrappers.h",
76    "fx_system.cpp",
77    "fx_system.h",
78    "fx_types.h",
79    "fx_unicode.cpp",
80    "fx_unicode.h",
81    "mask.h",
82    "maybe_owned.h",
83    "observed_ptr.cpp",
84    "observed_ptr.h",
85    "pauseindicator_iface.h",
86    "retain_ptr.h",
87    "scoped_set_insertion.h",
88    "shared_copy_on_write.h",
89    "small_buffer.h",
90    "span_util.h",
91    "stl_util.h",
92    "string_data_template.cpp",
93    "string_data_template.h",
94    "string_pool_template.h",
95    "string_view_template.h",
96    "tree_node.h",
97    "utf16.h",
98    "weak_ptr.h",
99    "widestring.cpp",
100    "widestring.h",
101    "widetext_buffer.cpp",
102    "widetext_buffer.h",
103    "xml/cfx_xmlchardata.cpp",
104    "xml/cfx_xmlchardata.h",
105    "xml/cfx_xmldocument.cpp",
106    "xml/cfx_xmldocument.h",
107    "xml/cfx_xmlelement.cpp",
108    "xml/cfx_xmlelement.h",
109    "xml/cfx_xmlinstruction.cpp",
110    "xml/cfx_xmlinstruction.h",
111    "xml/cfx_xmlnode.cpp",
112    "xml/cfx_xmlnode.h",
113    "xml/cfx_xmlparser.cpp",
114    "xml/cfx_xmlparser.h",
115    "xml/cfx_xmltext.cpp",
116    "xml/cfx_xmltext.h",
117  ]
118  configs += [
119    "../../:pdfium_strict_config",
120    "../../:pdfium_noshorten_config",
121  ]
122  visibility = [
123    "../*",
124    "../../:*",
125    "../../fpdfsdk/*",
126    "../../fxbarcode:*",
127    "../../fxjs:*",
128    "../../testing:*",
129    "../../testing/fuzzers/*",
130    "../../third_party:fx_agg",
131    "../../third_party:fx_lcms2",
132    "../../third_party:fx_libopenjpeg",
133    "../../third_party:fx_tiff",
134    "../../xfa/*",
135  ]
136  deps = [ "../../third_party:pdfium_base" ]
137  public_deps = [
138    ":unowned_ptr",
139    "../../:freetype_common",
140    "../../third_party:pdfium_base",
141    "//third_party/icu:icuuc",
142  ]
143  if (pdf_use_partition_alloc) {
144    sources += [ "fx_memory_pa.cpp" ]
145    deps += [
146      "//base/allocator/partition_allocator:partition_alloc",
147      "//base/allocator/partition_allocator:partition_alloc_buildflags",
148      "//base/allocator/partition_allocator:raw_ptr",
149    ]
150  } else {
151    sources += [ "fx_memory_malloc.cpp" ]
152  }
153  if (is_posix || is_fuchsia) {
154    sources += [
155      "cfx_fileaccess_posix.cpp",
156      "cfx_fileaccess_posix.h",
157      "fx_folder_posix.cpp",
158    ]
159  }
160  if (is_win) {
161    sources += [
162      "cfx_fileaccess_windows.cpp",
163      "cfx_fileaccess_windows.h",
164      "fx_folder_windows.cpp",
165    ]
166  }
167  if (pdf_enable_xfa) {
168    sources += [
169      "cfx_memorystream.cpp",
170      "cfx_memorystream.h",
171    ]
172  }
173}
174
175source_set("test_support") {
176  testonly = true
177  sources = [ "string_test_support.cpp" ]
178  configs += [ "../../:pdfium_strict_config" ]
179  deps = [ ":fxcrt" ]
180}
181
182source_set("unit_test_support") {
183  testonly = true
184  sources = [
185    "fake_time_test.cpp",
186    "fake_time_test.h",
187  ]
188  configs += [ "../../:pdfium_strict_config" ]
189  deps = [
190    ":fxcrt",
191    ":test_support",
192    "//testing/gtest",
193  ]
194}
195
196pdfium_unittest_source_set("unittests") {
197  sources = [
198    "autonuller_unittest.cpp",
199    "autorestorer_unittest.cpp",
200    "binary_buffer_unittest.cpp",
201    "byteorder_unittest.cpp",
202    "bytestring_unittest.cpp",
203    "cfx_bitstream_unittest.cpp",
204    "cfx_datetime_unittest.cpp",
205    "cfx_seekablestreamproxy_unittest.cpp",
206    "cfx_timer_unittest.cpp",
207    "code_point_view_unittest.cpp",
208    "fixed_try_alloc_zeroed_data_vector_unittest.cpp",
209    "fixed_uninit_data_vector_unittest.cpp",
210    "fixed_zeroed_data_vector_unittest.cpp",
211    "fx_bidi_unittest.cpp",
212    "fx_coordinates_unittest.cpp",
213    "fx_extension_unittest.cpp",
214    "fx_memcpy_wrappers_unittest.cpp",
215    "fx_memory_unittest.cpp",
216    "fx_memory_wrappers_unittest.cpp",
217    "fx_number_unittest.cpp",
218    "fx_random_unittest.cpp",
219    "fx_safe_types_unittest.cpp",
220    "fx_string_unittest.cpp",
221    "fx_string_wrappers_unittest.cpp",
222    "fx_system_unittest.cpp",
223    "mask_unittest.cpp",
224    "maybe_owned_unittest.cpp",
225    "observed_ptr_unittest.cpp",
226    "pdfium_span_unittest.cpp",
227    "retain_ptr_unittest.cpp",
228    "scoped_set_insertion_unittest.cpp",
229    "shared_copy_on_write_unittest.cpp",
230    "small_buffer_unittest.cpp",
231    "span_util_unittest.cpp",
232    "string_pool_template_unittest.cpp",
233    "tree_node_unittest.cpp",
234    "unowned_ptr_unittest.cpp",
235    "utf16_unittest.cpp",
236    "weak_ptr_unittest.cpp",
237    "widestring_unittest.cpp",
238    "widetext_buffer_unittest.cpp",
239    "xml/cfx_xmlchardata_unittest.cpp",
240    "xml/cfx_xmldocument_unittest.cpp",
241    "xml/cfx_xmlelement_unittest.cpp",
242    "xml/cfx_xmlinstruction_unittest.cpp",
243    "xml/cfx_xmlnode_unittest.cpp",
244    "xml/cfx_xmlparser_unittest.cpp",
245    "xml/cfx_xmltext_unittest.cpp",
246  ]
247  deps = [ ":unit_test_support" ]
248  pdfium_root_dir = "../../"
249  if (pdf_use_partition_alloc) {
250    deps += [ "//base/allocator/partition_allocator:partition_alloc" ]
251  }
252  if (pdf_enable_xfa) {
253    sources += [ "cfx_memorystream_unittest.cpp" ]
254    deps += [ "../fpdfapi/parser" ]
255  }
256}
257