blob: cb1da47dfc374be3d6f3af34c4533360ed9ae0ff [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
12 deps = [ ":pdfium_all" ]
13}
14
Dominik Röttsches4b0671a2017-03-30 11:07:43 +030015group("freetype_common") {
16 public_deps = []
17 if (pdf_bundle_freetype) {
18 public_deps += [ "third_party:fx_freetype" ]
19 } else {
20 public_deps += [ "//build/config/freetype" ]
21 }
22}
23
weili0abe6522016-06-06 14:41:22 -070024config("pdfium_common_config") {
John Abd-El-Malekd68f9a32014-06-05 12:45:33 -070025 cflags = []
Lei Zhang46d645f2021-10-11 21:13:27 +000026 cflags_cc = []
dsinclair6e162b52017-01-24 11:18:16 -080027 ldflags = []
Dominik Röttsches4b0671a2017-03-30 11:07:43 +030028 include_dirs = [ "." ]
K. Moone6660322022-11-15 23:24:08 +000029 defines = []
John Abd-El-Malekd68f9a32014-06-05 12:45:33 -070030
Felix Kauselmann8d72a472019-02-13 23:44:56 +000031 if (!use_system_libopenjpeg2) {
32 defines += [ "OPJ_STATIC" ]
33 }
34
Ryan Harrison9ce75b82018-06-06 19:45:14 +000035 if (pdf_enable_click_logging) {
36 defines += [ "PDF_ENABLE_CLICK_LOGGING" ]
37 }
38
Lei Zhang75a486e2018-11-30 00:04:23 +000039 if (pdf_use_skia) {
40 defines += [ "_SKIA_SUPPORT_" ]
41 }
42
Tom Sepez907b4592023-01-26 20:46:39 +000043 if (pdf_use_partition_alloc) {
44 defines += [ "PDF_USE_PARTITION_ALLOC" ]
45 }
46
Lei Zhang75a486e2018-11-30 00:04:23 +000047 if (is_win) {
48 # Assume UTF-8 by default to avoid code page dependencies.
49 cflags += [ "/utf-8" ]
Lei Zhang46d645f2021-10-11 21:13:27 +000050
51 if (!is_clang) {
52 cflags += [
53 # Warnings permanently disabled:
54
55 # C4091: 'typedef ': ignored on left of 'X' when no variable is
56 # declared.
57 # This happens in a number of Windows headers. Dumb.
58 "/wd4091",
59
60 # C4127: conditional expression is constant
61 # This warning can in theory catch dead code and other problems, but
62 # triggers in far too many desirable cases where the conditional
63 # expression is either set by macros or corresponds some legitimate
64 # compile-time constant expression (due to constant template args,
65 # conditionals comparing the sizes of different types, etc.). Some of
66 # these can be worked around, but it's not worth it.
67 "/wd4127",
68
69 # C4251: 'identifier' : class 'type' needs to have dll-interface to be
70 # used by clients of class 'type2'
71 # This is necessary for the shared library build.
72 "/wd4251",
73
74 # C4275: non dll-interface class used as base for dll-interface class
75 # This points out a potential (but rare) problem with referencing static
76 # fields of a non-exported base, through the base's non-exported inline
77 # functions, or directly. The warning is subtle enough that people just
78 # suppressed it when they saw it, so it's not worth it.
79 "/wd4275",
80
81 # C4312 is a VS 2015 64-bit warning for integer to larger pointer.
82 # TODO(brucedawson): fix warnings, crbug.com/554200
83 "/wd4312",
84
85 # C4324 warns when padding is added to fulfill alignas requirements,
86 # but can trigger in benign cases that are difficult to individually
87 # suppress.
88 "/wd4324",
89
90 # C4351: new behavior: elements of array 'array' will be default
91 # initialized
92 # This is a silly "warning" that basically just alerts you that the
93 # compiler is going to actually follow the language spec like it's
94 # supposed to, instead of not following it like old buggy versions did.
95 # There's absolutely no reason to turn this on.
96 "/wd4351",
97
98 # C4355: 'this': used in base member initializer list
99 # It's commonly useful to pass |this| to objects in a class' initializer
100 # list. While this warning can catch real bugs, most of the time the
101 # constructors in question don't attempt to call methods on the passed-in
102 # pointer (until later), and annotating every legit usage of this is
103 # simply more hassle than the warning is worth.
104 "/wd4355",
105
106 # C4503: 'identifier': decorated name length exceeded, name was
107 # truncated
108 # This only means that some long error messages might have truncated
109 # identifiers in the presence of lots of templates. It has no effect on
110 # program correctness and there's no real reason to waste time trying to
111 # prevent it.
112 "/wd4503",
113
114 # Warning C4589 says: "Constructor of abstract class ignores
115 # initializer for virtual base class." Disable this warning because it
116 # is flaky in VS 2015 RTM. It triggers on compiler generated
117 # copy-constructors in some cases.
118 "/wd4589",
119
120 # C4611: interaction between 'function' and C++ object destruction is
121 # non-portable
122 # This warning is unavoidable when using e.g. setjmp/longjmp. MSDN
123 # suggests using exceptions instead of setjmp/longjmp for C++, but
124 # Chromium code compiles without exception support. We therefore have to
125 # use setjmp/longjmp for e.g. JPEG decode error handling, which means we
126 # have to turn off this warning (and be careful about how object
127 # destruction happens in such cases).
128 "/wd4611",
129
130 # Warnings to evaluate and possibly fix/reenable later:
131
132 "/wd4100", # Unreferenced formal function parameter.
133 "/wd4121", # Alignment of a member was sensitive to packing.
134 "/wd4244", # Conversion: possible loss of data.
135 "/wd4505", # Unreferenced local function has been removed.
136 "/wd4510", # Default constructor could not be generated.
137 "/wd4512", # Assignment operator could not be generated.
138 "/wd4610", # Class can never be instantiated, constructor required.
139 "/wd4838", # Narrowing conversion. Doesn't seem to be very useful.
140 "/wd4995", # 'X': name was marked as #pragma deprecated
141 "/wd4996", # Deprecated function warning.
142
143 # These are variable shadowing warnings that are new in VS2015. We
144 # should work through these at some point -- they may be removed from
145 # the RTM release in the /W4 set.
146 "/wd4456",
147 "/wd4457",
148 "/wd4458",
149 "/wd4459",
150
151 # All of our compilers support the extensions below.
152 "/wd4200", # nonstandard extension used: zero-sized array in
153 # struct/union
154 "/wd4201", # nonstandard extension used: nameless struct/union
155 "/wd4204", # nonstandard extension used : non-constant aggregate
156 # initializer
157
158 "/wd4221", # nonstandard extension used : 'identifier' : cannot be
159 # initialized using address of automatic variable
160
161 # http://crbug.com/588506 - Conversion suppressions waiting on Clang
162 # -Wconversion.
163 "/wd4245", # 'conversion' : conversion from 'type1' to 'type2',
164 # signed/unsigned mismatch
165
166 "/wd4267", # 'var' : conversion from 'size_t' to 'type', possible loss
167 # of
168 # data
169
170 "/wd4305", # 'identifier' : truncation from 'type1' to 'type2'
171 "/wd4389", # 'operator' : signed/unsigned mismatch
172
173 "/wd4702", # unreachable code
174
175 # http://crbug.com/848979 - MSVC is more conservative than Clang with
176 # regards to variables initialized and consumed in different branches.
177 "/wd4701", # Potentially uninitialized local variable 'name' used
178 "/wd4703", # Potentially uninitialized local pointer variable 'name'
179 # used
180
181 # http://crbug.com/848979 - Remaining Clang permitted warnings.
182 "/wd4661", # 'identifier' : no suitable definition provided for
183 # explicit
184 # template instantiation request
185
186 "/wd4706", # assignment within conditional expression
187 # MSVC is stricter and requires a boolean expression.
188
189 "/wd4715", # 'function' : not all control paths return a value'
190 # MSVC does not analyze switch (enum) for completeness.
191 ]
192
193 cflags_cc += [
194 # Allow "noexcept" annotations even though we compile with exceptions
195 # disabled.
196 "/wd4577",
197 ]
198
199 if (current_cpu == "x86") {
200 cflags += [
201 # VC++ 2015 changes 32-bit size_t truncation warnings from 4244 to
202 # 4267. Example: short TruncTest(size_t x) { return x; }
203 # Since we disable 4244 we need to disable 4267 during migration.
204 # TODO(jschuh): crbug.com/167187 fix size_t to int truncations.
205 "/wd4267",
206 ]
207
208 if (msvc_use_sse2) {
209 cflags += [ "/arch:SSE2" ]
210 }
211 }
Hui Yingst5c2b3be2021-08-27 20:19:07 +0000212 }
Lei Zhang75a486e2018-11-30 00:04:23 +0000213 }
Lei Zhang85e7dc62020-07-30 19:59:51 +0000214
215 if (is_clang) {
216 # Override -Wno-c++11-narrowing.
217 cflags += [ "-Wc++11-narrowing" ]
Tom Sepezc026b202021-04-08 22:06:57 +0000218
Lei Zhang51155cc2021-06-12 00:19:57 +0000219 # TODO(crbug.com/1213098): Remove once this is in //build.
220 cflags += [ "-Wdeprecated-copy" ]
221
Tom Sepez04961452022-01-12 21:11:43 +0000222 # May flag some issues when converting int to size_t.
223 cflags += [ "-Wtautological-unsigned-zero-compare" ]
224
Tom Sepezc026b202021-04-08 22:06:57 +0000225 # Catch misuse of cppgc in XFA.
226 if (pdf_enable_xfa && clang_use_chrome_plugins) {
227 cflags += [
228 "-Xclang",
229 "-add-plugin",
230 "-Xclang",
231 "blink-gc-plugin",
232 ]
233 }
Lei Zhang85e7dc62020-07-30 19:59:51 +0000234 }
235
236 if (!is_win && !is_clang) {
Lei Zhang0f286c22022-04-30 01:33:32 +0000237 cflags += [
238 # Override -Wno-narrowing for GCC.
239 "-Wnarrowing",
240
241 # GCC assumes that control can get past an exhaustive switch and then
242 # warns if there's no return there.
243 "-Wno-return-type",
244 ]
Lei Zhang85e7dc62020-07-30 19:59:51 +0000245 }
Lei Zhang75a486e2018-11-30 00:04:23 +0000246}
247
Tom Anderson0db20e02019-05-14 22:38:47 +0000248config("pdfium_implementation_config") {
249 defines = [ "FPDF_IMPLEMENTATION" ]
250 visibility = [ ":pdfium_public_headers" ]
251}
252
Lei Zhang75a486e2018-11-30 00:04:23 +0000253config("pdfium_public_config") {
254 defines = []
255
256 if (pdf_enable_v8) {
257 defines += [ "PDF_ENABLE_V8" ]
Lei Zhang75a486e2018-11-30 00:04:23 +0000258
Lei Zhang7b5740a2018-11-30 19:02:59 +0000259 if (pdf_enable_xfa) {
260 defines += [ "PDF_ENABLE_XFA" ]
261 if (pdf_enable_xfa_bmp) {
262 defines += [ "PDF_ENABLE_XFA_BMP" ]
263 }
264 if (pdf_enable_xfa_gif) {
265 defines += [ "PDF_ENABLE_XFA_GIF" ]
266 }
267 if (pdf_enable_xfa_png) {
268 defines += [ "PDF_ENABLE_XFA_PNG" ]
269 }
270 if (pdf_enable_xfa_tiff) {
271 defines += [ "PDF_ENABLE_XFA_TIFF" ]
272 }
Tom Sepez73c9f3b2017-02-27 10:12:59 -0800273 }
Tom Sepeza8a39e22015-10-12 15:47:07 -0700274 }
weili0abe6522016-06-06 14:41:22 -0700275}
Tom Sepeza8a39e22015-10-12 15:47:07 -0700276
weili0abe6522016-06-06 14:41:22 -0700277config("pdfium_core_config") {
278 cflags = []
Lei Zhang75a486e2018-11-30 00:04:23 +0000279 configs = [
280 ":pdfium_common_config",
281 ":pdfium_public_config",
Lei Zhangf4d4fee2019-12-04 18:06:13 +0000282 "//build/config/compiler:noshadowing",
Lei Zhang75a486e2018-11-30 00:04:23 +0000283 ]
Lei Zhangd565ca72019-01-10 00:23:55 +0000284 defines = []
John Abd-El-Malekd68f9a32014-06-05 12:45:33 -0700285 if (is_win) {
Tom Sepez3bb57512017-03-28 14:09:43 -0700286 cflags += [
Tom Sepez5171a272017-06-01 12:29:09 -0700287 "/wd4324",
Tom Sepez3bb57512017-03-28 14:09:43 -0700288 "/wd4577",
289 ]
John Abd-El-Malekd68f9a32014-06-05 12:45:33 -0700290 }
weilidcc29b12016-05-27 17:58:23 -0700291}
Lei Zhang476ac132015-11-05 20:07:27 -0800292
Lei Zhang7a5f8ee2021-04-24 00:19:10 +0000293config("pdfium_strict_config") {
294 configs = [
295 ":pdfium_core_config",
296 "//build/config/compiler:wexit_time_destructors",
297 "//build/config/compiler:wglobal_constructors",
298 ]
299}
300
Tom Sepez926cd3c2022-02-14 20:38:35 +0000301config("pdfium_noshorten_config") {
302 cflags = []
303 if (is_clang) {
304 cflags += [ "-Wshorten-64-to-32" ]
305 }
306}
307
Daniel Hosseinian0fab9e62019-11-01 19:31:49 +0000308source_set("pdfium_public_headers_impl") {
Lei Zhang1987bbf2018-10-15 23:12:06 +0000309 sources = [
310 "public/cpp/fpdf_deleters.h",
311 "public/cpp/fpdf_scopers.h",
312 "public/fpdf_annot.h",
313 "public/fpdf_attachment.h",
314 "public/fpdf_catalog.h",
315 "public/fpdf_dataavail.h",
316 "public/fpdf_doc.h",
317 "public/fpdf_edit.h",
318 "public/fpdf_ext.h",
319 "public/fpdf_flatten.h",
320 "public/fpdf_formfill.h",
321 "public/fpdf_fwlevent.h",
Lei Zhang25661d12019-08-01 21:57:23 +0000322 "public/fpdf_javascript.h",
Lei Zhang1987bbf2018-10-15 23:12:06 +0000323 "public/fpdf_ppo.h",
324 "public/fpdf_progressive.h",
325 "public/fpdf_save.h",
326 "public/fpdf_searchex.h",
Miklos Vajna2b76bf92020-06-25 21:35:26 +0000327 "public/fpdf_signature.h",
Lei Zhang1987bbf2018-10-15 23:12:06 +0000328 "public/fpdf_structtree.h",
329 "public/fpdf_sysfontinfo.h",
330 "public/fpdf_text.h",
331 "public/fpdf_transformpage.h",
332 "public/fpdfview.h",
333 ]
Tom Anderson0db20e02019-05-14 22:38:47 +0000334}
Lei Zhang75a486e2018-11-30 00:04:23 +0000335
Tom Anderson0db20e02019-05-14 22:38:47 +0000336group("pdfium_public_headers") {
Lei Zhang40f9d722020-01-24 00:18:11 +0000337 public_deps = [ ":pdfium_public_headers_impl" ]
Tom Anderson0db20e02019-05-14 22:38:47 +0000338 public_configs = [
339 ":pdfium_public_config",
340 ":pdfium_implementation_config",
341 ]
Lei Zhang1987bbf2018-10-15 23:12:06 +0000342}
343
Daniel Hosseinian0fab9e62019-11-01 19:31:49 +0000344component("pdfium") {
Alan Screen68b78712023-01-28 03:59:30 +0000345 output_name = "pdfium"
John Abd-El-Malekd68f9a32014-06-05 12:45:33 -0700346 libs = []
Lei Zhang7a5f8ee2021-04-24 00:19:10 +0000347 configs += [ ":pdfium_strict_config" ]
Tom Anderson0db20e02019-05-14 22:38:47 +0000348 public_configs = [ ":pdfium_public_config" ]
John Abd-El-Malekd68f9a32014-06-05 12:45:33 -0700349
350 deps = [
Lei Zhang76833a62018-10-12 18:53:17 +0000351 "constants",
Lei Zhang21ce4ff2018-10-15 18:30:49 +0000352 "core/fpdfapi/page",
353 "core/fpdfapi/parser",
Lei Zhang84600882018-10-12 18:58:21 +0000354 "core/fpdfdoc",
Lei Zhang84600882018-10-12 18:58:21 +0000355 "core/fxcodec",
Lei Zhang995374a2018-10-12 19:52:04 +0000356 "core/fxcrt",
Lei Zhang84600882018-10-12 18:58:21 +0000357 "core/fxge",
Lei Zhangdcab8cf2018-10-12 18:39:56 +0000358 "fpdfsdk",
359 "fpdfsdk/formfiller",
Lei Zhanga7dec322018-10-12 18:36:51 +0000360 "fxjs",
Dan Sinclairfffc9632016-03-08 08:57:05 -0500361 "third_party:pdfium_base",
Dan Sinclair844d79e2018-02-16 03:46:26 +0000362 "third_party:skia_shared",
John Abd-El-Malekd68f9a32014-06-05 12:45:33 -0700363 ]
364
thestig73c48562016-09-06 14:07:17 -0700365 public_deps = [
Tom Anderson0db20e02019-05-14 22:38:47 +0000366 ":pdfium_public_headers_impl",
Lei Zhang995374a2018-10-12 19:52:04 +0000367 "core/fxcrt",
thestig73c48562016-09-06 14:07:17 -0700368 ]
Tom Sepeza8a39e22015-10-12 15:47:07 -0700369
Lei Zhangd7f51c72018-10-15 17:47:57 +0000370 if (pdf_enable_xfa) {
371 deps += [
372 "fpdfsdk/fpdfxfa",
373 "xfa/fxfa",
374 "xfa/fxfa/parser",
375 ]
Lei Zhangd7f51c72018-10-15 17:47:57 +0000376 }
377
John Abd-El-Malekd68f9a32014-06-05 12:45:33 -0700378 if (is_win) {
Dan Sinclairbc6c6722015-10-22 14:58:54 -0400379 libs += [
380 "advapi32.lib",
381 "gdi32.lib",
382 "user32.lib",
383 ]
John Abd-El-Malekd68f9a32014-06-05 12:45:33 -0700384 }
385
386 if (is_mac) {
Sylvain Defresne7e78b972020-07-07 18:02:25 +0000387 frameworks = [
Dan Sinclairbc6c6722015-10-22 14:58:54 -0400388 "AppKit.framework",
389 "CoreFoundation.framework",
390 ]
John Abd-El-Malekd68f9a32014-06-05 12:45:33 -0700391 }
John Abd-El-Malekef4dce42015-02-02 16:52:07 -0800392
dan sinclairfa171d22017-03-26 22:38:17 -0400393 if (pdf_is_complete_lib) {
Daniel Hosseinian1d0d0be2019-11-04 21:22:24 +0000394 static_component_type = "static_library"
dan sinclairfa171d22017-03-26 22:38:17 -0400395 complete_static_lib = true
Tom Andersonda89ac42018-03-21 03:56:15 +0000396 configs -= [ "//build/config/compiler:thin_archive" ]
dan sinclairfa171d22017-03-26 22:38:17 -0400397 }
John Abd-El-Malekd68f9a32014-06-05 12:45:33 -0700398}
399
Dirk Prankef9562f52023-02-28 01:30:53 +0000400# Targets below this are only visible within this file.
401visibility = [ ":*" ]
John Abd-El-Malekd68f9a32014-06-05 12:45:33 -0700402
Lei Zhangf03f7812018-10-15 23:48:29 +0000403group("pdfium_unittest_deps") {
Lei Zhangdbaf3b82018-10-11 17:02:43 +0000404 testonly = true
Lei Zhangf03f7812018-10-15 23:48:29 +0000405 public_deps = [
406 "core/fxcrt",
Tom Sepez22818532020-07-22 20:40:56 +0000407 "testing:unit_test_support",
Tom Sepez16b9d772017-04-17 09:07:48 -0700408 "//testing/gmock",
Dan Sinclairfffc9632016-03-08 08:57:05 -0500409 "//testing/gtest",
Tom Sepez04681f32015-01-09 13:59:19 -0800410 ]
Lei Zhangf03f7812018-10-15 23:48:29 +0000411 visibility += [
412 "core/*",
413 "fpdfsdk/*",
414 "fxbarcode/*",
415 "fxjs/*",
416 "xfa/*",
417 ]
418}
419
420test("pdfium_unittests") {
421 testonly = true
Lei Zhang40f9d722020-01-24 00:18:11 +0000422 sources = [ "testing/unit_test_main.cpp" ]
Lei Zhangf03f7812018-10-15 23:48:29 +0000423 deps = [
424 "core/fdrm:unittests",
425 "core/fpdfapi/edit:unittests",
426 "core/fpdfapi/font:unittests",
427 "core/fpdfapi/page:unittests",
428 "core/fpdfapi/parser:unittests",
Lei Zhangac520152018-11-09 22:58:56 +0000429 "core/fpdfapi/render:unittests",
Lei Zhangf03f7812018-10-15 23:48:29 +0000430 "core/fpdfdoc:unittests",
431 "core/fpdftext:unittests",
432 "core/fxcodec:unittests",
433 "core/fxcrt",
434 "core/fxcrt:unittests",
Lei Zhangf03f7812018-10-15 23:48:29 +0000435 "core/fxge:unittests",
436 "fpdfsdk:unittests",
Lei Zhang220ef3d2019-02-05 20:40:54 +0000437 "testing:unit_test_support",
Lei Zhangf03f7812018-10-15 23:48:29 +0000438 "//testing/gmock",
439 "//testing/gtest",
440 ]
441 configs += [ ":pdfium_core_config" ]
Lei Zhanga996ff42018-10-15 23:49:48 +0000442
443 if (is_android) {
444 use_raw_android_executable = true
445 }
446
447 if (pdf_enable_v8) {
448 configs += [ "//v8:external_startup_data" ]
449 deps += [
450 "fxjs:unittests",
451 "//v8",
452 ]
Lei Zhanga996ff42018-10-15 23:49:48 +0000453
Tom Sepez22818532020-07-22 20:40:56 +0000454 if (pdf_enable_xfa) {
455 deps += [
456 "core/fxcrt/css:unittests",
457 "fxbarcode:unittests",
458 "xfa/fde:unittests",
Tom Sepeza58a6762020-10-14 00:14:53 +0000459 "xfa/fgas/crt:unittests",
Tom Sepez92905222021-12-07 00:03:27 +0000460 "xfa/fgas/font:unittests",
Tom Sepez22818532020-07-22 20:40:56 +0000461 "xfa/fgas/layout:unittests",
462 "xfa/fxfa:unittests",
Lei Zhang605b4e12022-02-24 01:43:24 +0000463 "xfa/fxfa/formcalc:unittests",
Tom Sepez22818532020-07-22 20:40:56 +0000464 "xfa/fxfa/parser:unittests",
465 ]
466 }
Tom Sepezd2e023b2015-12-08 14:36:16 -0800467 }
Tom Sepez04681f32015-01-09 13:59:19 -0800468}
Tom Sepez1b1bb492015-01-22 17:36:32 -0800469
Lei Zhang1929d6e2018-10-15 23:51:28 +0000470group("pdfium_embeddertest_deps") {
471 testonly = true
472 public_deps = [
473 ":pdfium_public_headers",
474 "core/fxcrt",
475 "testing:embedder_test_support",
Lei Zhangfc455492019-06-14 17:16:09 +0000476 "third_party:pdfium_base_test_support",
Lei Zhang1929d6e2018-10-15 23:51:28 +0000477 "//testing/gmock",
478 "//testing/gtest",
479 ]
480 visibility += [
481 "core/*",
482 "fpdfsdk/*",
483 "fxjs/*",
484 "xfa/*",
485 ]
486}
487
Tom Sepez1b1bb492015-01-22 17:36:32 -0800488test("pdfium_embeddertests") {
Lei Zhangdbaf3b82018-10-11 17:02:43 +0000489 testonly = true
Lei Zhang40f9d722020-01-24 00:18:11 +0000490 sources = [ "testing/embedder_test_main.cpp" ]
Tom Sepez1b1bb492015-01-22 17:36:32 -0800491 deps = [
Tom Sepezaf33f512020-06-12 01:00:10 +0000492 ":pdfium_embeddertest_deps",
Lei Zhang1929d6e2018-10-15 23:51:28 +0000493 "core/fpdfapi/edit:embeddertests",
Lei Zhang1929d6e2018-10-15 23:51:28 +0000494 "core/fpdfapi/parser:embeddertests",
495 "core/fpdfapi/render:embeddertests",
496 "core/fxcodec:embeddertests",
Tom Anderson0db20e02019-05-14 22:38:47 +0000497 "core/fxcrt",
Lei Zhang1929d6e2018-10-15 23:51:28 +0000498 "core/fxge:embeddertests",
499 "fpdfsdk:embeddertests",
Tom Sepezec350d92022-10-26 15:52:36 +0000500 "fpdfsdk/formfiller:embeddertests",
Lei Zhang1929d6e2018-10-15 23:51:28 +0000501 "fpdfsdk/pwl:embeddertests",
Lei Zhang76833a62018-10-12 18:53:17 +0000502 "testing/image_diff",
Dan Sinclairfffc9632016-03-08 08:57:05 -0500503 "//testing/gmock",
504 "//testing/gtest",
Tom Sepez1b1bb492015-01-22 17:36:32 -0800505 ]
dsinclair685bb882016-04-20 07:32:39 -0700506 include_dirs = [ "testing/gmock/include" ]
thestigc65e11e2016-08-30 21:56:33 -0700507 configs += [ ":pdfium_core_config" ]
508
Lei Zhanga996ff42018-10-15 23:49:48 +0000509 if (is_android) {
510 ignore_all_data_deps = true
511 use_raw_android_executable = true
512 }
513
Tom Sepez452b4f32015-10-13 09:27:27 -0700514 if (pdf_enable_v8) {
Lei Zhang1929d6e2018-10-15 23:51:28 +0000515 deps += [
516 "fxjs:embeddertests",
517 "//v8",
Lei Zhang1ac47eb2015-12-21 11:04:44 -0800518 ]
Jochen Eisinger7ed503d2015-12-10 14:38:06 +0100519 configs += [ "//v8:external_startup_data" ]
Tom Sepez452b4f32015-10-13 09:27:27 -0700520 }
Lei Zhanga996ff42018-10-15 23:49:48 +0000521
Dan Sinclair14aacd52017-05-18 14:11:29 -0400522 if (pdf_enable_xfa) {
Lei Zhang1929d6e2018-10-15 23:51:28 +0000523 deps += [
Lei Zhang83458252019-03-14 20:07:20 +0000524 "fpdfsdk/fpdfxfa:embeddertests",
Lei Zhang1929d6e2018-10-15 23:51:28 +0000525 "xfa/fwl:embeddertests",
Tom Sepez6e4710a2019-05-08 17:23:18 +0000526 "xfa/fxfa/layout:embeddertests",
Lei Zhang1929d6e2018-10-15 23:51:28 +0000527 "xfa/fxfa/parser:embeddertests",
Dan Sinclair14aacd52017-05-18 14:11:29 -0400528 ]
529 }
Tom Sepez1b1bb492015-01-22 17:36:32 -0800530}
dsinclair685bb882016-04-20 07:32:39 -0700531
Tom Sepez1d78f4d2018-10-22 20:17:38 +0000532executable("pdfium_diff") {
533 testonly = true
Lei Zhang40f9d722020-01-24 00:18:11 +0000534 sources = [ "testing/image_diff/image_diff.cpp" ]
Tom Sepez1d78f4d2018-10-22 20:17:38 +0000535 deps = [
Tom Anderson93101062019-05-07 02:08:43 +0000536 "core/fxcrt",
Lei Zhang24204472020-08-22 00:51:02 +0000537 "testing:path_service",
Tom Sepez1d78f4d2018-10-22 20:17:38 +0000538 "testing/image_diff",
539 "//build/win:default_exe_manifest",
540 ]
Lei Zhang7a5f8ee2021-04-24 00:19:10 +0000541 configs += [ ":pdfium_strict_config" ]
Tom Sepez1d78f4d2018-10-22 20:17:38 +0000542}
543
dsinclair685bb882016-04-20 07:32:39 -0700544if (pdf_is_standalone) {
Daniel Hosseinian0fab9e62019-11-01 19:31:49 +0000545 source_set("samples") {
dsinclair685bb882016-04-20 07:32:39 -0700546 testonly = true
Lei Zhang40f9d722020-01-24 00:18:11 +0000547 deps = [ "//samples" ]
dsinclair685bb882016-04-20 07:32:39 -0700548 }
Lei Zhang143959d2017-06-22 12:20:58 -0700549
thestig62114cf2016-11-08 12:59:30 -0800550 group("fuzzers") {
551 testonly = true
Lei Zhang40f9d722020-01-24 00:18:11 +0000552 deps = [ "//testing/fuzzers" ]
thestig62114cf2016-11-08 12:59:30 -0800553 }
dsinclair685bb882016-04-20 07:32:39 -0700554}
Lei Zhangf02c8bf2017-04-01 01:35:01 -0700555
556group("pdfium_all") {
557 testonly = true
558 deps = [
Tom Sepez1d78f4d2018-10-22 20:17:38 +0000559 ":pdfium_diff",
Lei Zhangf02c8bf2017-04-01 01:35:01 -0700560 ":pdfium_embeddertests",
561 ":pdfium_unittests",
562 ]
563 if (pdf_is_standalone) {
564 deps += [
565 ":fuzzers",
566 ":samples",
567 ]
568 }
569}
K. Moon1852aa02022-11-10 18:56:52 +0000570
571# Makes additional targets reachable only for "gn check". These are not always
572# built by the "all" Ninja target, which uses the "default" group, which in turn
573# depends on the "pdfium_all" group.
574group("gn_check") {
575 deps = []
576
577 # TODO(crbug.com/pdfium/1832): Remove !is_android when //third_party/expat is
578 # available.
K. Moona98c0892022-11-12 00:44:23 +0000579 if (defined(checkout_skia) && checkout_skia && !is_android) {
K. Moon1852aa02022-11-10 18:56:52 +0000580 deps += [ "//skia" ]
581 }
582}