blob: c96235026e1501d68b51c1f81bda5686b1504b9b [file] [log] [blame]
K. Moon8636cff2022-11-02 18:45:43 +00001# Copyright 2016 The PDFium Authors
John Abd-El-Malekd68f9a32014-06-05 12:45:33 -07002# Use of this source code is governed by a BSD-style license that can be
3# found in the LICENSE file.
4
Tom Sepezc026b202021-04-08 22:06:57 +00005import("//build/config/clang/clang.gni")
K. Moon4948d0e2022-11-11 18:54:40 +00006import("//build/config/gclient_args.gni")
Tom Sepeza32f7602015-01-15 09:34:34 -08007import("//testing/test.gni")
dsinclair038bf0b2016-04-30 06:00:05 -07008import("pdfium.gni")
John Abd-El-Malekef4dce42015-02-02 16:52:07 -08009
Tom Sepezc3451da2022-08-29 17:52:22 +000010group("default") {
11 testonly = true
Tom Sepezd9e3f3f2023-07-24 23:29:11 +000012 deps = [ ":pdfium" ]
13 if (pdf_is_standalone) {
14 deps += [ ":pdfium_all" ]
15 }
Tom Sepezc3451da2022-08-29 17:52:22 +000016}
17
Dominik Röttsches4b0671a2017-03-30 11:07:43 +030018group("freetype_common") {
19 public_deps = []
20 if (pdf_bundle_freetype) {
21 public_deps += [ "third_party:fx_freetype" ]
22 } else {
23 public_deps += [ "//build/config/freetype" ]
24 }
25}
26
weili0abe6522016-06-06 14:41:22 -070027config("pdfium_common_config") {
John Abd-El-Malekd68f9a32014-06-05 12:45:33 -070028 cflags = []
Lei Zhang46d645f2021-10-11 21:13:27 +000029 cflags_cc = []
dsinclair6e162b52017-01-24 11:18:16 -080030 ldflags = []
Dominik Röttsches4b0671a2017-03-30 11:07:43 +030031 include_dirs = [ "." ]
K. Moone6660322022-11-15 23:24:08 +000032 defines = []
John Abd-El-Malekd68f9a32014-06-05 12:45:33 -070033
Felix Kauselmann8d72a472019-02-13 23:44:56 +000034 if (!use_system_libopenjpeg2) {
35 defines += [ "OPJ_STATIC" ]
36 }
37
Ryan Harrison9ce75b82018-06-06 19:45:14 +000038 if (pdf_enable_click_logging) {
39 defines += [ "PDF_ENABLE_CLICK_LOGGING" ]
40 }
41
Alan Screenf22325c2024-01-31 23:51:20 +000042 if (pdf_use_skia && pdf_enable_fontations) {
43 defines += [ "PDF_ENABLE_FONTATIONS" ]
Lei Zhang75a486e2018-11-30 00:04:23 +000044 }
45
Tom Sepez907b4592023-01-26 20:46:39 +000046 if (pdf_use_partition_alloc) {
47 defines += [ "PDF_USE_PARTITION_ALLOC" ]
48 }
49
Lei Zhang75a486e2018-11-30 00:04:23 +000050 if (is_win) {
51 # Assume UTF-8 by default to avoid code page dependencies.
52 cflags += [ "/utf-8" ]
Lei Zhang46d645f2021-10-11 21:13:27 +000053
54 if (!is_clang) {
55 cflags += [
56 # Warnings permanently disabled:
57
58 # C4091: 'typedef ': ignored on left of 'X' when no variable is
59 # declared.
60 # This happens in a number of Windows headers. Dumb.
61 "/wd4091",
62
63 # C4127: conditional expression is constant
64 # This warning can in theory catch dead code and other problems, but
65 # triggers in far too many desirable cases where the conditional
66 # expression is either set by macros or corresponds some legitimate
67 # compile-time constant expression (due to constant template args,
68 # conditionals comparing the sizes of different types, etc.). Some of
69 # these can be worked around, but it's not worth it.
70 "/wd4127",
71
72 # C4251: 'identifier' : class 'type' needs to have dll-interface to be
73 # used by clients of class 'type2'
74 # This is necessary for the shared library build.
75 "/wd4251",
76
77 # C4275: non dll-interface class used as base for dll-interface class
78 # This points out a potential (but rare) problem with referencing static
79 # fields of a non-exported base, through the base's non-exported inline
80 # functions, or directly. The warning is subtle enough that people just
81 # suppressed it when they saw it, so it's not worth it.
82 "/wd4275",
83
84 # C4312 is a VS 2015 64-bit warning for integer to larger pointer.
85 # TODO(brucedawson): fix warnings, crbug.com/554200
86 "/wd4312",
87
88 # C4324 warns when padding is added to fulfill alignas requirements,
89 # but can trigger in benign cases that are difficult to individually
90 # suppress.
91 "/wd4324",
92
93 # C4351: new behavior: elements of array 'array' will be default
94 # initialized
95 # This is a silly "warning" that basically just alerts you that the
96 # compiler is going to actually follow the language spec like it's
97 # supposed to, instead of not following it like old buggy versions did.
98 # There's absolutely no reason to turn this on.
99 "/wd4351",
100
101 # C4355: 'this': used in base member initializer list
102 # It's commonly useful to pass |this| to objects in a class' initializer
103 # list. While this warning can catch real bugs, most of the time the
104 # constructors in question don't attempt to call methods on the passed-in
105 # pointer (until later), and annotating every legit usage of this is
106 # simply more hassle than the warning is worth.
107 "/wd4355",
108
109 # C4503: 'identifier': decorated name length exceeded, name was
110 # truncated
111 # This only means that some long error messages might have truncated
112 # identifiers in the presence of lots of templates. It has no effect on
113 # program correctness and there's no real reason to waste time trying to
114 # prevent it.
115 "/wd4503",
116
117 # Warning C4589 says: "Constructor of abstract class ignores
118 # initializer for virtual base class." Disable this warning because it
119 # is flaky in VS 2015 RTM. It triggers on compiler generated
120 # copy-constructors in some cases.
121 "/wd4589",
122
123 # C4611: interaction between 'function' and C++ object destruction is
124 # non-portable
125 # This warning is unavoidable when using e.g. setjmp/longjmp. MSDN
126 # suggests using exceptions instead of setjmp/longjmp for C++, but
127 # Chromium code compiles without exception support. We therefore have to
128 # use setjmp/longjmp for e.g. JPEG decode error handling, which means we
129 # have to turn off this warning (and be careful about how object
130 # destruction happens in such cases).
131 "/wd4611",
132
133 # Warnings to evaluate and possibly fix/reenable later:
134
135 "/wd4100", # Unreferenced formal function parameter.
136 "/wd4121", # Alignment of a member was sensitive to packing.
137 "/wd4244", # Conversion: possible loss of data.
138 "/wd4505", # Unreferenced local function has been removed.
139 "/wd4510", # Default constructor could not be generated.
140 "/wd4512", # Assignment operator could not be generated.
141 "/wd4610", # Class can never be instantiated, constructor required.
142 "/wd4838", # Narrowing conversion. Doesn't seem to be very useful.
143 "/wd4995", # 'X': name was marked as #pragma deprecated
144 "/wd4996", # Deprecated function warning.
145
146 # These are variable shadowing warnings that are new in VS2015. We
147 # should work through these at some point -- they may be removed from
148 # the RTM release in the /W4 set.
149 "/wd4456",
150 "/wd4457",
151 "/wd4458",
152 "/wd4459",
153
154 # All of our compilers support the extensions below.
155 "/wd4200", # nonstandard extension used: zero-sized array in
156 # struct/union
157 "/wd4201", # nonstandard extension used: nameless struct/union
158 "/wd4204", # nonstandard extension used : non-constant aggregate
159 # initializer
160
161 "/wd4221", # nonstandard extension used : 'identifier' : cannot be
162 # initialized using address of automatic variable
163
164 # http://crbug.com/588506 - Conversion suppressions waiting on Clang
165 # -Wconversion.
166 "/wd4245", # 'conversion' : conversion from 'type1' to 'type2',
167 # signed/unsigned mismatch
168
169 "/wd4267", # 'var' : conversion from 'size_t' to 'type', possible loss
Lei Zhangb8df4c32023-06-16 23:29:34 +0000170 # of data
Lei Zhang46d645f2021-10-11 21:13:27 +0000171
172 "/wd4305", # 'identifier' : truncation from 'type1' to 'type2'
173 "/wd4389", # 'operator' : signed/unsigned mismatch
174
175 "/wd4702", # unreachable code
176
177 # http://crbug.com/848979 - MSVC is more conservative than Clang with
178 # regards to variables initialized and consumed in different branches.
179 "/wd4701", # Potentially uninitialized local variable 'name' used
180 "/wd4703", # Potentially uninitialized local pointer variable 'name'
181 # used
182
183 # http://crbug.com/848979 - Remaining Clang permitted warnings.
184 "/wd4661", # 'identifier' : no suitable definition provided for
185 # explicit
186 # template instantiation request
187
188 "/wd4706", # assignment within conditional expression
189 # MSVC is stricter and requires a boolean expression.
190
191 "/wd4715", # 'function' : not all control paths return a value'
192 # MSVC does not analyze switch (enum) for completeness.
193 ]
194
195 cflags_cc += [
196 # Allow "noexcept" annotations even though we compile with exceptions
197 # disabled.
198 "/wd4577",
199 ]
200
201 if (current_cpu == "x86") {
Lei Zhang46d645f2021-10-11 21:13:27 +0000202 if (msvc_use_sse2) {
203 cflags += [ "/arch:SSE2" ]
204 }
205 }
Hui Yingst5c2b3be2021-08-27 20:19:07 +0000206 }
Lei Zhang75a486e2018-11-30 00:04:23 +0000207 }
Lei Zhang85e7dc62020-07-30 19:59:51 +0000208
209 if (is_clang) {
210 # Override -Wno-c++11-narrowing.
211 cflags += [ "-Wc++11-narrowing" ]
Tom Sepezc026b202021-04-08 22:06:57 +0000212
Tom Sepez04961452022-01-12 21:11:43 +0000213 # May flag some issues when converting int to size_t.
214 cflags += [ "-Wtautological-unsigned-zero-compare" ]
Lei Zhang85e7dc62020-07-30 19:59:51 +0000215 }
216
217 if (!is_win && !is_clang) {
Lei Zhang0f286c22022-04-30 01:33:32 +0000218 cflags += [
219 # Override -Wno-narrowing for GCC.
220 "-Wnarrowing",
221
222 # GCC assumes that control can get past an exhaustive switch and then
223 # warns if there's no return there.
224 "-Wno-return-type",
225 ]
Lei Zhang85e7dc62020-07-30 19:59:51 +0000226 }
Tom Sepezf0dc8642024-04-10 01:01:47 +0000227
228 if (clang_use_chrome_plugins) {
229 defines += [ "PDF_USE_CHROME_PLUGINS" ]
230
231 # Catch misuse of C-style pointers.
232 # TODO(crbug.com/1320670): enable for non-debug builds once this stops
233 # interfering with code generation.
234 # TODO(tsepez): enable for windows, too.
235 if (is_debug && !is_win) {
236 cflags += [
237 "-Xclang",
Takashi Sakamoto6b9d58e2024-06-24 17:28:22 +0000238 "-plugin-arg-raw-ptr-plugin",
Tom Sepezf0dc8642024-04-10 01:01:47 +0000239 "-Xclang",
240 "check-raw-ptr-fields",
241
242 "-Xclang",
Takashi Sakamoto6b9d58e2024-06-24 17:28:22 +0000243 "-plugin-arg-raw-ptr-plugin",
Tom Sepezf0dc8642024-04-10 01:01:47 +0000244 "-Xclang",
245 "raw-ptr-exclude-path=public",
246
247 "-Xclang",
Takashi Sakamoto6b9d58e2024-06-24 17:28:22 +0000248 "-plugin-arg-raw-ptr-plugin",
Tom Sepezf0dc8642024-04-10 01:01:47 +0000249 "-Xclang",
250 "raw-ptr-exclude-path=test",
251
252 # TODO(tsepez): enforce raw_ref<> as well.
253 # "-Xclang",
Takashi Sakamoto6b9d58e2024-06-24 17:28:22 +0000254 # "-plugin-arg-raw-ptr-plugin",
Tom Sepezf0dc8642024-04-10 01:01:47 +0000255 # "-Xclang",
256 # "check-raw-ref-fields",
257 ]
258 defines += [ "PDF_ENABLE_UNOWNED_PTR_EXCLUSION" ]
259 }
260
261 # Catch misuse of cppgc in XFA.
262 if (pdf_enable_xfa) {
263 cflags += [
264 "-Xclang",
265 "-add-plugin",
266 "-Xclang",
267 "blink-gc-plugin",
268 ]
269
270 # Disable GC plugin forbidding off-heap collections of GCed:
271 cflags += [
272 "-Xclang",
273 "-plugin-arg-blink-gc-plugin",
274 "-Xclang",
275 "disable-off-heap-collections-of-gced-check",
276 ]
277 }
278 }
Lei Zhang75a486e2018-11-30 00:04:23 +0000279}
280
Tom Anderson0db20e02019-05-14 22:38:47 +0000281config("pdfium_implementation_config") {
282 defines = [ "FPDF_IMPLEMENTATION" ]
283 visibility = [ ":pdfium_public_headers" ]
284}
285
Lei Zhang75a486e2018-11-30 00:04:23 +0000286config("pdfium_public_config") {
287 defines = []
288
289 if (pdf_enable_v8) {
290 defines += [ "PDF_ENABLE_V8" ]
Lei Zhang75a486e2018-11-30 00:04:23 +0000291
Lei Zhang7b5740a2018-11-30 19:02:59 +0000292 if (pdf_enable_xfa) {
293 defines += [ "PDF_ENABLE_XFA" ]
294 if (pdf_enable_xfa_bmp) {
295 defines += [ "PDF_ENABLE_XFA_BMP" ]
296 }
297 if (pdf_enable_xfa_gif) {
298 defines += [ "PDF_ENABLE_XFA_GIF" ]
299 }
300 if (pdf_enable_xfa_png) {
301 defines += [ "PDF_ENABLE_XFA_PNG" ]
302 }
303 if (pdf_enable_xfa_tiff) {
304 defines += [ "PDF_ENABLE_XFA_TIFF" ]
305 }
Tom Sepez73c9f3b2017-02-27 10:12:59 -0800306 }
Tom Sepeza8a39e22015-10-12 15:47:07 -0700307 }
Alan Screenf22325c2024-01-31 23:51:20 +0000308
309 if (pdf_use_skia) {
310 defines += [ "PDF_USE_SKIA" ]
311 }
weili0abe6522016-06-06 14:41:22 -0700312}
Tom Sepeza8a39e22015-10-12 15:47:07 -0700313
weili0abe6522016-06-06 14:41:22 -0700314config("pdfium_core_config") {
315 cflags = []
Lei Zhang75a486e2018-11-30 00:04:23 +0000316 configs = [
317 ":pdfium_common_config",
318 ":pdfium_public_config",
Lei Zhangf4d4fee2019-12-04 18:06:13 +0000319 "//build/config/compiler:noshadowing",
Lei Zhang75a486e2018-11-30 00:04:23 +0000320 ]
Lei Zhangd565ca72019-01-10 00:23:55 +0000321 defines = []
John Abd-El-Malekd68f9a32014-06-05 12:45:33 -0700322 if (is_win) {
Tom Sepez3bb57512017-03-28 14:09:43 -0700323 cflags += [
Tom Sepez5171a272017-06-01 12:29:09 -0700324 "/wd4324",
Tom Sepez3bb57512017-03-28 14:09:43 -0700325 "/wd4577",
326 ]
John Abd-El-Malekd68f9a32014-06-05 12:45:33 -0700327 }
Lei Zhangc207ee22023-04-28 20:11:23 +0000328 if (is_clang) {
329 cflags += [ "-Wcovered-switch-default" ]
330 }
weilidcc29b12016-05-27 17:58:23 -0700331}
Lei Zhang476ac132015-11-05 20:07:27 -0800332
Lei Zhang7a5f8ee2021-04-24 00:19:10 +0000333config("pdfium_strict_config") {
334 configs = [
335 ":pdfium_core_config",
336 "//build/config/compiler:wexit_time_destructors",
337 "//build/config/compiler:wglobal_constructors",
338 ]
339}
340
Tom Sepez926cd3c2022-02-14 20:38:35 +0000341config("pdfium_noshorten_config") {
342 cflags = []
343 if (is_clang) {
344 cflags += [ "-Wshorten-64-to-32" ]
345 }
346}
347
Daniel Hosseinian0fab9e62019-11-01 19:31:49 +0000348source_set("pdfium_public_headers_impl") {
Lei Zhang1987bbf2018-10-15 23:12:06 +0000349 sources = [
350 "public/cpp/fpdf_deleters.h",
351 "public/cpp/fpdf_scopers.h",
352 "public/fpdf_annot.h",
353 "public/fpdf_attachment.h",
354 "public/fpdf_catalog.h",
355 "public/fpdf_dataavail.h",
356 "public/fpdf_doc.h",
357 "public/fpdf_edit.h",
358 "public/fpdf_ext.h",
359 "public/fpdf_flatten.h",
360 "public/fpdf_formfill.h",
361 "public/fpdf_fwlevent.h",
Lei Zhang25661d12019-08-01 21:57:23 +0000362 "public/fpdf_javascript.h",
Lei Zhang1987bbf2018-10-15 23:12:06 +0000363 "public/fpdf_ppo.h",
364 "public/fpdf_progressive.h",
365 "public/fpdf_save.h",
366 "public/fpdf_searchex.h",
Miklos Vajna2b76bf92020-06-25 21:35:26 +0000367 "public/fpdf_signature.h",
Lei Zhang1987bbf2018-10-15 23:12:06 +0000368 "public/fpdf_structtree.h",
369 "public/fpdf_sysfontinfo.h",
370 "public/fpdf_text.h",
371 "public/fpdf_transformpage.h",
372 "public/fpdfview.h",
373 ]
Tom Anderson0db20e02019-05-14 22:38:47 +0000374}
Lei Zhang75a486e2018-11-30 00:04:23 +0000375
Tom Anderson0db20e02019-05-14 22:38:47 +0000376group("pdfium_public_headers") {
Lei Zhang40f9d722020-01-24 00:18:11 +0000377 public_deps = [ ":pdfium_public_headers_impl" ]
Tom Anderson0db20e02019-05-14 22:38:47 +0000378 public_configs = [
379 ":pdfium_public_config",
380 ":pdfium_implementation_config",
381 ]
Lei Zhang1987bbf2018-10-15 23:12:06 +0000382}
383
Daniel Hosseinian0fab9e62019-11-01 19:31:49 +0000384component("pdfium") {
Alan Screen68b78712023-01-28 03:59:30 +0000385 output_name = "pdfium"
John Abd-El-Malekd68f9a32014-06-05 12:45:33 -0700386 libs = []
Lei Zhang7a5f8ee2021-04-24 00:19:10 +0000387 configs += [ ":pdfium_strict_config" ]
Tom Anderson0db20e02019-05-14 22:38:47 +0000388 public_configs = [ ":pdfium_public_config" ]
John Abd-El-Malekd68f9a32014-06-05 12:45:33 -0700389
390 deps = [
Lei Zhang76833a62018-10-12 18:53:17 +0000391 "constants",
Lei Zhang21ce4ff2018-10-15 18:30:49 +0000392 "core/fpdfapi/page",
393 "core/fpdfapi/parser",
Lei Zhang84600882018-10-12 18:58:21 +0000394 "core/fpdfdoc",
Lei Zhang84600882018-10-12 18:58:21 +0000395 "core/fxcodec",
Lei Zhang995374a2018-10-12 19:52:04 +0000396 "core/fxcrt",
Lei Zhang84600882018-10-12 18:58:21 +0000397 "core/fxge",
Lei Zhangdcab8cf2018-10-12 18:39:56 +0000398 "fpdfsdk",
399 "fpdfsdk/formfiller",
Lei Zhanga7dec322018-10-12 18:36:51 +0000400 "fxjs",
John Abd-El-Malekd68f9a32014-06-05 12:45:33 -0700401 ]
402
thestig73c48562016-09-06 14:07:17 -0700403 public_deps = [
Tom Anderson0db20e02019-05-14 22:38:47 +0000404 ":pdfium_public_headers_impl",
Lei Zhang995374a2018-10-12 19:52:04 +0000405 "core/fxcrt",
thestig73c48562016-09-06 14:07:17 -0700406 ]
Tom Sepeza8a39e22015-10-12 15:47:07 -0700407
Lei Zhangd7f51c72018-10-15 17:47:57 +0000408 if (pdf_enable_xfa) {
409 deps += [
410 "fpdfsdk/fpdfxfa",
411 "xfa/fxfa",
412 "xfa/fxfa/parser",
413 ]
Lei Zhangd7f51c72018-10-15 17:47:57 +0000414 }
415
John Abd-El-Malekd68f9a32014-06-05 12:45:33 -0700416 if (is_win) {
Dan Sinclairbc6c6722015-10-22 14:58:54 -0400417 libs += [
418 "advapi32.lib",
419 "gdi32.lib",
420 "user32.lib",
421 ]
John Abd-El-Malekd68f9a32014-06-05 12:45:33 -0700422 }
423
424 if (is_mac) {
Sylvain Defresne7e78b972020-07-07 18:02:25 +0000425 frameworks = [
Dan Sinclairbc6c6722015-10-22 14:58:54 -0400426 "AppKit.framework",
427 "CoreFoundation.framework",
428 ]
John Abd-El-Malekd68f9a32014-06-05 12:45:33 -0700429 }
John Abd-El-Malekef4dce42015-02-02 16:52:07 -0800430
dan sinclairfa171d22017-03-26 22:38:17 -0400431 if (pdf_is_complete_lib) {
Daniel Hosseinian1d0d0be2019-11-04 21:22:24 +0000432 static_component_type = "static_library"
dan sinclairfa171d22017-03-26 22:38:17 -0400433 complete_static_lib = true
Tom Andersonda89ac42018-03-21 03:56:15 +0000434 configs -= [ "//build/config/compiler:thin_archive" ]
dan sinclairfa171d22017-03-26 22:38:17 -0400435 }
John Abd-El-Malekd68f9a32014-06-05 12:45:33 -0700436}
437
Dirk Prankef9562f52023-02-28 01:30:53 +0000438# Targets below this are only visible within this file.
439visibility = [ ":*" ]
John Abd-El-Malekd68f9a32014-06-05 12:45:33 -0700440
Lei Zhangf03f7812018-10-15 23:48:29 +0000441group("pdfium_unittest_deps") {
Lei Zhangdbaf3b82018-10-11 17:02:43 +0000442 testonly = true
Lei Zhangf03f7812018-10-15 23:48:29 +0000443 public_deps = [
444 "core/fxcrt",
Tom Sepez22818532020-07-22 20:40:56 +0000445 "testing:unit_test_support",
Tom Sepez16b9d772017-04-17 09:07:48 -0700446 "//testing/gmock",
Dan Sinclairfffc9632016-03-08 08:57:05 -0500447 "//testing/gtest",
Tom Sepez04681f32015-01-09 13:59:19 -0800448 ]
Lei Zhangf03f7812018-10-15 23:48:29 +0000449 visibility += [
450 "core/*",
451 "fpdfsdk/*",
452 "fxbarcode/*",
453 "fxjs/*",
454 "xfa/*",
455 ]
456}
457
458test("pdfium_unittests") {
459 testonly = true
Lei Zhang40f9d722020-01-24 00:18:11 +0000460 sources = [ "testing/unit_test_main.cpp" ]
Lei Zhangf03f7812018-10-15 23:48:29 +0000461 deps = [
462 "core/fdrm:unittests",
463 "core/fpdfapi/edit:unittests",
464 "core/fpdfapi/font:unittests",
465 "core/fpdfapi/page:unittests",
466 "core/fpdfapi/parser:unittests",
Lei Zhangac520152018-11-09 22:58:56 +0000467 "core/fpdfapi/render:unittests",
Lei Zhangf03f7812018-10-15 23:48:29 +0000468 "core/fpdfdoc:unittests",
469 "core/fpdftext:unittests",
470 "core/fxcodec:unittests",
471 "core/fxcrt",
472 "core/fxcrt:unittests",
Lei Zhangf03f7812018-10-15 23:48:29 +0000473 "core/fxge:unittests",
474 "fpdfsdk:unittests",
Lei Zhang220ef3d2019-02-05 20:40:54 +0000475 "testing:unit_test_support",
Lei Zhangf03f7812018-10-15 23:48:29 +0000476 "//testing/gmock",
477 "//testing/gtest",
478 ]
479 configs += [ ":pdfium_core_config" ]
Lei Zhanga996ff42018-10-15 23:49:48 +0000480 if (is_android) {
481 use_raw_android_executable = true
482 }
Lei Zhanga996ff42018-10-15 23:49:48 +0000483 if (pdf_enable_v8) {
484 configs += [ "//v8:external_startup_data" ]
485 deps += [
486 "fxjs:unittests",
487 "//v8",
488 ]
Tom Sepez22818532020-07-22 20:40:56 +0000489 if (pdf_enable_xfa) {
490 deps += [
491 "core/fxcrt/css:unittests",
492 "fxbarcode:unittests",
493 "xfa/fde:unittests",
Tom Sepeza58a6762020-10-14 00:14:53 +0000494 "xfa/fgas/crt:unittests",
Tom Sepez92905222021-12-07 00:03:27 +0000495 "xfa/fgas/font:unittests",
Tom Sepez22818532020-07-22 20:40:56 +0000496 "xfa/fgas/layout:unittests",
497 "xfa/fxfa:unittests",
Lei Zhang605b4e12022-02-24 01:43:24 +0000498 "xfa/fxfa/formcalc:unittests",
Tom Sepez22818532020-07-22 20:40:56 +0000499 "xfa/fxfa/parser:unittests",
500 ]
501 }
Tom Sepezd2e023b2015-12-08 14:36:16 -0800502 }
Tom Sepez04681f32015-01-09 13:59:19 -0800503}
Tom Sepez1b1bb492015-01-22 17:36:32 -0800504
Lei Zhang1929d6e2018-10-15 23:51:28 +0000505group("pdfium_embeddertest_deps") {
506 testonly = true
507 public_deps = [
508 ":pdfium_public_headers",
509 "core/fxcrt",
510 "testing:embedder_test_support",
Lei Zhang1929d6e2018-10-15 23:51:28 +0000511 "//testing/gmock",
512 "//testing/gtest",
513 ]
514 visibility += [
515 "core/*",
516 "fpdfsdk/*",
517 "fxjs/*",
518 "xfa/*",
519 ]
520}
521
Tom Sepez1b1bb492015-01-22 17:36:32 -0800522test("pdfium_embeddertests") {
Lei Zhangdbaf3b82018-10-11 17:02:43 +0000523 testonly = true
Lei Zhang40f9d722020-01-24 00:18:11 +0000524 sources = [ "testing/embedder_test_main.cpp" ]
Tom Sepez1b1bb492015-01-22 17:36:32 -0800525 deps = [
Tom Sepezaf33f512020-06-12 01:00:10 +0000526 ":pdfium_embeddertest_deps",
Lei Zhang1929d6e2018-10-15 23:51:28 +0000527 "core/fpdfapi/edit:embeddertests",
Lei Zhang1929d6e2018-10-15 23:51:28 +0000528 "core/fpdfapi/parser:embeddertests",
529 "core/fpdfapi/render:embeddertests",
530 "core/fxcodec:embeddertests",
Tom Anderson0db20e02019-05-14 22:38:47 +0000531 "core/fxcrt",
Lei Zhang1929d6e2018-10-15 23:51:28 +0000532 "core/fxge:embeddertests",
533 "fpdfsdk:embeddertests",
Tom Sepezec350d92022-10-26 15:52:36 +0000534 "fpdfsdk/formfiller:embeddertests",
Lei Zhang1929d6e2018-10-15 23:51:28 +0000535 "fpdfsdk/pwl:embeddertests",
Lei Zhang76833a62018-10-12 18:53:17 +0000536 "testing/image_diff",
Dan Sinclairfffc9632016-03-08 08:57:05 -0500537 "//testing/gmock",
538 "//testing/gtest",
Tom Sepez1b1bb492015-01-22 17:36:32 -0800539 ]
dsinclair685bb882016-04-20 07:32:39 -0700540 include_dirs = [ "testing/gmock/include" ]
thestigc65e11e2016-08-30 21:56:33 -0700541 configs += [ ":pdfium_core_config" ]
542
Lei Zhanga996ff42018-10-15 23:49:48 +0000543 if (is_android) {
544 ignore_all_data_deps = true
545 use_raw_android_executable = true
546 }
547
Tom Sepez452b4f32015-10-13 09:27:27 -0700548 if (pdf_enable_v8) {
Lei Zhang1929d6e2018-10-15 23:51:28 +0000549 deps += [
550 "fxjs:embeddertests",
551 "//v8",
Lei Zhang1ac47eb2015-12-21 11:04:44 -0800552 ]
Jochen Eisinger7ed503d2015-12-10 14:38:06 +0100553 configs += [ "//v8:external_startup_data" ]
Tom Sepez452b4f32015-10-13 09:27:27 -0700554 }
Lei Zhanga996ff42018-10-15 23:49:48 +0000555
Dan Sinclair14aacd52017-05-18 14:11:29 -0400556 if (pdf_enable_xfa) {
Lei Zhang1929d6e2018-10-15 23:51:28 +0000557 deps += [
Lei Zhang83458252019-03-14 20:07:20 +0000558 "fpdfsdk/fpdfxfa:embeddertests",
Lei Zhang1929d6e2018-10-15 23:51:28 +0000559 "xfa/fwl:embeddertests",
Tom Sepez6e4710a2019-05-08 17:23:18 +0000560 "xfa/fxfa/layout:embeddertests",
Lei Zhang1929d6e2018-10-15 23:51:28 +0000561 "xfa/fxfa/parser:embeddertests",
Dan Sinclair14aacd52017-05-18 14:11:29 -0400562 ]
563 }
Tom Sepez1b1bb492015-01-22 17:36:32 -0800564}
dsinclair685bb882016-04-20 07:32:39 -0700565
Tom Sepez1d78f4d2018-10-22 20:17:38 +0000566executable("pdfium_diff") {
K. Moonbce0a8f2023-07-13 20:12:24 +0000567 visibility += [ "testing/tools:test_runner_py" ]
Tom Sepez1d78f4d2018-10-22 20:17:38 +0000568 testonly = true
Lei Zhang40f9d722020-01-24 00:18:11 +0000569 sources = [ "testing/image_diff/image_diff.cpp" ]
Tom Sepez1d78f4d2018-10-22 20:17:38 +0000570 deps = [
Tom Anderson93101062019-05-07 02:08:43 +0000571 "core/fxcrt",
Lei Zhang24204472020-08-22 00:51:02 +0000572 "testing:path_service",
Tom Sepez1d78f4d2018-10-22 20:17:38 +0000573 "testing/image_diff",
574 "//build/win:default_exe_manifest",
575 ]
Lei Zhang7a5f8ee2021-04-24 00:19:10 +0000576 configs += [ ":pdfium_strict_config" ]
Tom Sepez1d78f4d2018-10-22 20:17:38 +0000577}
578
Lei Zhangf02c8bf2017-04-01 01:35:01 -0700579group("pdfium_all") {
580 testonly = true
581 deps = [
Tom Sepez1d78f4d2018-10-22 20:17:38 +0000582 ":pdfium_diff",
Lei Zhangf02c8bf2017-04-01 01:35:01 -0700583 ":pdfium_embeddertests",
584 ":pdfium_unittests",
Tom Sepez7c7b4c72024-05-09 07:21:41 +0000585 "testing:pdfium_test",
Tom Sepezd9e3f3f2023-07-24 23:29:11 +0000586 "testing/fuzzers",
Lei Zhangf02c8bf2017-04-01 01:35:01 -0700587 ]
K. Moon55e793a2023-07-31 22:48:35 +0000588
589 if (pdf_is_standalone) {
590 deps += [ "testing/tools:test_runner_py" ]
591 }
Lei Zhangf02c8bf2017-04-01 01:35:01 -0700592}
K. Moon1852aa02022-11-10 18:56:52 +0000593
594# Makes additional targets reachable only for "gn check". These are not always
595# built by the "all" Ninja target, which uses the "default" group, which in turn
596# depends on the "pdfium_all" group.
597group("gn_check") {
598 deps = []
599
600 # TODO(crbug.com/pdfium/1832): Remove !is_android when //third_party/expat is
601 # available.
K. Moona98c0892022-11-12 00:44:23 +0000602 if (defined(checkout_skia) && checkout_skia && !is_android) {
K. Moon1852aa02022-11-10 18:56:52 +0000603 deps += [ "//skia" ]
604 }
605}