K. Moon | 8636cff | 2022-11-02 18:45:43 +0000 | [diff] [blame] | 1 | # Copyright 2016 The PDFium Authors |
John Abd-El-Malek | d68f9a3 | 2014-06-05 12:45:33 -0700 | [diff] [blame] | 2 | # Use of this source code is governed by a BSD-style license that can be |
| 3 | # found in the LICENSE file. |
| 4 | |
Tom Sepez | c026b20 | 2021-04-08 22:06:57 +0000 | [diff] [blame] | 5 | import("//build/config/clang/clang.gni") |
K. Moon | 4948d0e | 2022-11-11 18:54:40 +0000 | [diff] [blame] | 6 | import("//build/config/gclient_args.gni") |
Tom Sepez | a32f760 | 2015-01-15 09:34:34 -0800 | [diff] [blame] | 7 | import("//testing/test.gni") |
dsinclair | 038bf0b | 2016-04-30 06:00:05 -0700 | [diff] [blame] | 8 | import("pdfium.gni") |
John Abd-El-Malek | ef4dce4 | 2015-02-02 16:52:07 -0800 | [diff] [blame] | 9 | |
Tom Sepez | c3451da | 2022-08-29 17:52:22 +0000 | [diff] [blame] | 10 | group("default") { |
| 11 | testonly = true |
| 12 | deps = [ ":pdfium_all" ] |
| 13 | } |
| 14 | |
Dominik Röttsches | 4b0671a | 2017-03-30 11:07:43 +0300 | [diff] [blame] | 15 | group("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 | |
weili | 0abe652 | 2016-06-06 14:41:22 -0700 | [diff] [blame] | 24 | config("pdfium_common_config") { |
John Abd-El-Malek | d68f9a3 | 2014-06-05 12:45:33 -0700 | [diff] [blame] | 25 | cflags = [] |
Lei Zhang | 46d645f | 2021-10-11 21:13:27 +0000 | [diff] [blame] | 26 | cflags_cc = [] |
dsinclair | 6e162b5 | 2017-01-24 11:18:16 -0800 | [diff] [blame] | 27 | ldflags = [] |
Dominik Röttsches | 4b0671a | 2017-03-30 11:07:43 +0300 | [diff] [blame] | 28 | include_dirs = [ "." ] |
K. Moon | e666032 | 2022-11-15 23:24:08 +0000 | [diff] [blame] | 29 | defines = [] |
John Abd-El-Malek | d68f9a3 | 2014-06-05 12:45:33 -0700 | [diff] [blame] | 30 | |
Felix Kauselmann | 8d72a47 | 2019-02-13 23:44:56 +0000 | [diff] [blame] | 31 | if (!use_system_libopenjpeg2) { |
| 32 | defines += [ "OPJ_STATIC" ] |
| 33 | } |
| 34 | |
Ryan Harrison | 9ce75b8 | 2018-06-06 19:45:14 +0000 | [diff] [blame] | 35 | if (pdf_enable_click_logging) { |
| 36 | defines += [ "PDF_ENABLE_CLICK_LOGGING" ] |
| 37 | } |
| 38 | |
Lei Zhang | 75a486e | 2018-11-30 00:04:23 +0000 | [diff] [blame] | 39 | if (pdf_use_skia) { |
| 40 | defines += [ "_SKIA_SUPPORT_" ] |
| 41 | } |
| 42 | |
Tom Sepez | 907b459 | 2023-01-26 20:46:39 +0000 | [diff] [blame] | 43 | if (pdf_use_partition_alloc) { |
| 44 | defines += [ "PDF_USE_PARTITION_ALLOC" ] |
| 45 | } |
| 46 | |
Lei Zhang | 75a486e | 2018-11-30 00:04:23 +0000 | [diff] [blame] | 47 | if (is_win) { |
| 48 | # Assume UTF-8 by default to avoid code page dependencies. |
| 49 | cflags += [ "/utf-8" ] |
Lei Zhang | 46d645f | 2021-10-11 21:13:27 +0000 | [diff] [blame] | 50 | |
| 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 Yingst | 5c2b3be | 2021-08-27 20:19:07 +0000 | [diff] [blame] | 212 | } |
Lei Zhang | 75a486e | 2018-11-30 00:04:23 +0000 | [diff] [blame] | 213 | } |
Lei Zhang | 85e7dc6 | 2020-07-30 19:59:51 +0000 | [diff] [blame] | 214 | |
| 215 | if (is_clang) { |
| 216 | # Override -Wno-c++11-narrowing. |
| 217 | cflags += [ "-Wc++11-narrowing" ] |
Tom Sepez | c026b20 | 2021-04-08 22:06:57 +0000 | [diff] [blame] | 218 | |
Lei Zhang | 51155cc | 2021-06-12 00:19:57 +0000 | [diff] [blame] | 219 | # TODO(crbug.com/1213098): Remove once this is in //build. |
| 220 | cflags += [ "-Wdeprecated-copy" ] |
| 221 | |
Tom Sepez | 0496145 | 2022-01-12 21:11:43 +0000 | [diff] [blame] | 222 | # May flag some issues when converting int to size_t. |
| 223 | cflags += [ "-Wtautological-unsigned-zero-compare" ] |
| 224 | |
Tom Sepez | c026b20 | 2021-04-08 22:06:57 +0000 | [diff] [blame] | 225 | # 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 Zhang | 85e7dc6 | 2020-07-30 19:59:51 +0000 | [diff] [blame] | 234 | } |
| 235 | |
| 236 | if (!is_win && !is_clang) { |
Lei Zhang | 0f286c2 | 2022-04-30 01:33:32 +0000 | [diff] [blame] | 237 | 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 Zhang | 85e7dc6 | 2020-07-30 19:59:51 +0000 | [diff] [blame] | 245 | } |
Lei Zhang | 75a486e | 2018-11-30 00:04:23 +0000 | [diff] [blame] | 246 | } |
| 247 | |
Tom Anderson | 0db20e0 | 2019-05-14 22:38:47 +0000 | [diff] [blame] | 248 | config("pdfium_implementation_config") { |
| 249 | defines = [ "FPDF_IMPLEMENTATION" ] |
| 250 | visibility = [ ":pdfium_public_headers" ] |
| 251 | } |
| 252 | |
Lei Zhang | 75a486e | 2018-11-30 00:04:23 +0000 | [diff] [blame] | 253 | config("pdfium_public_config") { |
| 254 | defines = [] |
| 255 | |
| 256 | if (pdf_enable_v8) { |
| 257 | defines += [ "PDF_ENABLE_V8" ] |
Lei Zhang | 75a486e | 2018-11-30 00:04:23 +0000 | [diff] [blame] | 258 | |
Lei Zhang | 7b5740a | 2018-11-30 19:02:59 +0000 | [diff] [blame] | 259 | 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 Sepez | 73c9f3b | 2017-02-27 10:12:59 -0800 | [diff] [blame] | 273 | } |
Tom Sepez | a8a39e2 | 2015-10-12 15:47:07 -0700 | [diff] [blame] | 274 | } |
weili | 0abe652 | 2016-06-06 14:41:22 -0700 | [diff] [blame] | 275 | } |
Tom Sepez | a8a39e2 | 2015-10-12 15:47:07 -0700 | [diff] [blame] | 276 | |
weili | 0abe652 | 2016-06-06 14:41:22 -0700 | [diff] [blame] | 277 | config("pdfium_core_config") { |
| 278 | cflags = [] |
Lei Zhang | 75a486e | 2018-11-30 00:04:23 +0000 | [diff] [blame] | 279 | configs = [ |
| 280 | ":pdfium_common_config", |
| 281 | ":pdfium_public_config", |
Lei Zhang | f4d4fee | 2019-12-04 18:06:13 +0000 | [diff] [blame] | 282 | "//build/config/compiler:noshadowing", |
Lei Zhang | 75a486e | 2018-11-30 00:04:23 +0000 | [diff] [blame] | 283 | ] |
Lei Zhang | d565ca7 | 2019-01-10 00:23:55 +0000 | [diff] [blame] | 284 | defines = [] |
John Abd-El-Malek | d68f9a3 | 2014-06-05 12:45:33 -0700 | [diff] [blame] | 285 | if (is_win) { |
Tom Sepez | 3bb5751 | 2017-03-28 14:09:43 -0700 | [diff] [blame] | 286 | cflags += [ |
Tom Sepez | 5171a27 | 2017-06-01 12:29:09 -0700 | [diff] [blame] | 287 | "/wd4324", |
Tom Sepez | 3bb5751 | 2017-03-28 14:09:43 -0700 | [diff] [blame] | 288 | "/wd4577", |
| 289 | ] |
John Abd-El-Malek | d68f9a3 | 2014-06-05 12:45:33 -0700 | [diff] [blame] | 290 | } |
weili | dcc29b1 | 2016-05-27 17:58:23 -0700 | [diff] [blame] | 291 | } |
Lei Zhang | 476ac13 | 2015-11-05 20:07:27 -0800 | [diff] [blame] | 292 | |
Lei Zhang | 7a5f8ee | 2021-04-24 00:19:10 +0000 | [diff] [blame] | 293 | config("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 Sepez | 926cd3c | 2022-02-14 20:38:35 +0000 | [diff] [blame] | 301 | config("pdfium_noshorten_config") { |
| 302 | cflags = [] |
| 303 | if (is_clang) { |
| 304 | cflags += [ "-Wshorten-64-to-32" ] |
| 305 | } |
| 306 | } |
| 307 | |
Daniel Hosseinian | 0fab9e6 | 2019-11-01 19:31:49 +0000 | [diff] [blame] | 308 | source_set("pdfium_public_headers_impl") { |
Lei Zhang | 1987bbf | 2018-10-15 23:12:06 +0000 | [diff] [blame] | 309 | 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 Zhang | 25661d1 | 2019-08-01 21:57:23 +0000 | [diff] [blame] | 322 | "public/fpdf_javascript.h", |
Lei Zhang | 1987bbf | 2018-10-15 23:12:06 +0000 | [diff] [blame] | 323 | "public/fpdf_ppo.h", |
| 324 | "public/fpdf_progressive.h", |
| 325 | "public/fpdf_save.h", |
| 326 | "public/fpdf_searchex.h", |
Miklos Vajna | 2b76bf9 | 2020-06-25 21:35:26 +0000 | [diff] [blame] | 327 | "public/fpdf_signature.h", |
Lei Zhang | 1987bbf | 2018-10-15 23:12:06 +0000 | [diff] [blame] | 328 | "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 Anderson | 0db20e0 | 2019-05-14 22:38:47 +0000 | [diff] [blame] | 334 | } |
Lei Zhang | 75a486e | 2018-11-30 00:04:23 +0000 | [diff] [blame] | 335 | |
Tom Anderson | 0db20e0 | 2019-05-14 22:38:47 +0000 | [diff] [blame] | 336 | group("pdfium_public_headers") { |
Lei Zhang | 40f9d72 | 2020-01-24 00:18:11 +0000 | [diff] [blame] | 337 | public_deps = [ ":pdfium_public_headers_impl" ] |
Tom Anderson | 0db20e0 | 2019-05-14 22:38:47 +0000 | [diff] [blame] | 338 | public_configs = [ |
| 339 | ":pdfium_public_config", |
| 340 | ":pdfium_implementation_config", |
| 341 | ] |
Lei Zhang | 1987bbf | 2018-10-15 23:12:06 +0000 | [diff] [blame] | 342 | } |
| 343 | |
Daniel Hosseinian | 0fab9e6 | 2019-11-01 19:31:49 +0000 | [diff] [blame] | 344 | component("pdfium") { |
Alan Screen | 68b7871 | 2023-01-28 03:59:30 +0000 | [diff] [blame] | 345 | output_name = "pdfium" |
John Abd-El-Malek | d68f9a3 | 2014-06-05 12:45:33 -0700 | [diff] [blame] | 346 | libs = [] |
Lei Zhang | 7a5f8ee | 2021-04-24 00:19:10 +0000 | [diff] [blame] | 347 | configs += [ ":pdfium_strict_config" ] |
Tom Anderson | 0db20e0 | 2019-05-14 22:38:47 +0000 | [diff] [blame] | 348 | public_configs = [ ":pdfium_public_config" ] |
John Abd-El-Malek | d68f9a3 | 2014-06-05 12:45:33 -0700 | [diff] [blame] | 349 | |
| 350 | deps = [ |
Lei Zhang | 76833a6 | 2018-10-12 18:53:17 +0000 | [diff] [blame] | 351 | "constants", |
Lei Zhang | 21ce4ff | 2018-10-15 18:30:49 +0000 | [diff] [blame] | 352 | "core/fpdfapi/page", |
| 353 | "core/fpdfapi/parser", |
Lei Zhang | 8460088 | 2018-10-12 18:58:21 +0000 | [diff] [blame] | 354 | "core/fpdfdoc", |
Lei Zhang | 8460088 | 2018-10-12 18:58:21 +0000 | [diff] [blame] | 355 | "core/fxcodec", |
Lei Zhang | 995374a | 2018-10-12 19:52:04 +0000 | [diff] [blame] | 356 | "core/fxcrt", |
Lei Zhang | 8460088 | 2018-10-12 18:58:21 +0000 | [diff] [blame] | 357 | "core/fxge", |
Lei Zhang | dcab8cf | 2018-10-12 18:39:56 +0000 | [diff] [blame] | 358 | "fpdfsdk", |
| 359 | "fpdfsdk/formfiller", |
Lei Zhang | a7dec32 | 2018-10-12 18:36:51 +0000 | [diff] [blame] | 360 | "fxjs", |
Dan Sinclair | fffc963 | 2016-03-08 08:57:05 -0500 | [diff] [blame] | 361 | "third_party:pdfium_base", |
Dan Sinclair | 844d79e | 2018-02-16 03:46:26 +0000 | [diff] [blame] | 362 | "third_party:skia_shared", |
John Abd-El-Malek | d68f9a3 | 2014-06-05 12:45:33 -0700 | [diff] [blame] | 363 | ] |
| 364 | |
thestig | 73c4856 | 2016-09-06 14:07:17 -0700 | [diff] [blame] | 365 | public_deps = [ |
Tom Anderson | 0db20e0 | 2019-05-14 22:38:47 +0000 | [diff] [blame] | 366 | ":pdfium_public_headers_impl", |
Lei Zhang | 995374a | 2018-10-12 19:52:04 +0000 | [diff] [blame] | 367 | "core/fxcrt", |
thestig | 73c4856 | 2016-09-06 14:07:17 -0700 | [diff] [blame] | 368 | ] |
Tom Sepez | a8a39e2 | 2015-10-12 15:47:07 -0700 | [diff] [blame] | 369 | |
Lei Zhang | d7f51c7 | 2018-10-15 17:47:57 +0000 | [diff] [blame] | 370 | if (pdf_enable_xfa) { |
| 371 | deps += [ |
| 372 | "fpdfsdk/fpdfxfa", |
| 373 | "xfa/fxfa", |
| 374 | "xfa/fxfa/parser", |
| 375 | ] |
Lei Zhang | d7f51c7 | 2018-10-15 17:47:57 +0000 | [diff] [blame] | 376 | } |
| 377 | |
John Abd-El-Malek | d68f9a3 | 2014-06-05 12:45:33 -0700 | [diff] [blame] | 378 | if (is_win) { |
Dan Sinclair | bc6c672 | 2015-10-22 14:58:54 -0400 | [diff] [blame] | 379 | libs += [ |
| 380 | "advapi32.lib", |
| 381 | "gdi32.lib", |
| 382 | "user32.lib", |
| 383 | ] |
John Abd-El-Malek | d68f9a3 | 2014-06-05 12:45:33 -0700 | [diff] [blame] | 384 | } |
| 385 | |
| 386 | if (is_mac) { |
Sylvain Defresne | 7e78b97 | 2020-07-07 18:02:25 +0000 | [diff] [blame] | 387 | frameworks = [ |
Dan Sinclair | bc6c672 | 2015-10-22 14:58:54 -0400 | [diff] [blame] | 388 | "AppKit.framework", |
| 389 | "CoreFoundation.framework", |
| 390 | ] |
John Abd-El-Malek | d68f9a3 | 2014-06-05 12:45:33 -0700 | [diff] [blame] | 391 | } |
John Abd-El-Malek | ef4dce4 | 2015-02-02 16:52:07 -0800 | [diff] [blame] | 392 | |
dan sinclair | fa171d2 | 2017-03-26 22:38:17 -0400 | [diff] [blame] | 393 | if (pdf_is_complete_lib) { |
Daniel Hosseinian | 1d0d0be | 2019-11-04 21:22:24 +0000 | [diff] [blame] | 394 | static_component_type = "static_library" |
dan sinclair | fa171d2 | 2017-03-26 22:38:17 -0400 | [diff] [blame] | 395 | complete_static_lib = true |
Tom Anderson | da89ac4 | 2018-03-21 03:56:15 +0000 | [diff] [blame] | 396 | configs -= [ "//build/config/compiler:thin_archive" ] |
dan sinclair | fa171d2 | 2017-03-26 22:38:17 -0400 | [diff] [blame] | 397 | } |
John Abd-El-Malek | d68f9a3 | 2014-06-05 12:45:33 -0700 | [diff] [blame] | 398 | } |
| 399 | |
Dirk Pranke | f9562f5 | 2023-02-28 01:30:53 +0000 | [diff] [blame] | 400 | # Targets below this are only visible within this file. |
| 401 | visibility = [ ":*" ] |
John Abd-El-Malek | d68f9a3 | 2014-06-05 12:45:33 -0700 | [diff] [blame] | 402 | |
Lei Zhang | f03f781 | 2018-10-15 23:48:29 +0000 | [diff] [blame] | 403 | group("pdfium_unittest_deps") { |
Lei Zhang | dbaf3b8 | 2018-10-11 17:02:43 +0000 | [diff] [blame] | 404 | testonly = true |
Lei Zhang | f03f781 | 2018-10-15 23:48:29 +0000 | [diff] [blame] | 405 | public_deps = [ |
| 406 | "core/fxcrt", |
Tom Sepez | 2281853 | 2020-07-22 20:40:56 +0000 | [diff] [blame] | 407 | "testing:unit_test_support", |
Tom Sepez | 16b9d77 | 2017-04-17 09:07:48 -0700 | [diff] [blame] | 408 | "//testing/gmock", |
Dan Sinclair | fffc963 | 2016-03-08 08:57:05 -0500 | [diff] [blame] | 409 | "//testing/gtest", |
Tom Sepez | 04681f3 | 2015-01-09 13:59:19 -0800 | [diff] [blame] | 410 | ] |
Lei Zhang | f03f781 | 2018-10-15 23:48:29 +0000 | [diff] [blame] | 411 | visibility += [ |
| 412 | "core/*", |
| 413 | "fpdfsdk/*", |
| 414 | "fxbarcode/*", |
| 415 | "fxjs/*", |
| 416 | "xfa/*", |
| 417 | ] |
| 418 | } |
| 419 | |
| 420 | test("pdfium_unittests") { |
| 421 | testonly = true |
Lei Zhang | 40f9d72 | 2020-01-24 00:18:11 +0000 | [diff] [blame] | 422 | sources = [ "testing/unit_test_main.cpp" ] |
Lei Zhang | f03f781 | 2018-10-15 23:48:29 +0000 | [diff] [blame] | 423 | 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 Zhang | ac52015 | 2018-11-09 22:58:56 +0000 | [diff] [blame] | 429 | "core/fpdfapi/render:unittests", |
Lei Zhang | f03f781 | 2018-10-15 23:48:29 +0000 | [diff] [blame] | 430 | "core/fpdfdoc:unittests", |
| 431 | "core/fpdftext:unittests", |
| 432 | "core/fxcodec:unittests", |
| 433 | "core/fxcrt", |
| 434 | "core/fxcrt:unittests", |
Lei Zhang | f03f781 | 2018-10-15 23:48:29 +0000 | [diff] [blame] | 435 | "core/fxge:unittests", |
| 436 | "fpdfsdk:unittests", |
Lei Zhang | 220ef3d | 2019-02-05 20:40:54 +0000 | [diff] [blame] | 437 | "testing:unit_test_support", |
Lei Zhang | f03f781 | 2018-10-15 23:48:29 +0000 | [diff] [blame] | 438 | "//testing/gmock", |
| 439 | "//testing/gtest", |
| 440 | ] |
| 441 | configs += [ ":pdfium_core_config" ] |
Lei Zhang | a996ff4 | 2018-10-15 23:49:48 +0000 | [diff] [blame] | 442 | |
| 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 Zhang | a996ff4 | 2018-10-15 23:49:48 +0000 | [diff] [blame] | 453 | |
Tom Sepez | 2281853 | 2020-07-22 20:40:56 +0000 | [diff] [blame] | 454 | if (pdf_enable_xfa) { |
| 455 | deps += [ |
| 456 | "core/fxcrt/css:unittests", |
| 457 | "fxbarcode:unittests", |
| 458 | "xfa/fde:unittests", |
Tom Sepez | a58a676 | 2020-10-14 00:14:53 +0000 | [diff] [blame] | 459 | "xfa/fgas/crt:unittests", |
Tom Sepez | 9290522 | 2021-12-07 00:03:27 +0000 | [diff] [blame] | 460 | "xfa/fgas/font:unittests", |
Tom Sepez | 2281853 | 2020-07-22 20:40:56 +0000 | [diff] [blame] | 461 | "xfa/fgas/layout:unittests", |
| 462 | "xfa/fxfa:unittests", |
Lei Zhang | 605b4e1 | 2022-02-24 01:43:24 +0000 | [diff] [blame] | 463 | "xfa/fxfa/formcalc:unittests", |
Tom Sepez | 2281853 | 2020-07-22 20:40:56 +0000 | [diff] [blame] | 464 | "xfa/fxfa/parser:unittests", |
| 465 | ] |
| 466 | } |
Tom Sepez | d2e023b | 2015-12-08 14:36:16 -0800 | [diff] [blame] | 467 | } |
Tom Sepez | 04681f3 | 2015-01-09 13:59:19 -0800 | [diff] [blame] | 468 | } |
Tom Sepez | 1b1bb49 | 2015-01-22 17:36:32 -0800 | [diff] [blame] | 469 | |
Lei Zhang | 1929d6e | 2018-10-15 23:51:28 +0000 | [diff] [blame] | 470 | group("pdfium_embeddertest_deps") { |
| 471 | testonly = true |
| 472 | public_deps = [ |
| 473 | ":pdfium_public_headers", |
| 474 | "core/fxcrt", |
| 475 | "testing:embedder_test_support", |
Lei Zhang | fc45549 | 2019-06-14 17:16:09 +0000 | [diff] [blame] | 476 | "third_party:pdfium_base_test_support", |
Lei Zhang | 1929d6e | 2018-10-15 23:51:28 +0000 | [diff] [blame] | 477 | "//testing/gmock", |
| 478 | "//testing/gtest", |
| 479 | ] |
| 480 | visibility += [ |
| 481 | "core/*", |
| 482 | "fpdfsdk/*", |
| 483 | "fxjs/*", |
| 484 | "xfa/*", |
| 485 | ] |
| 486 | } |
| 487 | |
Tom Sepez | 1b1bb49 | 2015-01-22 17:36:32 -0800 | [diff] [blame] | 488 | test("pdfium_embeddertests") { |
Lei Zhang | dbaf3b8 | 2018-10-11 17:02:43 +0000 | [diff] [blame] | 489 | testonly = true |
Lei Zhang | 40f9d72 | 2020-01-24 00:18:11 +0000 | [diff] [blame] | 490 | sources = [ "testing/embedder_test_main.cpp" ] |
Tom Sepez | 1b1bb49 | 2015-01-22 17:36:32 -0800 | [diff] [blame] | 491 | deps = [ |
Tom Sepez | af33f51 | 2020-06-12 01:00:10 +0000 | [diff] [blame] | 492 | ":pdfium_embeddertest_deps", |
Lei Zhang | 1929d6e | 2018-10-15 23:51:28 +0000 | [diff] [blame] | 493 | "core/fpdfapi/edit:embeddertests", |
Lei Zhang | 1929d6e | 2018-10-15 23:51:28 +0000 | [diff] [blame] | 494 | "core/fpdfapi/parser:embeddertests", |
| 495 | "core/fpdfapi/render:embeddertests", |
| 496 | "core/fxcodec:embeddertests", |
Tom Anderson | 0db20e0 | 2019-05-14 22:38:47 +0000 | [diff] [blame] | 497 | "core/fxcrt", |
Lei Zhang | 1929d6e | 2018-10-15 23:51:28 +0000 | [diff] [blame] | 498 | "core/fxge:embeddertests", |
| 499 | "fpdfsdk:embeddertests", |
Tom Sepez | ec350d9 | 2022-10-26 15:52:36 +0000 | [diff] [blame] | 500 | "fpdfsdk/formfiller:embeddertests", |
Lei Zhang | 1929d6e | 2018-10-15 23:51:28 +0000 | [diff] [blame] | 501 | "fpdfsdk/pwl:embeddertests", |
Lei Zhang | 76833a6 | 2018-10-12 18:53:17 +0000 | [diff] [blame] | 502 | "testing/image_diff", |
Dan Sinclair | fffc963 | 2016-03-08 08:57:05 -0500 | [diff] [blame] | 503 | "//testing/gmock", |
| 504 | "//testing/gtest", |
Tom Sepez | 1b1bb49 | 2015-01-22 17:36:32 -0800 | [diff] [blame] | 505 | ] |
dsinclair | 685bb88 | 2016-04-20 07:32:39 -0700 | [diff] [blame] | 506 | include_dirs = [ "testing/gmock/include" ] |
thestig | c65e11e | 2016-08-30 21:56:33 -0700 | [diff] [blame] | 507 | configs += [ ":pdfium_core_config" ] |
| 508 | |
Lei Zhang | a996ff4 | 2018-10-15 23:49:48 +0000 | [diff] [blame] | 509 | if (is_android) { |
| 510 | ignore_all_data_deps = true |
| 511 | use_raw_android_executable = true |
| 512 | } |
| 513 | |
Tom Sepez | 452b4f3 | 2015-10-13 09:27:27 -0700 | [diff] [blame] | 514 | if (pdf_enable_v8) { |
Lei Zhang | 1929d6e | 2018-10-15 23:51:28 +0000 | [diff] [blame] | 515 | deps += [ |
| 516 | "fxjs:embeddertests", |
| 517 | "//v8", |
Lei Zhang | 1ac47eb | 2015-12-21 11:04:44 -0800 | [diff] [blame] | 518 | ] |
Jochen Eisinger | 7ed503d | 2015-12-10 14:38:06 +0100 | [diff] [blame] | 519 | configs += [ "//v8:external_startup_data" ] |
Tom Sepez | 452b4f3 | 2015-10-13 09:27:27 -0700 | [diff] [blame] | 520 | } |
Lei Zhang | a996ff4 | 2018-10-15 23:49:48 +0000 | [diff] [blame] | 521 | |
Dan Sinclair | 14aacd5 | 2017-05-18 14:11:29 -0400 | [diff] [blame] | 522 | if (pdf_enable_xfa) { |
Lei Zhang | 1929d6e | 2018-10-15 23:51:28 +0000 | [diff] [blame] | 523 | deps += [ |
Lei Zhang | 8345825 | 2019-03-14 20:07:20 +0000 | [diff] [blame] | 524 | "fpdfsdk/fpdfxfa:embeddertests", |
Lei Zhang | 1929d6e | 2018-10-15 23:51:28 +0000 | [diff] [blame] | 525 | "xfa/fwl:embeddertests", |
Tom Sepez | 6e4710a | 2019-05-08 17:23:18 +0000 | [diff] [blame] | 526 | "xfa/fxfa/layout:embeddertests", |
Lei Zhang | 1929d6e | 2018-10-15 23:51:28 +0000 | [diff] [blame] | 527 | "xfa/fxfa/parser:embeddertests", |
Dan Sinclair | 14aacd5 | 2017-05-18 14:11:29 -0400 | [diff] [blame] | 528 | ] |
| 529 | } |
Tom Sepez | 1b1bb49 | 2015-01-22 17:36:32 -0800 | [diff] [blame] | 530 | } |
dsinclair | 685bb88 | 2016-04-20 07:32:39 -0700 | [diff] [blame] | 531 | |
Tom Sepez | 1d78f4d | 2018-10-22 20:17:38 +0000 | [diff] [blame] | 532 | executable("pdfium_diff") { |
| 533 | testonly = true |
Lei Zhang | 40f9d72 | 2020-01-24 00:18:11 +0000 | [diff] [blame] | 534 | sources = [ "testing/image_diff/image_diff.cpp" ] |
Tom Sepez | 1d78f4d | 2018-10-22 20:17:38 +0000 | [diff] [blame] | 535 | deps = [ |
Tom Anderson | 9310106 | 2019-05-07 02:08:43 +0000 | [diff] [blame] | 536 | "core/fxcrt", |
Lei Zhang | 2420447 | 2020-08-22 00:51:02 +0000 | [diff] [blame] | 537 | "testing:path_service", |
Tom Sepez | 1d78f4d | 2018-10-22 20:17:38 +0000 | [diff] [blame] | 538 | "testing/image_diff", |
| 539 | "//build/win:default_exe_manifest", |
| 540 | ] |
Lei Zhang | 7a5f8ee | 2021-04-24 00:19:10 +0000 | [diff] [blame] | 541 | configs += [ ":pdfium_strict_config" ] |
Tom Sepez | 1d78f4d | 2018-10-22 20:17:38 +0000 | [diff] [blame] | 542 | } |
| 543 | |
dsinclair | 685bb88 | 2016-04-20 07:32:39 -0700 | [diff] [blame] | 544 | if (pdf_is_standalone) { |
Daniel Hosseinian | 0fab9e6 | 2019-11-01 19:31:49 +0000 | [diff] [blame] | 545 | source_set("samples") { |
dsinclair | 685bb88 | 2016-04-20 07:32:39 -0700 | [diff] [blame] | 546 | testonly = true |
Lei Zhang | 40f9d72 | 2020-01-24 00:18:11 +0000 | [diff] [blame] | 547 | deps = [ "//samples" ] |
dsinclair | 685bb88 | 2016-04-20 07:32:39 -0700 | [diff] [blame] | 548 | } |
Lei Zhang | 143959d | 2017-06-22 12:20:58 -0700 | [diff] [blame] | 549 | |
thestig | 62114cf | 2016-11-08 12:59:30 -0800 | [diff] [blame] | 550 | group("fuzzers") { |
| 551 | testonly = true |
Lei Zhang | 40f9d72 | 2020-01-24 00:18:11 +0000 | [diff] [blame] | 552 | deps = [ "//testing/fuzzers" ] |
thestig | 62114cf | 2016-11-08 12:59:30 -0800 | [diff] [blame] | 553 | } |
dsinclair | 685bb88 | 2016-04-20 07:32:39 -0700 | [diff] [blame] | 554 | } |
Lei Zhang | f02c8bf | 2017-04-01 01:35:01 -0700 | [diff] [blame] | 555 | |
| 556 | group("pdfium_all") { |
| 557 | testonly = true |
| 558 | deps = [ |
Tom Sepez | 1d78f4d | 2018-10-22 20:17:38 +0000 | [diff] [blame] | 559 | ":pdfium_diff", |
Lei Zhang | f02c8bf | 2017-04-01 01:35:01 -0700 | [diff] [blame] | 560 | ":pdfium_embeddertests", |
| 561 | ":pdfium_unittests", |
| 562 | ] |
| 563 | if (pdf_is_standalone) { |
| 564 | deps += [ |
| 565 | ":fuzzers", |
| 566 | ":samples", |
| 567 | ] |
| 568 | } |
| 569 | } |
K. Moon | 1852aa0 | 2022-11-10 18:56:52 +0000 | [diff] [blame] | 570 | |
| 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. |
| 574 | group("gn_check") { |
| 575 | deps = [] |
| 576 | |
| 577 | # TODO(crbug.com/pdfium/1832): Remove !is_android when //third_party/expat is |
| 578 | # available. |
K. Moon | a98c089 | 2022-11-12 00:44:23 +0000 | [diff] [blame] | 579 | if (defined(checkout_skia) && checkout_skia && !is_android) { |
K. Moon | 1852aa0 | 2022-11-10 18:56:52 +0000 | [diff] [blame] | 580 | deps += [ "//skia" ] |
| 581 | } |
| 582 | } |